Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NUMCPU = runtime.GOMAXPROCS(0) NUMCPUx2 = NUMCPU * 2 NUMCPU_2 = NUMCPU / 2 )
Use runtime.GOMAXPROCS instead of runtime.NumCPU because NumCPU returns the physical CPU cores. However, in a containerization context, that might not be what we want. The physical node could have 128 cores, but we could be cgroup-limited to 2 cores. In that case, we want 2 to be our limit, not 128. It isn't guaranteed that MAXPROCS reflects the cgroup limit, but at least there is a chance that it was set correctly. If not, it defaults to NumCPU anyway, so we're not any worse off.
Functions ¶
func NoMoreThanNUMCPU ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.