Capacity estimation answers one fundamental question:
SYSTEM DESIGN
|
v
+----------------------+
| How much traffic? |
| How much data? |
| How much bandwidth? |
| How many servers? |
+----------+-----------+
|
v
CAPACITY ESTIMATION
It is essentially back-of-the-envelope calculation. Exact numbers are less important than reasonable assumptions, correct order of magnitude, and understanding the architectural consequences.
CAPACITY ESTIMATION
|
+--------------+--------------+
| | |
v v v
SLO DEMAND INSTANCE
Requirement Traffic Capacity
| | |
"How fast?" "How much?" "How fast
is 1 server?"
Example: P90 latency ≤ 100 ms.
90% of requests
|
v
must finish within
|
v
100 ms
Example: 2,000,000 requests/day.
Performance testing tells us how much work one instance can process while meeting the SLO.
1 server | +---- Request 1 --> 35 ms +---- Request 2 --> 35 ms +---- Request 3 --> 35 ms
Suppose:
+----------------+
| SERVER 1 |
+----------------+
| | |
v v v
Req1 Req2 Req3
| | |
35ms 35ms 35ms
≈ 3 requests
Think of this number as the approximate amount of work an instance can carry while still satisfying the latency objective.
CAPACITY
|
v
Acceptable Backlog / Instance
|
v
"How much CAN
one server handle?"
DEMAND
|
v
Backlog / Instance
|
v
"How much LOAD
is each server getting?"
Demand
|
v
+----------------+
| 24 RPS |
+-------+--------+
|
v
Desired capacity
per instance
|
v
~3 RPS
|
v
+---------------+
| 24 / 3 = 8 |
+---------------+
|
v
8 SERVERS
| Input | Value |
|---|---|
| Demand | 24 RPS |
| Acceptable capacity / instance | 3 RPS |
| Required instances | 24 ÷ 3 = 8 |
Normal traffic:
Traffic = 24 RPS
Servers = 8
Load/server = 24 / 8 = 3
Target = 3
Actual = Target
|
v
HEALTHY
Now traffic jumps to 96 RPS:
96 RPS
|
v
+---------------+
| 8 servers |
+---------------+
|
v
96 / 8 = 12
Acceptable = 3
Actual = 12
12 > 3
|
v
SCALE OUT
Required capacity:
TRAFFIC
|
v
+-------------+
| LOAD |
+------+------+
|
v
Demand / Instances
|
v
+-------------------+
| Load / Instance |
+---------+---------+
|
v
Compare with
target = 3
|
+---------+---------+
| |
v v
> 3 < 3
| |
v v
SCALE OUT SCALE IN
| |
v v
Add instances Remove instances
| |
+---------+---------+
|
v
Recalculate
Suppose traffic falls back to 24 RPS but we still have 32 servers:
Actual load = 0.75 Target = 3 0.75 < 3 | v SCALE IN | v Eventually: 24 RPS / 8 servers = 3 RPS/server | v HEALTHY
TRAFFIC
|
v
+---------------+
| Load Balancer |
+-------+-------+
|
+-------+-------+
| | |
v v v
EC2 EC2 EC2
... ... ...
|
v
Measure traffic
|
v
Demand / Instances
|
v
Load per Instance
|
v
+-----------+
| Compare |
| with 3 |
+-----+-----+
|
+-------+-------+
| |
> 3 < 3
| |
v v
SCALE OUT SCALE IN
| |
v v
Add servers Remove servers
CAPACITY ESTIMATION
|
+---------+-------+--------+---------+
| | | |
v v v v
Traffic Storage Bandwidth Memory
| | | |
v v v v
RPS GB/TB Mbps GB
Business requirement
↓
Traffic assumptions
↓
Average RPS
↓
Peak RPS
↓
Per-server benchmark
↓
SLO / latency constraint
↓
Required capacity
↓
Number of servers
↓
Autoscaling strategy
┌─────────────────────┐
│ 1. USERS │
│ DAU / MAU │
└──────────┬──────────┘
↓
┌─────────────────────┐
│ 2. REQUESTS │
│ requests/user/day │
└──────────┬──────────┘
↓
┌─────────────────────┐
│ 3. TRAFFIC │
│ Avg RPS → Peak RPS │
└──────────┬──────────┘
↓
┌─────────────────────┐
│ 4. DATA │
│ storage + bandwidth │
└──────────┬──────────┘
↓
┌─────────────────────┐
│ 5. COMPUTE │
│ capacity/server │
└──────────┬──────────┘
↓
┌─────────────────────┐
│ 6. INFRASTRUCTURE │
│ servers/DB/cache │
└──────────┬──────────┘
↓
┌─────────────────────┐
│ 7. SCALE │
│ horizontal + auto │
└─────────────────────┘
| Calculation | Formula |
|---|---|
| Average RPS | Requests/day ÷ 86,400 |
| Peak RPS | Average RPS × Peak Factor |
| Acceptable load / instance | SLO ÷ Processing Time |
| Actual load / instance | Demand ÷ Current Instances |
| Required instances | Peak Demand ÷ Acceptable Load / Instance |
| Storage | Records × Record Size × Retention Period |
| Bandwidth | RPS × Average Payload Size |
Given:
Step 1 — Average RPS
Step 2 — Acceptable load / instance
Step 3 — Required instances
Step 4 — Peak traffic at 4×
Step 5 — Peak instances
Architectural conclusion: design for horizontal scaling from approximately 8 instances at normal load to approximately 32 instances at the assumed peak, with autoscaling driven by load per instance and protected by sensible scale-out/scale-in policies.
DEMAND
|
v
How much traffic?
|
v
PEAK RPS
|
v
How much can ONE server
handle?
|
v
SERVER CAPACITY
|
v
+-----------------------+
| Required Servers |
| |
| Peak RPS |
| ----------- |
| Server Capacity |
+-----------+-----------+
|
v
ARCHITECTURE
|
+---------+---------+
| | |
v v v
Cache DB Servers
| | |
+---------+---------+
|
v
AUTOSCALING