Skip to content

Commit

Permalink
chore(proctree): lower process default cache size
Browse files Browse the repository at this point in the history
Adjust the default process cache size to 16,384, setting a 2:1 ratio
between thread and process caches.

With GOGC=5 and both caches stressed, was observed an average heap usage
of 77MB.
  • Loading branch information
geyslan committed Dec 16, 2024
1 parent 4a5bb5d commit f8963e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/docs/advanced/data-sources/builtin/process-tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The underlying structure is populated using the core `sched_process_fork`, `sche

> Introducing this secondary event source is strategic: it reduces interference with actively traced events, leading to more accurate and granular updates in the process tree.
The number of processes retained in the tree hinges on cache size. We have two separate caches at play: one for processes and another for threads. Both default to a size of 32K, supporting tracking for up to 32,768 processes and the same number of threads. It's worth noting that these are LRU caches: once full, they'll evict the least recently accessed entries to accommodate fresh ones.
The number of processes retained in the tree hinges on cache size. We have two separate caches at play: one for processes and another for threads. The default cache size for processes is 16K, supporting tracking for up to 16,384 processes, while the thread cache is 32K, supporting tracking for up to 32,768 threads. On average, a configuration ratio of 2:1 (thread:cache) is defined, as one thread is created for every process. It's worth noting that these are LRU caches: once full, they'll evict the least recently accessed entries to accommodate fresh ones.

The process tree query the procfs upon initialization and during runtime to fill missing data:
* During initialization, it runs over all procfs to fill all existing processes and threads
Expand All @@ -34,7 +34,7 @@ Example:
signals | process tree is built from signals.
both | process tree is built from both events and signals.
--proctree process-cache=8192 | will cache up to 8192 processes in the tree (LRU cache).
--proctree thread-cache=4096 | will cache up to 4096 threads in the tree (LRU cache).
--proctree thread-cache=16384 | will cache up to 16384 threads in the tree (LRU cache).
--proctree process-cache-ttl=60 | will set the process cache element TTL to 60 seconds.
--proctree thread-cache-ttl=60 | will set the thread cache element TTL to 60 seconds.
--proctree disable-procfs-query | Will disable procfs quering during runtime
Expand Down
2 changes: 1 addition & 1 deletion pkg/proctree/proctree.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
//

const (
DefaultProcessCacheSize = 32768
DefaultProcessCacheSize = 16384
DefaultThreadCacheSize = 32768
DefaultProcessCacheTTL = time.Second * 120
DefaultThreadCacheTTL = time.Second * 120
Expand Down

0 comments on commit f8963e0

Please sign in to comment.