Skip to content
Preptima
mediumConceptScenarioMidSeniorStaff

What happens when a container hits its CPU limit, and what happens when it hits its memory limit?

Container CPU and memory limits fail differently: CPU limits throttle work, while memory limits can trigger OOMKilled restarts. Debug by comparing requests, limits, actual usage and runtime-specific memory settings. Use this containers answer to show the decision, trade-off, and evidence rather than a memorised definition. It also connects cgroups to the point an interviewer is testing.

5 min readUpdated 2026-08-15

Answer

Short answer

A container over CPU limit is throttled; a container over memory limit can be killed. Set requests from steady usage, limits from failure tolerance, and leave headroom for JVM, Node or native memory outside the heap.

Was this answer helpful?

Likely follow-ups

  • Throttling is high but average CPU usage is 30% of the limit. How is that possible and what would you change?
  • A container is OOM-killed and the process that died was not the one doing the allocating. Why can that happen?
  • Why is setting a CPU limit equal to the request sometimes worse for latency than setting no limit at all?
  • How would you size a memory limit for a JVM service, and what has to be true of the heap setting?

Related questions

Masterclass guide

Further reading

Related Topics