Closed agravelot closed 1 month ago
I hadn't noticed this PR with better explaination: https://github.com/antonputra/tutorials/pull/278 May still be relevant to the current branch.
Thank you, @agravelot! I did some more research and even ran tests. You're right—GOMAXPROCS makes a significant difference! I'll be using it in all my future benchmarks.
env:
- name: GOMAXPROCS
valueFrom:
resourceFieldRef:
resource: limits.cpu
resources:
requests:
memory: 128Mi
cpu: 500m
limits:
memory: 256Mi
cpu: 1000m
If your k8s node has more cpus than your deployment limit, the golang scheduler will not be aware of the kubernetes CFS scheduler, leading to many/all coroutines in a sleep state, false result. Setting
GOMAXPROCS=2
as in k8s deployment can lead to better performance.https://github.com/uber-go/automaxprocs is specially designed for this purpose.
Related discussion: https://github.com/antonputra/tutorials/pull/288