📐 Back-of-the-Envelope
Estimation cheat sheet
System Design Interview · Ch.2
System Design Interview · Ch.2
DAU daily active users — how many use it in a day
MAU monthly active users — the total user base
QPS queries per second — the request rate
peak the busiest second, ≈ 2–3× the average
RF replication factor — copies of each record stored
KB→PB data volumes, ×1000 at each step
Powers of two the ×1000 ladder
| Power | Value | Unit |
|---|---|---|
| 2¹⁰ | 1 Thousand | KB |
| 2²⁰ | 1 Million | MB |
| 2³⁰ | 1 Billion | GB |
| 2⁴⁰ | 1 Trillion | TB |
| 2⁵⁰ | 1 Quadrillion | PB |
Availability each nine ÷10 the downtime
| Uptime | Per day | Per year |
|---|---|---|
| 99% | 14.4 min | 3.65 days |
| 99.9% | 1.44 min | 8.77 hr |
| 99.99% | 8.64 s | 52.6 min |
| 99.999% | 864 ms | 5.26 min |
| 99.9999% | 86.4 ms | 31.6 s |
Latency numbers 2020 — memory fast · disk slow · distance is physics
| L1 cache reference | 1 ns |
| Main memory reference | 100 ns |
| Compress 1 KB (Zippy) | 2 µs |
| Read 1 MB seq · memory | 3 µs |
| SSD random read | 16 µs |
| Read 1 MB seq · SSD | 49 µs |
| Round trip · same datacenter | 500 µs |
| Read 1 MB seq · disk | 825 µs |
| Disk seek | 2 ms |
| Round trip · CA ⇄ Netherlands | 150 ms |
The equations
DAU= MAU × active%
avg QPS= (DAU × actions/day) ÷ 86,400
peak QPS= avg QPS × 2–3
storage= writes/day × size × 365 × yr × RF
bandwidth= QPS × payload size
cache= 20% × working set
servers= peak QPS ÷ per-box QPS
Shortcuts & traps
- Seconds/day = 86,400 ≈
10⁵for a first pass. 1M/day ≈ 10 QPS. Scale from there.- Peak is 2–3× avg, never equal to it.
- Storage forgets replication — RF 3 triples it.
- Label every unit. "5" is 5 KB or 5 MB?
- KB (10³) ≠ KiB (2¹⁰) — know the gap exists.
Worked example Twitter — the book's own
300M MAU × 50% = 150M DAU · ×2 tweets = 300M/day
QPS = 300M ÷ 86,400 = ~3,500 → peak ×2 = ~7,000
media = 150M × 2 × 10% × 1 MB = 30 TB/day → × 365 × 5 yr = ~55 PB
QPS = 300M ÷ 86,400 = ~3,500 → peak ×2 = ~7,000
media = 150M × 2 × 10% × 1 MB = 30 TB/day → × 365 × 5 yr = ~55 PB
Numbers: System Design Interview – An Insider's Guide, Ch.2 (Alex Xu)
github.com/mhayk/system-design