Most teams read "CPU throttling despite low usage" as a contradiction and conclude the metric is broken. It is not. The usage graph and the throttling counter measure the same CPU over wildly different time windows, and the gap between them is where your latency goes. A service averaging 200 millicores against a 1 core limit can still be throttled in 30 percent of scheduling periods, and its p99 response time will show it before any usage panel does.

This guide walks through the mechanism, the counters that prove it, the runtime settings that cause most of it, and a short decision tree for choosing a fix that costs less than another node pool. Engineers interviewing for platform roles in Lisbon and Porto get asked this exact question, so the reasoning matters as much as the remedy.

A 100 ms budget, spent in bursts

Kubernetes CPU limits are enforced by the Linux Completely Fair Scheduler's bandwidth control. The kubelet translates a limit into two numbers for the container's cgroup: a period, 100 ms by default, and a quota equal to the limit multiplied by the period. A limit of 500m becomes 50 ms of CPU time per 100 ms window. A limit of 2 becomes 200 ms per window, which can be spent across several cores at once.

Here is the part that trips people up. Quota is counted in CPU time across all threads, while the period is wall clock time. Take a container limited to 500m whose process runs 4 busy threads on a 16 core node.

Those 4 threads burn 4 ms of CPU for every 1 ms of wall time, so the 50 ms quota is gone after 12.5 ms. For the remaining 87.5 ms of that period every thread in the cgroup waits. A request that needed 15 ms of CPU now takes at least 100 ms of wall time, because it straddles a throttled gap.

Now look at the same container over a 60 second scrape window. It ran hard for 12.5 ms in, say, 40 of the 600 periods in that minute and sat idle otherwise. Total CPU used: 40 times 50 ms, or 2 seconds of CPU per 60 seconds, which your dashboard shows as about 33 millicores, under 7 percent of the limit. Meanwhile 40 of 600 periods were throttled, and every request landing in those 40 periods paid an extra delay of up to 87.5 ms.

That is the whole paradox. Usage is an average over thousands of periods. Throttling is a per period event. Bursty, multithreaded work can hit the ceiling repeatedly while the average stays low, and the shorter and spikier your request pattern, the larger the gap.

Reading the counters that prove it

Before changing anything, confirm throttling is real and measure its size. cAdvisor, built into the kubelet, exposes three counters per container that Prometheus can scrape: container_cpu_cfs_periods_total, container_cpu_cfs_throttled_periods_total and container_cpu_cfs_throttled_seconds_total. The ratio of the first two is the number to watch.

sum by (namespace, pod, container) (
  rate(container_cpu_cfs_throttled_periods_total{container!=""}[5m])
)
/
sum by (namespace, pod, container) (
  rate(container_cpu_cfs_periods_total{container!=""}[5m])
)

A ratio of 0.05 means 5 percent of periods hit the quota. Many teams treat anything above 25 percent on a latency sensitive service as worth fixing, though the right threshold depends on how much tail latency you can tolerate.

The throttled seconds counter tells you how long threads waited in total, which is useful for estimating the latency cost per request. Divide its 5 minute rate by your request rate and you get an upper bound on added wait per request, a number product owners understand better than a ratio.

You can also read the raw numbers from inside the container. On cgroup v2 nodes, which most current distributions use, cat /sys/fs/cgroup/cpu.max prints the quota and period, for example "50000 100000" for a 500m limit. cat /sys/fs/cgroup/cpu.stat shows nr_periods, nr_throttled and throttled_usec. Take two readings 60 seconds apart and divide the deltas. On older cgroup v1 nodes the same data lives under /sys/fs/cgroup/cpu/ in cpu.cfs_quota_us and cpu.stat, with throttled_time in nanoseconds.

Correlate the ratio with request latency, not with CPU usage. If p99 rises in step with throttled periods while average CPU is flat, you have found your problem. If p99 stays put, throttling may be cosmetic for that workload, such as a batch job that does not care about a 90 ms pause.

Runtimes that think they own every core

The single most common cause of throttling at low average usage is a runtime that sizes its thread pool from the node's core count instead of the container's limit. On a 32 core node, a process limited to 1 core that spins up 32 worker threads can consume its 100 ms of quota in about 3 ms of wall time if all threads wake together, for example on a garbage collection cycle.

Go is the classic case. For years GOMAXPROCS defaulted to the number of CPUs visible to the process, which inside a container meant the host's cores. The uber-go/automaxprocs library became a standard fix by setting GOMAXPROCS from the cgroup quota at startup. Go 1.25 made the runtime container aware by default, so services built with older toolchains are the ones to check first. Go's parallel garbage collector is a frequent trigger, because it uses up to GOMAXPROCS threads at once.

