Pods get throttled even though average CPU usage is far below the limit. Why?
AdvancedScenarioScaling and performance
Answer
Situation read → CPU limits are enforced per 100ms CFS period. A multi-threaded app can burn its whole quota in the first 20ms and then wait 80ms, while the 1-minute average looks low.
What I'd do →
- Confirm with the throttling ratio:
rate(container_cpu_cfs_throttled_periods_total{container="api"}[5m])
/ rate(container_cpu_cfs_periods_total{container="api"}[5m])
- Check thread count against the limit: 16 threads on a 1-CPU limit will throttle in bursts.
- Options: raise the limit, remove the CPU limit while keeping requests (common for latency-sensitive services), or cap runtime threads (
GOMAXPROCS, JVMActiveProcessorCount). - Keep memory limits; memory is not compressible, CPU is.
Why → Averages don't show sub-second bursts, but users feel them as tail latency.
Interview tip → Explaining the 100ms CFS period is what makes this answer convincing.
More on Scaling and performance
Traffic is expected to 10x for a sale next week. How do you prepare the platform?IntermediateThe HPA is configured but pods don't scale even though the app is slow. Why?BeginnerPods are Pending during a traffic spike because the cluster is out of capacity. What do you do now and long term?IntermediateThe database CPU is at 95% and the API is timing out. What's your approach?Intermediate"Too many connections" errors from Postgres after scaling the app out. How do you fix it?IntermediateLatency is fine on average but p99 is terrible. Where do you look?Advanced