Back-of-the-Envelope Estimation

Quick capacity estimates for QPS, storage, bandwidth, memory and servers — useful powers of two, worked examples, and the rounding tricks interviewers expect.

Beginner 3 min readLesson 4 of 20

Before choosing an architecture you need to know the order of magnitude: 100 requests per second or 100,000? 10 GB or 10 PB? Back-of-the-envelope estimates take two minutes and decide whether one database is enough or you need sharding, caching or a CDN. Precision doesn't matter; the right power of ten does.

Numbers to memorise

QuantityValue
Seconds in a day86,400 ≈ 10⁵
Seconds in a month≈ 2.5 × 10⁶
Seconds in a year≈ 3 × 10⁷
1 million requests per day≈ 12 requests/s
1 billion per day≈ 12,000/s
PowerExactApprox.Name
2¹⁰1,02410³KB
2²⁰1,048,57610⁶MB
2³⁰—10⁹GB
2⁴⁰—10¹²TB
2⁵⁰—10¹⁵PB
ItemTypical size
A char / small int1–4 B
UUID / timestamp16 B / 8 B
A tweet-sized text record with metadata~1 KB
A JSON API response1–50 KB
A compressed photo200 KB – 2 MB
A minute of HD video~50–100 MB

Rough single-machine capacities: a web server handles 1k–10k+ simple requests/s; a well-tuned PostgreSQL primary handles 10k+ simple queries/s; Redis does 100k+ ops/s; a server has 64–512 GB RAM, and a NIC moves 10–25 Gbit/s.

The method

  1. Start from users: daily active users (DAU), and actions per user per day.
  2. Average QPS = DAU × actions / 86,400 (≈ 10⁵).
  3. Peak QPS ≈ 2–10 × average (traffic isn't flat).
  4. Split reads vs writes using the read/write ratio.
  5. Storage = writes per day × object size × retention (× replication factor).
  6. Bandwidth = QPS × response size.
  7. Cache memory: cache the hot ~20% of daily reads (the 80/20 rule).

Worked example: a photo-sharing app

Assumptions: 10M DAU; each user views 50 photos and uploads 0.2 photos per day; average photo 500 KB, plus 3 resized thumbnails totalling 100 KB; keep forever; replication × 3.

QuantityCalculationResult
Upload QPS10M × 0.2 / 10⁵~20/s (peak ~100/s)
View QPS10M × 50 / 10⁵~5,000/s (peak ~25,000/s)
Read/write ratio5000 / 20250 : 1 → read-heavy: cache and CDN
New storage per day2M uploads × 600 KB1.2 TB/day
Per year (× 3 replicas)1.2 TB × 365 × 3~1.3 PB/year → object storage, not a database
Egress bandwidth5,000/s × 300 KB (mix of thumbs and full images)1.5 GB/s ≈ 12 Gbit/s → a CDN is essential
Metadata DB2M rows/day × 1 KB2 GB/day, ~730 GB/year → fits one big DB with replicas for a while

Conclusions that fall straight out of the numbers: images belong in object storage behind a CDN; the metadata database is modest; reads dominate, so cache aggressively.

Worked example: how many servers?

Peak 25,000 requests/s; each app server handles ~2,000 requests/s at 60% CPU → 25,000 / 2,000 ≈ 13 servers, plus N+2 redundancy and room for a lost availability zone → ~20.

Tips

  • Round aggressively: 86,400 → 100,000; 365 → 400 if it helps. State that you're rounding.
  • Write assumptions down and sanity-check results ("12 Gbit/s egress — that's big; definitely a CDN").
  • Separate average and peak, and reads and writes.
  • Remember replication and overhead (indexes, metadata): multiply raw storage by 2–3×.
  • Ask the interviewer for numbers when unsure; they often have something in mind.
Key takeaways
  • 1 day ≈ 10⁵ seconds; 1M requests/day ≈ 12 requests/s.
  • QPS = DAU × actions / 10⁵; peak = 2–10 × average.
  • Storage = writes/day × size × retention × replication.
  • The numbers decide the architecture: read/write ratio, database vs object storage, CDN, sharding.
  • Round, state assumptions, sanity-check.