What is capacity planning?
BeginnerConceptReliability, monitoring & incidents
Answer
In one line: Capacity planning is estimating how much infrastructure (compute, storage, database, network) you'll need in the future, so the system can handle expected growth and peaks without running out of resources or wasting money.
Why it matters:
- Too little capacity → slow responses or outages during peaks (sales, launches, exam results day).
- Too much capacity → paying for idle resources.
The process:
- Measure current usage — CPU, memory, disk, database connections, requests per second, queue lengths. Find the bottleneck resource for each service.
- Understand the drivers — what makes usage grow? Users, orders, data volume, a marketing campaign?
- Forecast — use historical trends plus business plans ("we expect 3× traffic during the Diwali sale").
- Load test — find out how much one instance can really handle (for example 400 requests/second per pod before p95 latency rises).
- Plan with headroom — keep a safety margin (for example run at around 60–70% utilisation at peak) and plan for losing an availability zone.
- Know your limits — cloud service quotas (vCPU limits, IP addresses in subnets), database max connections and licences. Request quota increases early.
- Review regularly — capacity plans go stale quickly.
Autoscaling helps but doesn't remove the need:
- Autoscaling has limits (max replicas, node quotas, subnet IPs).
- Databases and stateful systems often can't scale instantly.
- Scaling takes time — a sudden spike can beat it.
- For known big events, pre-scale (scheduled scaling) beforehand.
Example: before a big sale, a team load-tested checkout, found the database was the bottleneck at 2× normal traffic, upgraded the database instance and added read replicas a week before, set HPA max replicas higher and pre-warmed capacity on the day.
Tip for interviews: mention load testing, headroom, cloud quotas and the database as the usual bottleneck.
More on Reliability, monitoring & incidents
What are SLAs, SLOs and SLIs?BeginnerWhat is an error budget, and how is it used?IntermediateWhat are the four golden signals of monitoring?BeginnerWhat is the difference between metrics, logs and traces?BeginnerWhat makes a good alert? How do you avoid alert fatigue?BeginnerWhat is an incident, and what is incident management?Beginner