Skip to content

Instantly share code, notes, and snippets.

@udhos
Last active November 10, 2023 06:17
Show Gist options
  • Save udhos/5a22b7d21a987de93f79fe88dfc4416a to your computer and use it in GitHub Desktop.
Save udhos/5a22b7d21a987de93f79fe88dfc4416a to your computer and use it in GitHub Desktop.
Go, Containers, and the Linux Scheduler

Go, Containers, and the Linux Scheduler

https://www.riverphillips.dev/blog/go-cfs/

GOMAXPROCS should be set to the number of CPU cores that the container is allowed to use, if you’re allocating fractional CPU round down, unless you’re allocating less than 1 CPU core in which case round up. GOMAXPROCS=max(1, floor(CPUs)) can be used to calculate the value. If you find it easier Uber has open sourced a library automaxprocs to calculate this value for you from your container’s cgroups automatically.

golang/go#33803

https://github.com/uber-go/automaxprocs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment