automaxprocs
automaxprocs copied to clipboard
Automatically set GOMAXPROCS to match Linux container CPU quota.
Hello 👋🏻 Are there any plans to support the soft RAM limit introduced in Go 1.19? (Either in this library or a new one)
Am i right that if you have a service with a cpu limit less than 1000m (eg 1 core) the go process would still think it has one core available...
This PR exposes the api for querying the cpu quota. The specific use case is when we need to specify the concurrency level (via cli arg) for a non-golang subprocess.
When use **make test** base on this case `8 5 0:7 /docker /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime shared:8 - cgroup cgroup rw,memory 9 5 0:8 /docker/memory.vmstat /sys/fs/cgroup/vmstat rw,nosuid,nodev,noexec,relatime shared:8 - cgroup cgroup rw,memory...
/proc/self/mountinfo like this:  and cgroup MemoryQuota is not work. last matched mount path will replace the rel path.
when shareProcessNamespace=true, business container's pid is not equals to 1. There is no cgroup mountinfo in /proc/self/mountinfo, but it is in /proc/1/mountinfo.
The logic to read the core count from cgroups is very valuable. In some settings it might be desirable to read the value but not set GOMAXPROCS with it. This...
Go 1.13 and go modules are being used. I have used v1.1.0 using Set with a logger. v1.1.0 tells me that GOMAXPROCS has been reduced from 4 to 1 because...
After import automaxprocs, the process will print **"2019/07/09 14:18:22 maxprocs: Leaving GOMAXPROCS=2: CPU quota undefined"** through STDOUT. There is no information to identify this line is an INFO, WARNING or...
Fixes a leak with the file descriptor within the cgroups v2 functionality.