A pod can have p99 latency spikes, failing probes and slow requests while its CPU graph sits well under the limit and the node is mostly idle. The usual cause is CPU throttling, and it is easy to miss because the standard usage graph does not show it.
Here is what is going on and how to check your own cluster.
Requests and limits do different jobs
- CPU request: used by the scheduler to place the pod, and as the container's relative share of CPU when the node is busy. It is a guarantee of weight, not a cap.
- CPU limit: a hard cap, enforced with the Linux CFS quota. Even if the node has idle cores, the container is paused once it uses up its quota.
Memory is different. Memory cannot be paused, so a container that goes over its memory limit is OOM-killed. CPU is compressible, so the kernel makes the container wait instead.
How the quota actually works
The quota is handed out in short periods, 100 ms by default. A limit of 500m means 50 ms of CPU time per 100 ms period, counted across all threads of the container.
Take an app with four busy threads and a 500m limit. The four threads can use the whole 50 ms in about 12 ms of wall-clock time. For the remaining 88 ms of that period, every thread is stopped, including the one answering your health check. A request that needed 20 ms of CPU can take over 100 ms.
The average usage graph looks fine, because average usage over a minute is still below 500m. The damage happens inside each 100 ms window.
How to see it
Throttling has its own counters, exposed by cAdvisor:
sum by (namespace, pod, container) ( rate(container_cpu_cfs_throttled_periods_total[5m]) ) / sum by (namespace, pod, container) ( rate(container_cpu_cfs_periods_total[5m]) ) This is the fraction of periods in which the container was throttled. A container that is throttled in a large share of its periods deserves a closer look, especially if it serves latency-sensitive traffic. There is no universal threshold, so compare it with the latency of the same service.
You can also read the raw numbers inside a container, in cpu.stat under the cgroup filesystem (nr_throttled and throttled_time).
What to do about it
- Set requests from real usage. Use the observed p90 to p95 of CPU as a starting point, so the scheduler and the share weights reflect reality.
- Be deliberate about limits. Many teams keep CPU requests and drop CPU limits for latency-sensitive services, relying on requests for fair sharing. Others keep limits for noisy neighbours, shared clusters or cost controls. Both are defensible. What is hard to defend is a limit copied from a template that nobody has measured.
- If you keep a limit, leave headroom for multi-threaded runtimes, garbage collection and startup bursts. Match thread pools and runtime settings to the CPU you actually have: Go, the JVM and Node worker pools can all see more cores than the quota allows.
- Keep memory requests and limits close, because memory is not compressible.
- Change one service at a time and compare latency and the throttling ratio before and after.
Things that catch people out
- Probes failing at peak. A throttled container answers health checks slowly. If readiness or liveness probes fail during busy periods, check throttling before you blame the app.
- Autoscaling on the wrong signal. If HPA scales on CPU utilisation relative to requests, inaccurate requests make scaling too early or too late.
- Kernel differences. Throttling behaviour has changed between kernel versions, but the quota model is the same, so the check above still applies.
The short version
A CPU limit is a hard cap that can pause a container while the node has spare cores. Watch the throttling ratio, not just usage, and treat every CPU limit as a decision you can justify with a measurement.
I do remote DevOps and SRE contract work for US and UK teams (Kubernetes, cloud, Terraform, CI/CD, observability). More at https://hritikch24.github.io/?utm_source=devto&utm_medium=article&utm_campaign=sre


