Kubernetes Blog
Follow
New Conversion from cgroup v1 CPU Shares to v2 CPU Weight
The document announces an improved conversion formula for mapping CPU shares from cgroup v1 to CPU weight in cgroup v2. The original linear formula presented two main issues limiting the performance of Kubernetes workloads. The first problem led to reduced CPU priority for Kubernetes workloads compared to non-Kubernetes processes in cgroup v2. The second was a lack of granularity for distributing resources within containers.The new approach utilizes a more complex quadratic formula to address these problems. The new conversion formula aims to provide better priority alignment, especially for containers requesting one CPU. The new formula also provides improved granularity for distributing resources within containers, better supporting fine-grained CPU resource distribution.This enhancement is implemented at the OCI layer, meaning it depends on the OCI runtime. Runc version 1.3.2 and crun version 1.23 onwards support the new formula. Existing deployments using tools or monitoring systems relying on the old linear formula may require updates. The Kubernetes project recommends testing the updated formula in non-production environments to ensure compatibility. Users can find more details in the provided links. The Kubernetes Node Special Interest Group welcomes new contributors for related challenges.