LOAD-BEARINGfree
High-level designTier 9 · unit 7 of 10 · 13 min read

Capacity planning and headroom

Tier 0 taught back-of-the-envelope estimation for a design conversation. This is the production version of the same skill, and the question has changed: not "roughly how big does this need to be", but how much room is left, and when does it run out?

Headroom is the number worth managing

Utilisation is a comforting metric and a misleading one. A service at 50% CPU is not half full. Queueing behaviour is unkind here: latency begins climbing well before a resource is saturated, because the closer you run to the limit, the longer any queue takes to drain after even a small burst. Running at a nicely efficient 90% means every ordinary spike becomes a latency incident.

So the number to track is headroom — how much more than your current peak you can absorb before the SLO breaks. Not before the system falls over; before the promise you made in the error budget lesson stops holding. Those are different thresholds and the first one arrives much sooner.

Find the binding constraint

Something is always the ceiling first, and it is usually not CPU. Roughly in order of how often they surprise people:

  • Connection pool slots — small, fixed, and exhausted long before the database itself is busy.
  • Database write throughput, or one hot partition inside an otherwise idle cluster.
  • Memory, which fails as a cliff rather than a slope.
  • A third-party quota you do not control and cannot scale by spending money quickly.
  • Anything with a single writer — the component that sharding was supposed to have removed.

Knowing which one binds is most of capacity planning, because adding capacity anywhere else buys you precisely nothing.

Plan against events, not averages

Steady growth rarely breaks you; events do. A sale, a campaign, a regulatory deadline, a competitor's outage sending their users to you. The useful exercise is to name the next three plausible events, estimate the multiple each applies to peak, check headroom against the largest, and then confirm that the thing which would actually run out can be scaled within the notice you would get.

Autoscaling helps here and does not solve it. It reacts on a timescale of minutes and it needs something to scale into — a hot database shard, a licence limit or a fixed pool is entirely unmoved by your request for more application servers.

The trap

Assuming scaling is linear. Doubling the servers rarely doubles throughput, because the shared thing behind them — the database, the lock, the queue — did not double. Past a point more instances make things actively worse: more connections, more contention, more retries aimed at the component that was already the constraint. Measure the curve instead of extrapolating the line.

Two questions asked once a quarter cover most of this: what breaks first, and how long would it take to add more of it? If you cannot answer both, you do not have a capacity plan — you have a dashboard.