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
As a result, golangci-lint will run by default with the number of detected logical cores instead of the limit. We observed that running golangci-lint on k8s resulted in it using 32 CPUs even though only 4 were available according to the limit set to the pod. That resulted in increased memory usage probably because the different threads were starved for CPU and were allocating memory in parallel. Eventually, the pod was OOM-killed after reaching the 8GB limit. By manually setting -j 4 or -j 0 we confirmed that the memory usage dropped by 50% and execution time was faster as well.
Describe the solution you'd like
Switch the default behavior to be equivalent to today's -j 0 behavior.
orestisfl
changed the title
Limit concurrency according to Linux container CPU quota
Limit concurrency according to Linux container CPU quota by default
Sep 19, 2024
Welcome
Your feature request related to a problem? Please describe
golangci-lint supports automatically limiting the CPU quota if you use the
--concurrency=0
flag /run.concurrency: 0
option.However, the concurrency is set to
runtime.NumCPU()
and not0
by default:golangci-lint/pkg/commands/run.go
Line 597 in 225f7a0
As a result, golangci-lint will run by default with the number of detected logical cores instead of the limit. We observed that running golangci-lint on k8s resulted in it using 32 CPUs even though only 4 were available according to the limit set to the pod. That resulted in increased memory usage probably because the different threads were starved for CPU and were allocating memory in parallel. Eventually, the pod was OOM-killed after reaching the 8GB limit. By manually setting
-j 4
or-j 0
we confirmed that the memory usage dropped by 50% and execution time was faster as well.Describe the solution you'd like
Switch the default behavior to be equivalent to today's
-j 0
behavior.Describe alternatives you've considered
Manually setting the desired concurrency.
Additional context
No response
Supporter
The text was updated successfully, but these errors were encountered: