How does GOMAXPROCS work with CFS cgroup CPU quota

456 views
Skip to first unread message

James Huang

unread,
Aug 9, 2016, 1:39:32 PM8/9/16
to golang-dev
Hey All,

I have a question regarding the relationship between GOMAXPROCS and cgroup CPU quota restriction since I haven't found any result in this forum.

Scenario: 
- we are running multiple containers with cgroup restriction on the same machine. 
- Machine has M number of logical CPU cores
- each container would have roughly N cores of computation resource allocated (N <= M). Restriction is applied with cpu.cfs_quota_us and cpu.cfs_period_us. And container would get throttled if they exceed the allocated resources.
- all containers still see M as number of CPU cores

Question:
- Would this change the assumption of the original default GOMAXPROCS setting (M) for containers? 
-- if so, should we set N as the new "default" GOMAXPROCS, and what is the reason behind this? And is it reasonable to ask golang to read from cgroup setting instead for default value?

Any feedback is appreciated!

Brad Fitzpatrick

unread,
Sep 8, 2016, 9:13:56 PM9/8/16
to James Huang, golang-dev
It doesn't look like you ever got a reply for this.

You should probably set GOMAXPROCS explicitly to the value at which you know you'll get throttled (N).



--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages