ayushsalampuriya.xyz Revise

System Design · Core

Back-of-Envelope Estimation

Quick math for RPS, storage, and bandwidth so design choices are grounded.

1. Why estimate

Numbers decide whether you need cache, shards, or a CDN — not vibes.

2. Typical questions

3. Worked example — URL shortener

Assumptions: 100M new URLs / month Write QPS ≈ 100e6 / (30*24*3600) ≈ 40 writes/s Peak ≈ 2–5× average → ~200 writes/s Reads 100× writes → ~20k reads/s Storage: 100M × 500 bytes ≈ 50 GB / month 5 years ≈ 3 TB (+ indexes/replicas)

4. Latency reference (memorize order of magnitude)

Operation~Latency
L1 / L2 cache1–4 ns
RAM~100 ns
SSD read~100 µs
Same-DC RTT~0.5 ms
HDD seek~10 ms
Cross-country RTT~150 ms

5. Throughput ballparks

Rule of thumb in interview: say assumptions out loud round aggressively (powers of 10) show peak = k × average

Quick revision

  • Always state assumptions before multiplying.
  • Derive: writes/s, reads/s, GB/month, peak multiplier.
  • Latency ladder: RAM << SSD << disk << WAN.
  • Use numbers to justify cache / shard / CDN.