News for hackers. Stuff that matters.
Re:Introduction to Golang Preemption Mechanisms by EdSchouten on Monday August 12, 2024 @07:03AM (#41223140)
If you’re on Kubernetes, you can solve this/work around this by enabling the static CPU manager policy:

https://kubernetes.io/docs/tasks/administer-cluster/cpu-mana...

Re:Introduction to Golang Preemption Mechanisms by Zimnx on Monday August 12, 2024 @09:24AM (#41224100)
No, 'static' CPU manager policy provides ability to allocate CPUs exclusively to container cgroup. But since Go runtime doesn't read cpugroup information anyway, it still sees all available CPUs.
Re:Introduction to Golang Preemption Mechanisms by __turbobrew__ on Monday August 12, 2024 @11:55AM (#41225878)
Correct
Re:Introduction to Golang Preemption Mechanisms by EdSchouten on Thursday August 15, 2024 @01:19PM (#41258311)
Static CPU manager also affects the cores that sched_get affinity returns. And that’s what Go uses to obtain the core count.
Re:Introduction to Golang Preemption Mechanisms by __turbobrew__ on Sunday August 18, 2024 @09:44PM (#41287093)
That is only true if the pod is running within the guaranteed runtime class (requests==limits). For pods where requests!=limits a common set of cpus are used for all burstable pods, otherwise bursting past requests would not work.

This still allows the worst case where a node with 100 cpus running butstable pods will still see huge overheads in the golang scheduling runtime.

To my knowledge (I have done a lot of research into not only runc but also gvisor) there is no way to have the go runtime and cgroups interact in a sane way currently by default.

If the golang runtime was cgroup aware I do believe it is possible to have sane defaults, especially since the JVM and CLR have done so.