Kubernetes node swap enables up to 3x pod density with NVMe SSDs
By leveraging cgroup v2 and fast NVMe storage, Kubernetes can now use node swap to significantly increase pod density for bursty or idle workloads.
Summary
Following the General Availability of node swap in Kubernetes v1.34, new benchmarks demonstrate how backing swap with fast NVMe SSDs can mitigate memory constraints. The analysis shows that for workloads like sandboxed Python runtimes and headless browsers, pod density can increase by 100% to 300% with minimal latency impact. This approach uses cgroup v2 to provide independent swap accounting, solving previous limitations found in cgroup v1.
Performance gains and technical requirements
- Requires cgroup v2 for independent memory and swap accounting to prevent unpredictable container usage.
- Performance is optimized by using NVMe Local SSDs to minimize the latency penalty of paging.
- Python sandboxes (gVisor) saw a 3x density increase (from 80 to 240 pods).
- Headless Chrome (gVisor) saw a 2x density increase (from 80 to 160 pods).
- Headless Chrome (Kata) saw a 25% density increase (from 40 to 50 pods).
- For CI/CD kernel builds, swap allowed reducing the RAM limit from 600 MB to 300 MB without execution slowdown.
Why it matters
This allows operators to run more intensive AI agentic workloads and sandboxed environments on existing hardware by effectively using disk space as a memory buffer.
Original reference: kubernetes.io →