The JVM has respected container CPU limits since JDK 10, with the support backported to JDK 8u191, so Runtime.availableProcessors() returns the limit rounded up. Problems remain when teams pin -XX:ActiveProcessorCount to a large number or set ParallelGCThreads by hand. Node.js runs JavaScript on one thread, but its libuv pool defaults to 4 threads for file system, DNS and crypto work, and native addons may add more. Nginx with worker_processes auto historically counted host cores; check the version you run.

The fix in each case is the same idea: make concurrency match the CPU you are allowed to use. A service limited to 2 cores running 2 to 4 busy threads will throttle far less than the same service running 32, even with identical average load. This change costs nothing in infrastructure and often lowers p99 more than doubling the limit would.

A decision tree for choosing the fix

Work through these questions in order, and stop at the first yes.

  1. Is the throttled period ratio below about 5 percent and p99 within your target? If yes, leave it alone and add an alert on the ratio so you notice drift.
  2. Does the runtime size its threads from the host core count? If yes, set GOMAXPROCS, ActiveProcessorCount, worker counts or pool sizes to match the limit, redeploy and remeasure before touching anything else.
  3. Is the node kernel older than the release that fixed the CFS slice expiry bug? If yes, plan a node image upgrade; that bug produced heavy throttling at very low usage on multi core machines.
  4. Is the limit lower than the work a single request burst needs? Compute CPU per request times concurrent requests per 100 ms. If that exceeds the quota, raise the limit to cover the burst, not the average.
  5. Is this a latency critical service on nodes you control, with requests set honestly? If yes, consider removing the CPU limit and keeping the request, so the pod can borrow idle cycles while its request still guarantees a fair share under contention.
  6. Do you need hard isolation, for example a noisy multi tenant cluster? If yes, keep the limit, run the pod in the Guaranteed QoS class with an integer CPU count and enable the static CPU manager policy, which gives it exclusive cores and removes quota contention between its own threads and neighbours.

Notice the order. The cheapest changes, configuration in the application, come first. Infrastructure changes come last.

Mistakes that keep throttling alive

These come up repeatedly in post incident reviews:

  • Sizing limits from the average usage graph. A 1 minute average hides 100 ms bursts by design, so a limit set at "2 times average" can still be too small for every burst.
  • Raising the limit without fixing thread counts. Going from 1 core to 2 with 32 threads still lets the quota drain in about 6 ms; you pay for the extra core and keep most of the throttling.
  • Watching CPU usage panels instead of the throttled ratio. Many default dashboards do not chart throttling at all.
  • Setting requests equal to limits everywhere by habit. It buys predictable scheduling but turns every burst into a throttle event; the trade only makes sense where isolation matters more than tail latency.
  • Removing limits cluster wide in one change. Without accurate requests, one runaway pod can starve neighbours, and the incident simply moves elsewhere.
  • Ignoring the kernel. A fix for slice expiry, merged for Linux 5.4 and backported to several stable branches, removed a source of throttling that no amount of tuning could reach. Old node images still carry the bug.

The pattern behind most of these is treating CPU as a single number. It is two numbers, a share and a ceiling, enforced on a time scale far shorter than the one you chart. Requests decide placement and fair share when the node is busy; limits decide when the kernel pauses you, even on an idle node. Keeping that distinction in mind answers most of the arguments in the list above.

A budget checklist before you buy bigger nodes

Run through this list before any capacity request. Each item takes minutes, and every skipped item is a reason a bigger node may change nothing:

  • Throttled period ratio charted per container, with p99 latency on the same panel.
  • Runtime concurrency checked against the limit: GOMAXPROCS, JVM processor count, worker pools.
  • Go services rebuilt with a container aware toolchain or automaxprocs.
  • Node kernel version confirmed newer than the CFS slice expiry fix.
  • Limits sized from burst demand per 100 ms period, using CPU per request and peak concurrency.
  • Requests set from realistic steady usage, so removing a limit stays safe.
  • A written decision per service on whether it needs hard limits for isolation.

In practice, the first three items resolve a large share of cases without a single extra euro of compute. One illustrative example: a Go API limited to 1 core on 48 core nodes, throttled in 38 percent of periods at an average of 180 millicores, drops to under 3 percent after setting GOMAXPROCS to 1 and upgrading the toolchain, and its p99 falls from 240 ms to 70 ms. No limit changed and no node was added.

Kernel developers have since added CFS burst, a cgroup setting that lets a container bank unused quota for short spikes, available since Linux 5.14. Kubernetes does not expose it as a first class pod field yet. Will burst allowances finally make CPU limits fit bursty services, or will the industry settle on requests only for latency critical workloads and keep limits for batch jobs?