automaxprocs is a Go library that automatically sets GOMAXPROCS to match Linux container CPU quota.
The problem it solves is that Go's default GOMAXPROCS behavior does not account for container CPU limits, causing the runtime to spawn more OS threads than the container can actually use. This leads to excessive context switching, CPU throttling, and degraded performance. automaxprocs detects the CPU quota imposed by the container's cgroup and adjusts GOMAXPROCS accordingly, eliminating throttling and improving throughput and latency.
Projects running Go services in containerized environments should adopt this tool, particularly those deployed on Kubernetes or other container orchestration platforms where CPU quotas are common. It is especially valuable for latency-sensitive workloads where P99 tail latencies matter. The library requires only a single import and function call to activate, making integration straightforward. Performance data from production load balancers shows that matching GOMAXPROCS to the CPU quota significantly improves request throughput and reduces tail latencies compared to Go's default behavior.
The project is stable with finalized APIs and a commitment to semantic versioning. Maintenance activity shows consistent attention to issues and pull requests, with established contribution guidelines and a code of conduct enforced through a dedicated reporting channel.