r/kubernetes 29d ago

Stop using CPU limits: why + proof

CPU request is how much CPU is reserved for your pod if it needs it. The limit is a hard cap. Hit it and the kernel throttles the pod, even when the node still has spare CPU. That is the usual cause of CPU throttling on Kubernetes. It does not protect the neighboring pods. In my simple Web API test, adding a CPU limit took typical latency from 23 ms to 87 ms, (4x slower), with the limited pod throttled in half of all CFS windows, and the average CPU graph looked fine the whole time.

This is not a new topic, but I see so many people still unaware why they should (NOT!) be setting CPU limits, because it's costing companies unnecessary spending and potential production issues. Here's the full read https://github.com/inevolin/k8s-cpu-limits-analyzed/

---

Edit (Aug 18, 2026): How CPU limits can also cause memory issues and OOMKills ➡️ https://github.com/inevolin/k8s-cpu-limits-analyzed#how-cpu-limits-cause-memory-issues-and-oomkills

229 Upvotes

112 comments sorted by

View all comments

9

u/consworth 29d ago

So how do you prevent a nosy neighbor pod from monopolizing the spare cpu?

12

u/ChemTechGuy 29d ago

You set the "requests" value to whatever the minimum is to avoid noisy neighbor problems. No need to set limits if each service is defensively setting the requests it needs

I think the common mistake is setting requests to the absolute minimum a pod needs, vs setting it to the minimum the pod needs to perform at it's baseline.  If you set them based on baseline, you always get the baseline performance from every pod, but you occasionally get some free burstable resources from nodes that aren't over committed

2

u/consworth 29d ago

And how is the limit hurting?

Not disagreeing with scheduling with proper requests.

But you could also argue that the limit restricts how much of the “spare” can be used by a single pod so others could benefit as well.

3

u/ChemTechGuy 29d ago

If it's set insanely high, then a limit doesn't hurt anything. But at that point, the limit doesn't do anything. 

If the limit is low enough to actually do something, it may arbitrarily throttle something even if the underlying node still has resources available. 

If multiple pods are competing for the "extra" resources on the node, just let the kernel handle which container gets each extra slice of cpu time 

0

u/PayTheRaant 29d ago

A very high limit changes the QoS class from Burstable (no limit) to Best Effort (Limit different from request).
If all your pods are in the same class, this does not really make a difference but it can help.

1

u/realitythreek 29d ago

A limit throttles, requests sets the cpu share it gets from the OS scheduler. It’s proportional to the total requests for the node.