What is CPU throttling in cgroups, and how do you detect it?
AdvancedConceptKernel Parameters, Namespaces & cgroups
Answer
With a quota (cpu.max), a cgroup may use only quota µs of CPU per period (100 ms default). A multi-threaded app can burn the whole quota in a few ms and then sit stalled for the rest of the period, causing latency spikes even when average CPU looks low.
cat /sys/fs/cgroup/system.slice/api.service/cpu.stat
# nr_periods, nr_throttled, throttled_usec
A rising nr_throttled ratio means the limit is too tight. Many teams set CPU requests but no CPU limits in Kubernetes for this reason.
More on Kernel Parameters, Namespaces & cgroups
What is sysctl and how do you make a change persistent?BeginnerWhy does Kubernetes require `net.ipv4.ip_forward=1` and `br_netfilter`?AdvancedAre sysctl settings global, or per namespace?AdvancedWhat are Linux namespaces? List all types.BeginnerHow do you create and enter namespaces by hand?AdvancedHow does a network namespace get connectivity?Advanced