Capacity Planning and Load Testing

Capacity planning explained: forecasting demand, headroom and utilisation targets, load testing methods, finding the bottleneck and planning for peaks.

Intermediate 3 min read · Updated

Capacity planning makes sure a system has enough resources (servers, database throughput, network, storage, third-party quotas) to meet demand with acceptable performance, at a reasonable cost, and before the demand arrives. It combines forecasting how load will grow, measuring how much load each component can actually handle through load testing, and keeping headroom for spikes and failures.

real trafficre-forecastForecast demandgrowth, eventsLoad testper-node limitFind the bottleneckCPU, DB, networkProvisionwith headroomMonitorutilisation, SLOs
Capacity planning is a loop: forecast demand, measure what one unit of capacity handles, find the bottleneck, provision with headroom, then watch real traffic and re-forecast.

The capacity planning loop

  1. Measure current demand in the units that drive cost: requests per second per endpoint, messages per second, storage growth per day, concurrent connections.
  2. Forecast growth from trends and known events: organic growth, launches, marketing campaigns, seasonal peaks such as festival sales.
  3. Find each component's limit with load tests, and identify the bottleneck that saturates first.
  4. Plan headroom: target utilisation that leaves room for spikes and for losing a zone.
  5. Provision and verify, then repeat on a schedule, because both demand and the system change.

Headroom and utilisation targets

Running at 100% utilisation means no room for spikes, and latency rises sharply well before that because queues grow as utilisation approaches its limit. Typical targets are 50-70% at expected peak for latency-sensitive services. Also plan for N+1 or N+2 redundancy: if traffic is spread across three zones and one fails, the other two must absorb its share.

ScenarioRule of thumb
Normal peakStay below the utilisation where latency starts climbing (often 60-70% CPU)
Zone failureWith 3 zones, each zone's normal peak share must fit in the remaining 2 (run at ≤ 66% of zone capacity)
Known event (sale, launch)Forecast the multiple over normal peak and pre-scale; don't rely on autoscaling reacting in time
StorageAlert well before full; plan expansion time (resharding a database can take weeks)

Load testing

TestPurpose
Load testRun expected peak traffic and confirm latency and errors meet targets
Stress testIncrease load until something breaks, to find the true limit and how it fails
Soak testHold a high load for hours to find leaks, slow degradation and full disks
Spike testJump traffic suddenly, to test autoscaling, caches and connection pools
  • Model real traffic: the same mix of endpoints, payload sizes, cache hit rates and user behaviour as production. A test that only hits a cached endpoint proves nothing.
  • Test in a production-like environment, or carefully in production with synthetic traffic, since staging rarely has the same data size or dependencies.
  • Watch the whole path: database connections, thread pools, queues and downstream services often saturate before CPU does. See connection pooling.
  • Measure latency percentiles, not averages. See latency vs throughput.

Finding the bottleneck

Every system has one resource that saturates first, and adding capacity anywhere else does nothing. Use the USE method (utilisation, saturation, errors) per resource and look for the first one to hit its limit: CPU, memory, disk I/O, network, database connections, lock contention, a single-threaded component, or a third-party rate limit. Fix or scale that one, then test again, because the bottleneck moves.

Back-of-the-envelope maths gets you a first estimate before any test. See capacity estimation.

Planning for spiky and unpredictable demand

  • Autoscaling handles gradual changes but lags by minutes; pre-warm before known events. See autoscaling.
  • Queues absorb bursts for work that can be asynchronous. See message queues.
  • Load shedding and rate limits protect the system when demand exceeds any plan. See load shedding.
  • Quotas and limits with cloud providers and third parties must be raised ahead of time.

Where it’s used

E-commerce sales events

Forecast a 10x peak, load-test the checkout path, pre-scale and raise payment-provider limits weeks ahead.

Database growth

Track storage and write growth to schedule resharding or larger instances before limits are hit.

Streaming platforms

Plan CDN and origin capacity for live events with predictable, huge spikes.

In an interview

  • Measure demand in cost-driving units and forecast with known events.
  • Keep headroom for spikes and a zone failure.
  • Load test with realistic traffic and find the first bottleneck.
  • Pre-scale for known peaks instead of relying on autoscaling.

Further reading