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.
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
| Quantity | Value |
|---|---|
| Seconds in a day | 86,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 |
| Power | Exact | Approx. | Name |
|---|---|---|---|
| 2¹⁰ | 1,024 | 10³ | KB |
| 2²⁰ | 1,048,576 | 10⁶ | MB |
| 2³⁰ | — | 10⁹ | GB |
| 2⁴⁰ | — | 10¹² | TB |
| 2⁵⁰ | — | 10¹⁵ | PB |
| Item | Typical size |
|---|---|
| A char / small int | 1–4 B |
| UUID / timestamp | 16 B / 8 B |
| A tweet-sized text record with metadata | ~1 KB |
| A JSON API response | 1–50 KB |
| A compressed photo | 200 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
- Start from users: daily active users (DAU), and actions per user per day.
- Average QPS = DAU × actions / 86,400 (≈ 10⁵).
- Peak QPS ≈ 2–10 × average (traffic isn't flat).
- Split reads vs writes using the read/write ratio.
- Storage = writes per day × object size × retention (× replication factor).
- Bandwidth = QPS × response size.
- 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.
| Quantity | Calculation | Result |
|---|---|---|
| Upload QPS | 10M × 0.2 / 10⁵ | ~20/s (peak ~100/s) |
| View QPS | 10M × 50 / 10⁵ | ~5,000/s (peak ~25,000/s) |
| Read/write ratio | 5000 / 20 | 250 : 1 → read-heavy: cache and CDN |
| New storage per day | 2M uploads × 600 KB | 1.2 TB/day |
| Per year (× 3 replicas) | 1.2 TB × 365 × 3 | ~1.3 PB/year → object storage, not a database |
| Egress bandwidth | 5,000/s × 300 KB (mix of thumbs and full images) | 1.5 GB/s ≈ 12 Gbit/s → a CDN is essential |
| Metadata DB | 2M rows/day × 1 KB | 2 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.
- 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.