CPU limits cause latency spikes though average usage is low. Why and what is the fix?
IntermediateScenarioResources, autoscaling and scheduling
Answer
Situation read → p99 latency is bad while CPU usage graphs look fine.
What I'd do →
- Check
container_cpu_cfs_throttled_periods_totalin Prometheus - CFS quota throttles in 100ms periods, so bursts hit the limit even at low average
- Remove or raise CPU limits and keep accurate requests
- Keep memory limits
- Re-measure p99 after the change
Why → Throttling is per period, not per average, so spiky services are hurt.
Interview tip → Say many teams run CPU requests without limits.
More on Resources, autoscaling and scheduling
How do you choose requests and limits for a new service?BeginnerPods are Pending with `0/6 nodes are available: 6 Insufficient cpu`. What do you do?IntermediateExplain QoS classes and which pods get evicted first.IntermediateHow do you configure an HPA on CPU?BeginnerHPA shows `<unknown>/70%` for CPU. What do you do?IntermediateYou need to scale on queue length or requests per second, not CPU. How?Intermediate