Documentation ¶
Overview ¶
Package runtime defines limits for the Go runtime
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NumVCPU ¶
func NumVCPU() int
NumVCPU returns the number of virtualizes CPUs available to the process. It should be used instead of runtime.NumCPU() in virtualized environments like K8s to ensure that processes don't attempt to over-subscribe CPUs. For example, on a 16 vCPU machine in a docker container allocated 8 vCPUs, runtime.NumCPU() will return 16 but NumVCPU() will return 8.
func SetGoMemLimit ¶
SetGoMemLimit configures Go memory soft limit based on cgroups. The soft limit is set to 90% of the cgroup memory hard limit. The function is noop if
- GOMEMLIMIT is set already
- There is no cgroup limit
Read more about Go memory limit in https://tip.golang.org/doc/gc-guide#Memory_limit
func SetMaxProcs ¶
func SetMaxProcs() bool
SetMaxProcs sets the GOMAXPROCS for the go runtime to a sane value
Types ¶
This section is empty.