Capacity planning is making sure you have enough of every resource for the traffic you will get, with headroom for spikes, without paying for far more than you need. Autoscaling helps, but it does not remove the need: databases, connection limits, third-party quotas and budgets do not scale themselves.
Step 1: Find the limiting resource
Every service has one resource that runs out first. Common ones:
| Resource | How it runs out | Signal |
|---|---|---|
| CPU | Throttling, slower requests | CPU near limit, latency rising with load |
| Memory | OOM kills | Memory near limit, restarts |
| Database connections | Pool waits, refused connections | Pending connections, errors |
| Database CPU or IO | Slow queries for everyone | DB CPU high, IO wait |
| Worker or thread pools | Requests queue | Busy workers at max |
| Third-party rate limits | 429s from the provider | Error rate on that dependency |
| Disk | Writes fail | Disk above 85% and growing |
A load test that ramps until something breaks shows which one; see the load testing guide. The USE method is a checklist for finding it.
Step 2: Express capacity in business terms
"The API handles 1,200 requests per second at p95 under 500 ms with 12 pods and a db.r6g.xlarge" is useful. Even better: "each order needs about 40 API requests, so current capacity covers about 30 orders per second." Business-level units make it easy to plan for a campaign that marketing describes in orders, not requests.
Step 3: Model demand
- Trend: weekly peak traffic over the last 6 to 12 months, extended forward.
- Seasonality: daily and weekly patterns, holidays, sales periods.
- Events: launches, campaigns, onboarding a large customer.
- Margin for surprises: viral moments, retry storms, bots.
Step 4: Keep headroom
Plan to run at peak with headroom on the limiting resource, for example no more than 60 to 70% of capacity, so spikes and the time it takes to scale are covered. For resources that do not autoscale (the primary database), headroom matters more.
Step 5: Review on a schedule
Monthly or quarterly: compare actual peaks with the plan, check headroom on each resource, and decide what to change before it is urgent. Big events get their own review a few weeks ahead.
Worked example
An API peaks at 400 requests per second with 8 pods at 55% CPU, and a database at 45% CPU with 120 of 200 connections in use. Traffic grows about 8% a month. In six months the peak would be around 630 requests per second. Pods autoscale, but connections would reach about 190 of 200, and database CPU about 70%. The plan: add PgBouncer now (connections), fix the two most expensive queries found in traces (database CPU), and schedule a database instance upgrade review in four months.
Data you need
- Request rate and latency per service and endpoint, from traces.
- Resource usage against limits per pod or host.
- Database connections, CPU, IO and slow queries.
- Queue depth and age for background work.
- Third-party usage against their quotas.
VitalRix APM, infrastructure monitoring and dashboards cover these, and usage controls show your own telemetry volume per day so monitoring costs scale predictably too.
Common mistakes
- Planning on averages: plan for peaks.
- Ignoring non-scaling resources: the database, connection limits and quotas.
- Assuming autoscaling is instant: new pods and nodes take minutes.
- Never testing the plan: a load test at the planned peak is the only proof.
- Forgetting dependencies' capacity: your growth is also theirs.
A capacity review template
# Capacity review: <service>, <month>
Peak last month: 420 rps (p95 310 ms). Limiting resource: DB connections (165/200 at peak).
Forecast in 6 months: ~620 rps (+7%/month, plus Black Friday ×3 for one day).
Headroom target: limiting resource below 70% at forecast peak.
Actions: PgBouncer (owner A, by 15 Nov); index orders(customer_id, created_at) (owner B);
HPA max 30 → 40 after DB change; load test at 3× in October.
Signals that capacity is running out
p95 latency that rises with traffic while error rates stay flat, pool waits appearing at peak hours, autoscalers sitting at their maximum, queues that drain more slowly each week, and database CPU trending up month over month. Each is visible weeks before an outage if someone looks; put them on one capacity dashboard and review it monthly. See monitoring dashboard best practices and Kubernetes HPA autoscaling.
How much headroom should I keep?
Often enough that peak usage of the limiting resource stays below 60 to 70%, more for resources that cannot scale quickly.
Does autoscaling replace capacity planning?
No. It covers some resources, within limits, and takes time to react. Databases, quotas and budgets still need planning.
How often should we review capacity?
Monthly or quarterly, and ahead of known events such as launches and sales.
Try VitalRix free
Uptime monitoring, APM, logs, real user monitoring and status pages in one place. No credit card needed.