You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: worker job buffer increased memory requirements causing excessive cpu for garbage collection (#6500)
🔒 Scanned for secrets using gitleaks 8.28.0
# Description
With the recent worker buffer modifications, each worker’s channel
capacity has increased from **1K** to **10K**. Each channel stores
struct values that occupy **56 bytes per slot**, even when the channel
is empty.
```go
type workerJob struct {
job *jobsdb.JobT // 8 bytes (pointer)
parameters *routerutils.JobParameters// 8 bytes
assignedAt time.Time // 24 bytes (2 int64s + alignment)
drainReason string // 16 bytes (2 words: pointer + length)
}
```
To optimize memory usage, struct pointers are now used instead of struct
values.
This reduces the memory footprint of empty channel slots from **56 bytes
per slot** to **8 bytes per slot**.
## Additional changes
- If `noOfJobsPerChannel` > `maxNoOfJobsPerChannel`, then
`maxNoOfJobsPerChannel` will automatically increase to match
`noOfJobsPerChannel`.
This eliminates the need to manually adjust `maxNoOfJobsPerChannel` when
increasing the channel size.
- Introduced `experimentalBufferSizeMinimum` (default: **500**) to
prevent the experimental calculator from going below this threshold,
provided the worker throughput exceeds 1 job/sec.
Extremely low buffer sizes have been observed to negatively impact
overall throughput.
## Linear Ticket
resolves PIPE-2554
## Security
- [x] The code changed/added as part of this pull request won't create
any security issues with how the software is being used.
0 commit comments