Interview Prep/Real-World Interview/Scaling and performance

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 →

  1. Confirm with the throttling ratio:
rate(container_cpu_cfs_throttled_periods_total{container="api"}[5m])
/ rate(container_cpu_cfs_periods_total{container="api"}[5m])
  1. Check thread count against the limit: 16 threads on a 1-CPU limit will throttle in bursts.
  2. Options: raise the limit, remove the CPU limit while keeping requests (common for latency-sensitive services), or cap runtime threads (GOMAXPROCS, JVM ActiveProcessorCount).
  3. 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.

All Real-World Interview questions Roadmap: Interview readiness

More on Scaling and performance