Skip to content

Commit

Permalink
add log for mutex usage
Browse files Browse the repository at this point in the history
  • Loading branch information
kenanfarukcakir committed Feb 21, 2024
1 parent a913155 commit f22b956
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions aggregator/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,9 @@ func NewAggregator(parentCtx context.Context, k8sChan <-chan interface{},
// but on 64-bit systems, maxPid can be 4194304
// and we don't want to allocate 4194304 mutexes, it adds up to 4194304 * 24 bytes = 100MB
// So, some process will have to share the mutex
// 1 mutex per 100 pid is a good trade-off
// 4194304 / 100 = 41943
// 41943 * 24 bytes = 1MB

// assume liveprocesses can increase up to 100 times of current count
// if processes exceeds the count of mutex, they will share the mutex
countMuArray := countLiveProcesses * 100
if countMuArray > maxPid {
countMuArray = maxPid
Expand Down

0 comments on commit f22b956

Please sign in to comment.