Skip to content
Rivar.

Your resource requests are a cost decision, not a guess

Requests set your bill and your reliability at the same time. A practical method for sizing them from real data instead of copying the last deployment.

Rivar Technologies3 min read
  • Kubernetes
  • FinOps
  • Reliability

Ask an engineer where a deployment's CPU request came from and the honest answer is usually that it was copied from another service, or that it is the number that stopped the pod getting OOMKilled that one time. Neither is wrong, exactly. Both are expensive.

Requests are what the scheduler reserves. Utilisation is what you use. The gap between them is capacity you are paying for and not getting. On clusters we assess for the first time, that gap is routinely 60 to 75% of provisioned CPU.

Requests and limits do different jobs

Worth restating, because conflating them causes most of the damage:

  • Requests are a scheduling guarantee. They decide which node a pod lands on and how much capacity the cluster must keep available. They set your bill.
  • Limits are an enforcement ceiling. Exceed a memory limit and the kernel kills the container. Exceed a CPU limit and the container is throttled, which shows up as latency nobody can explain.

The practical consequence is that they want different treatment. Memory should generally have request == limit — memory is incompressible, and a pod that exceeds its request during a spike dies. CPU should usually have a request and no limit: let a bursty workload use idle capacity rather than throttling it while the node sits half empty.

The common objection is that an unbounded pod could starve its neighbours. In practice the CPU shares mechanism already weights contention by request, so a pod with a small request gets a small share when the node is busy and free rein when it is not. That is the behaviour you want.

Sizing from data

The method is not sophisticated, which is the point:

# Memory request: the 99th percentile of working set over two weeks, plus 25%.
quantile_over_time(0.99,
  container_memory_working_set_bytes{container!="",pod=~"checkout-.*"}[14d]
) * 1.25

# CPU request: the 90th percentile of actual usage.
quantile_over_time(0.90,
  rate(container_cpu_usage_seconds_total{container!="",pod=~"checkout-.*"}[5m])[14d:5m]
)

Two weeks covers the weekly cycle. P99 on memory because the cost of being wrong is a kill; P90 on CPU because the cost of being wrong is a brief slowdown. Then check the result against a known peak event — a sale, a batch window, a marketing send — before you ship it. If your traffic has a seasonal peak outside the sample window, size for the peak and revisit after it passes.

Why this is not a one-time exercise

Workloads drift. A caching change, a dependency upgrade, a new feature — any of them move the profile, and the request stays where you left it. Two things keep it honest:

Vertical Pod Autoscaler in recommendation mode. Not enforcing, just reporting. It watches every workload continuously and its recommendation is a better default than anyone's memory. Feed the recommendations into a quarterly review rather than letting it mutate live workloads.

Consolidation-aware node autoscaling. Right-sized requests only save money if the cluster actually gives the capacity back. Karpenter with consolidation enabled repacks workloads onto fewer nodes as requests shrink. Without it you get better bin-packing on the same number of nodes and the bill does not move — which is how teams conclude that right-sizing "did not work".

What to expect

A first pass on a cluster that has never had one typically lands 30-50% off compute spend, most of it from a handful of over-provisioned services. The second pass is worth much less, which is the signal that it should become a quarterly review rather than a project.

One rule: never right-size and change the autoscaler in the same deploy. When utilisation moves unexpectedly, you want to know which change caused it.

Start here

Tell us what is on fire

Or what is merely smouldering. Describe the situation and we will tell you what we would do about it — including when the answer is that you do not need us.

  • A senior engineer reads it, not a sales team
  • A straight answer on whether we can help
  • No obligation, and no follow-up sequence

Prefer email?

hello@rivar.ca

Optional

The more specific, the more useful our first reply will be.

We reply within one business day. No newsletter, no sales sequence.