System Design

Estimate before you draw

Users → requests per second → storage → bandwidth → servers. Round hard: the goal is the right order of magnitude, said out loud, in under two minutes.

Calculator

Change any input; every number on the right shows the arithmetic behind it.

Traffic
Data
Capacity
  1. Requests per day1.0M users × 2020M
  2. Average QPS20M ÷ 86,400 s231 /s
  3. Peak QPS231 × 3 (peak factor)694 /s
  4. Peak read QPS694 × 10/11631 /s
  5. Peak write QPS694 × 1/1163.1 /s
  6. New storage per day1.8M writes × 2.00 KB3.47 GB
  7. Storage per year3.47 GB × 3651.24 TB
  8. Total over 5 yr, ×3 copies1.24 TB × 5 × 318.5 TB
  9. Peak ingress63.1 writes/s × 2.00 KB126 KB/s
  10. Peak egress631 reads/s × 10.0 KB6.17 MB/s
  11. App servers (N+1)⌈694 ÷ 400/server⌉ + 13
  12. Cache for the hot set18M reads × 10.0 KB × 20%34.7 GB

Practice

A random system and scale. Answer first, then check — the point is getting fast at the arithmetic.

Latency numbers

L1 cache reference~1 ns
Main memory reference~100 ns
Read 1 MB sequentially from memory~10 µs
SSD random read~100 µs
Round trip inside a datacenter~0.5 ms
Redis GET in the same AZ≲ 1 ms
Indexed database read~1–10 ms
HDD seek~10 ms
Object storage first bytetens of ms
Round trip across a continent~40–80 ms
Round trip between continents~100–250 ms

Orders of magnitude — real values vary with hardware and region.

Rules of thumb

1 day ≈ 86,400 s ≈ 10⁵ s
Round to 10⁵ for mental math.
1M requests/day ≈ 12 req/s
100M/day ≈ 1,200 req/s average.
Peak ≈ 2–5× average
Consumer apps are spikier than B2B.
1 KB × 1M = 1 GB
1 MB × 1M = 1 TB; 1 KB × 1B = 1 TB.
2¹⁰ ≈ 10³
KB ≈ thousand, MB ≈ million, GB ≈ billion, TB ≈ trillion bytes.
80/20 for caching
~20% of keys get ~80% of reads — size the cache for the hot set.
Series multiplies, parallel adds nines
99.9% × 99.9% ≈ 99.8%; two 99.9% replicas ≈ 99.9999%.
Run at ≤ 50% per AZ with 2 AZs
So one AZ can carry everything (N+1).

Where estimates fit

  1. 1 · RequirementsFunctional (what it does) and non-functional (scale, latency, availability, consistency). Ask; don’t assume.
  2. 2 · EstimatesUsers → QPS (average and peak), read/write ratio, storage per year, bandwidth.
  3. 3 · API + data modelThe main endpoints and the entities they touch.
  4. 4 · High-level designBoxes and arrows for the main flows. Start simple.
  5. 5 · Deep divesThe hardest parts: hot paths, consistency, the data store, failure handling.
  6. 6 · Bottlenecks & trade-offsWhat breaks first at 10×, what you’d monitor, what you traded away.