Skip to content
Tech Interview Prep
Technical interview guide

Capacity Planning & Load Testing

Knowing how much traffic a system can take before it does, through modeling and deliberate load testing.

Minutes to read
4
Practice MCQs
25
Interview Q&A
25
Edition
v5
Editorial status
Reviewed

Scope: Google SRE, Kubernetes, OpenTelemetry, Prometheus, k6, JMeter, PostgreSQL, and IETF guidance current 2026-08-31.

Overview

Curated: · Written: · Reviewed:

Capacity Planning & Load Testing

In one line

Capacity is the demand a system absorbs while still meeting its SLO, found by modelling the workload and testing up to the first saturating resource. Reach for it before a launch, before a traffic step change, or whenever someone claims a service "can handle" a number.

Key definitions

  • Throughput: completed work per unit time (RPS).
  • Concurrency: work in flight at an instant. Little's Law links it to rate and latency.
  • Saturation: the point where queueing makes latency climb sharply.
  • Headroom: the margin between current load and the first saturating resource.
  • Open vs closed-loop model: open offers a fixed arrival rate; closed holds a fixed set of users who wait for each response.
  • Coordinated omission: latency measured from when the generator actually sent a request, not from when it was due, which hides stalls.

Formulas and complexity

L=λWL = \lambda W

Concurrency equals throughput times mean latency. Use means in steady state. Feeding it p99 overstates concurrency.

R≈S1−ρR \approx \frac{S}{1-\rho}

M/M/1 mean response time, where S is service time and rho is utilization. At 50% that is 2S, at 80% it is 5S, at 90% it is 10S.

P(at least one of n calls≥t)=1−(1−p)nP(\text{at least one of } n \text{ calls} \ge t) = 1-(1-p)^n

For a fan-out of 20 shards, each with a 1% chance of exceeding 800 ms: 1 - 0.99^20 is about 18% of page loads.

replicas=⌈peak concurrencythreads per replica×0.7⌉\text{replicas} = \left\lceil \frac{\text{peak concurrency}}{\text{threads per replica} \times 0.7} \right\rceil

Worked example: 520 peak concurrency on 64-thread replicas at 70% gives 12.

How it works

  1. Name the journey and the workload unit, then forecast rate, concurrency, payload and dataset size, segmented by tenant, region and request class.
  2. Translate demand through the dependency graph into CPU, memory, pool connections, IOPS, quotas and queues.
  3. Ramp an open-model test in steps and record achieved rate and p99 at each step against the SLO.
  4. Find the first resource to saturate. Change one variable per run and confirm the bottleneck moved where you predicted.
  5. Size for peak concurrency plus the failure state, then set the alert threshold at the level that leaves time to scale out.
yes no Demand: journey, rate, mix, dataset Dependency graph: CPU, pools, IOPS, quotas Open-model ramp in steps SLO met at this step? First saturating resource Headroom and failure-state sizing Alert threshold with scale-out lead time

When to use and when not to

SituationTest or modelWhy
Known peakLoad test at peak, plus one-zone-lost runA fleet that meets the SLO only with every zone healthy has no resilience headroom
Sudden spikesSpike test against autoscaler warm-upReactive scaling fails when warm-up is longer than the spike
Leaks, queue drift, compactionSoak test for hoursA 30-minute run misses slow growth
Write-heavy or mixed workloadsProduction write mixRead-only synthetic load moves the bottleneck elsewhere
Cache-dependent pathsCold and warm runs, realistic key skewUniform keys over a small set flatter the cache
Production traffic availableMetrics, traces and sampled replayValidates or replaces synthetic tests; replay needs data controls

Traps interviewers probe

  1. Quoting a peak RPS with no latency objective. Fix: report the highest step where every SLO term holds. In the MCQ 1 ramp that is 25,000 rps (p99 240 ms, 0% errors), not 35,000 where p99 reached 620 ms.
  2. Trusting a closed-loop generator. Fix: use an open arrival-rate model, and check that offered rate stays on target. Slow responses reduce a closed-loop generator's load, so it understates overload.
  3. Coordinated omission. Fix: measure from intended send time. A 1 s stall in a generator sending every 10 ms leaves about 100 requests that look fast but were really delayed.
  4. Declaring a service certified after one passing run. Fix: add a zone-loss run, a soak run, and a check that the backlog drains after load falls.
  5. Blaming the service when the generator or a quota is the limit. Fix: monitor generator CPU, scheduling lag and socket counts, and check downstream quotas before concluding anything.

Interview tips

Open with the answer shape: "The workload is X. The objective is p99 at or below Y with error rate at or below Z. The first resource to saturate is W. Sustainable capacity is N with H headroom."

Follow-ups to expect:

  • How do you know the test was representative? Name the mix, key skew, payload sizes and auth, and say what differs from production.
  • What is your headroom, and why that number? Tie it to scale-out lead time and forecast error, not a habit.
  • What happens when an AZ fails? With peak 900 rps across three zones and one zone lost, two zones must carry 900, so each needs 450 rps, not 400.
  • How did you size the connection pool? Use Little's Law: rate times latency gives the connections needed.
  • Why did the autoscaler miss the spike? Warm-up of 180 s against a 90 s spike means scaling arrives after the spike ends.
  • Why did the retried writes duplicate? Retries without idempotency keys repeat side effects.
  • What changes at 10x traffic? Name the next saturating resource, usually a pool, a hot key or a quota.

30-second outline:

  1. Demand and objective: the workload unit, the peak rate, and the SLO terms.
  2. Measured limit: the highest passing step, the first saturating resource, and the evidence.
  3. Headroom and failure state: the margin, and capacity with one zone or one dependency lost.
  4. Trigger and recovery: the alert threshold, the scale-out lead time, and how fast the backlog drains after load falls.

Feedback on this overview

Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.