Re:Introduction to Golang Preemption Mechanisms
by kbolino on Monday August 12, 2024 @10:21AM
(#41224707)
What people want is that, if cgroup limits prevent a container from using more than M/N of CPU time (N the number of cores), then GOMAXPROCS defaults to M. Ditto other managed language runtimes and their equivalent parameters.
However, as far as I can tell, there's no clear way to figure out what M is, in the general case.
Re:Introduction to Golang Preemption Mechanisms
by lcof on Monday August 12, 2024 @11:02AM
(#41225224)
Again, I might be wrong as I did not use this directly in a couple years, but saying “the limit is 50% share of 10 cores” is not equivalent to “the limit is 5 cores”. This is still “how much” versus “how many”, and cannot translate into each other without sacrificing flexibility
Re:Introduction to Golang Preemption Mechanisms
by kbolino on Monday August 12, 2024 @11:10AM
(#41225350)
GOMAXPROCS sets the number of live system threads used to run goroutines. The distinction between 50% of time on 10 cores and 100% of time on 5 cores doesn't really matter here: the recommendation is to set GOMAXPROCS=5 in both cases.
Re:Introduction to Golang Preemption Mechanisms
by trws on Monday August 12, 2024 @02:18PM
(#41227625)
I think your comment was once completely correct, but there is now also a “cpuset” cgroup in addition to the classic cpu setting. The cpuset control gives something equivalent to sched_setaffinity but stronger since the client processes can’t unset parts of the mask or override it IIRC.
I may have misunderstood the rationale here, but I think the discussion about cgroup support is not about limiting the number of Ps