CPU requests make sense for scheduling, but limits can cause throttling even when a node has spare capacity. When would you leave the limit out, and when is it worth keeping one?
Do you set CPU limits, or just requests?
Answers
For CPU, requests without limits are a reasonable starting point. The scheduler uses requests when placing pods, and under contention they also influence relative CPU shares. With no limit, a container can use spare CPU rather than being capped at its limit.
That only works well if requests reflect what workloads actually need. Watch node utilization and test under contention, especially for services with tight latency targets. A request is not a guarantee that a burst will have unlimited CPU available.
Reply to this answer
A generous CPU limit can be a useful middle ground. It gives a workload room to burst while still putting a ceiling on it. Some programs size their thread pools based on available CPUs, so on a large node an uncapped workload can create a lot of threads.
Pick the cap with the workload and node size in mind, then monitor throttling. A limit set too close to normal burst usage can still hurt performance even when the node has idle CPU.
Reply to this answer
Don't assume memory and CPU limits do the same job. CPU can be throttled, while exceeding a memory limit can lead to a container being killed. Setting memory requests equal to limits is one option, but leave enough room for things like startup spikes and measure the workload rather than copying a default blindly.
2t~Ravlino.84:
That distinction matters for bursty applications. A memory limit that looks fine at steady state may be too small during startup.
Reply to this answer
Check the chart defaults before deciding you have a policy. A CPU limit may be coming from a deployment template rather than a deliberate choice. Compare throttling and latency with and without it under realistic load, then decide whether the cap is worth it for that workload.
Reply to this answer
Add your answer
Answers are reviewed before publication.
_w39!mivlano.5:
So the tradeoff is avoiding a fixed cap, but making sure there's enough capacity when several workloads get busy at once?
v.5+Nerquavo_7:
Exactly. For critical services, capacity planning around peak load matters more than just seeing low average CPU usage.