Skip to main content
All of the catalog
Injectable fault

CPU throttling: a limit set to save cost

go-api has got slow since the cost review's resource changes went out, and the latency SLO is burning: p99 is in seconds while the median still looks fine. Nothing restarts, nothing is OOMKilled, every pod is Running and Ready, and the error rate is flat. The node it runs on is nearly idle, so this is not a crowded machine.

ResourcesMedium severitygo-api/go-api
Definition on GitHub

Which app it breaks

go-api by default. Pass --app to break another app in your lab instead.

The hint ladder

Each hint narrows the search a little further. They are collapsed on purpose: open one only when you are properly stuck, because working out the next command yourself is the whole exercise.

Hint 1

Nothing is broken, it is slow, so look at time rather than errors. In Grafana, Application Request Metrics → Latency percentiles: compare p99 with p50. A healthy app that is slow for 1% of requests is waiting for something. Then rule out the obvious: kubectl get pods -n go-api (restarts?) and kubectl top nodes (a busy node?).

Hint 2

kubectl top pod -n go-api shows how much CPU each pod uses. Compare it with the container's CPU limit (kubectl describe pod -n go-api <pod> → Limits). A pod using exactly its limit is not idle and not overloaded: it is capped, and the number you see is the ceiling, not what it wants.

Hint 3

A CPU limit is enforced as a quota per 100ms period; a container that spends its quota early waits for the next period, and the requests it was serving wait with it. Pod Resources → CPU throttled shows the share of periods that ran out. The limit in the Deployment (kubectl get deploy go-api -n go-api -o yaml) is below what the app needs under this load. You cannot measure that while it is capped, so lift the limit first, then size it.

Further reading

Get updates

New scenarios and faults, release notes, and news about hosted labs if and when there is some. A few emails a month at most.

We'll email you about new releases, new lab content and paid offerings such as hosted labs, courses and workshops. Unsubscribe any time.