03. Back-of-the-Envelope Estimates
Learning goals
By the end of this lesson you will be able to:
- Roughly estimate QPS, storage, and bandwidth
- Use simple powers of 10 without a calculator panic
- Spot which part of a system will hurt first (reads, writes, or disk)
- Use numbers to justify cache, CDN, queues, or sharding
Why this lesson exists (in plain English)
Imagine someone says: βDesign Instagram.β
Without numbers, you might draw 20 fancy boxes. With numbers, you might discover:
- Writes are few β one database is fine
- Reads are huge β you need cache
- Photos are huge β you need S3 + CDN, not Postgres BLOBs
Back-of-the-envelope estimates = rough math on a napkin (or whiteboard) to find the real bottlenecks.
Interview tip: interviewers care more about clear assumptions + order of magnitude than exact answers. Saying βabout 3,000 QPSβ is better than silence.
A simple way to think about it
Ask only three questions:
| Question | What you calculate | Why it matters |
|---|---|---|
| How busy is the API? | QPS (requests/sec) | Do we need more servers / cache? |
| How much data do we keep? | Storage (GB/TB) | Disk size, DB choice, backups |
| How much data moves on the wire? | Bandwidth (MB/s) | CDN, NICs, cost |
Everything else is a variation of these three.
Cheat sheet β numbers to memorize
You do not need precision. Round freely.
Time
| Thing | Approximate value | Easy memory trick |
|---|---|---|
| Seconds in a day | 86,400 β 10β΅ | βabout 100,000β |
| Seconds in a month | β 2.5 million | 30 Γ 86,400 |
| Seconds in a year | β 31 million β 3Γ10β· | β |
Size
| Unit | Approx bytes | Everyday feel |
|---|---|---|
| 1 KB | 10Β³ | a short paragraph / small JSON |
| 1 MB | 10βΆ | a photo thumbnail / short song clip |
| 1 GB | 10βΉ | a movie compressed a bit / big DB table |
| 1 TB | 10ΒΉΒ² | a large disk / serious data lake slice |
| 1 PB | 10ΒΉβ΅ | βcompany-scaleβ storage |
Traffic shortcuts
1 QPS β 86,000 requests/day β 2.5 million / month
10 QPS β 860,000 / day
100 QPS β 8.6 million / day
1,000 QPS β 86 million / day
Latency intuition (bonus)
| Store | Typical latency |
|---|---|
| Memory / Redis | ~0.1β1 ms |
| SSD disk read | ~0.1β1 ms (local) to a few ms |
| Network inside DC | ~0.5β2 ms |
| Cross-region | tensβhundreds of ms |
You rarely compute latency in estimates, but it explains why cache helps.
Step 1 β Estimating QPS (how busy?)
QPS = Queries Per Second = how many requests hit your servers each second.
Formula
Average QPS β (DAU Γ actions per user per day) / 86,400
Peak QPS β Average QPS Γ peak factor
Peak factor is usually 2Γ to 5Γ (lunch, evenings, launches, cricket final).
Worked example A β Twitter-like home feed
Assumptions (say them out loud in an interview):
- 200 million daily active users (DAU)
- Each user opens the app 5 times/day and loads the feed once per open
Feed requests / day = 200M Γ 5 = 1 billion
Avg QPS = 1,000,000,000 / 86,400 β 11,600 QPS
Peak (3Γ) β 35,000 QPS
What this tells you: feed reads are a big deal β cache timelines, CDN for media, many read replicas.
Worked example B β URL shortener redirects
Assumptions:
- 100 million redirects/day
- Creates are only 1 million/day
Redirect avg QPS = 100M / 86,400 β 1,160 QPS
Create avg QPS = 1M / 86,400 β 12 QPS
Peak redirects (4Γ) β 4,600 QPS
What this tells you: system is read-heavy (~100:1). Optimize redirect path with Redis. Donβt over-engineer the create path.
Worked example C β small startup chat app
Assumptions:
- 50,000 DAU
- Each sends 20 messages/day
- Each also fetches inbox 10 times/day
Message sends / day = 50k Γ 20 = 1M β write QPS β 12
Inbox loads / day = 50k Γ 10 = 500k β read QPS β 6
Peak writes (5Γ during evening) β 60 QPS
What this tells you: one solid backend + Postgres is plenty for MVP. WebSockets matter more than sharding.
Quick QPS practice table
Try filling the last column yourself, then check:
| Product vibe | DAU | Actions/user/day | Avg QPS (approx) |
|---|---|---|---|
| Local cafe app | 2,000 | 3 | 2,000Γ3/86k β 0.07 β basically idle |
| College portal | 20,000 | 10 | β 2 QPS |
| Mid-size SaaS | 500,000 | 20 | β 115 QPS |
| Big social | 100M | 10 | β 11,600 QPS |
Step 2 β Estimating storage (how much disk?)
Formula
Storage β number of new records Γ size per record Γ how long you keep them
Donβt forget: indexes, replicas, and backups often 2Γβ3Γ the βrawβ size.
How big is one record? (useful guesses)
| Data | Rough size |
|---|---|
| User profile row | 1β2 KB |
| Tweet / chat message text | 0.5β1 KB |
| URL mapping row | 0.5 KB |
| JSON event (analytics) | 0.5β2 KB |
| Compressed photo | 100 KBβ2 MB |
| HD photo | 2β5 MB |
| Short video (1 min) | 5β50 MB |
| HD movie | 1β5 GB |
Worked example D β WhatsApp-like text messages
Assumptions:
- 1 billion messages/day
- Average message 100 bytes text + 400 bytes metadata β 500 bytes
- Keep 2 years of history
Per day = 1B Γ 500 B = 500 GB/day
Per year = 500 GB Γ 365 β 180 TB/year
2 years β 360 TB raw
With replicas/indexes (~3Γ) β 1 PB order of magnitude
What this tells you: messaging storage is serious β shard by conversation/user, cold storage for old messages, maybe separate media store.
Worked example E β Instagram-like photos
Assumptions:
- 100 million DAU
- 10% upload 1 photo/day β 10M photos/day
- Average photo stored (after compression + variants) β 500 KB effective new bytes
- Keep forever (5 years for estimate)
Per day = 10M Γ 500 KB = 5 TB/day
Per year β 5 TB Γ 365 β 1.8 PB/year
5 years β 9 PB (before redundancy)
What this tells you: never put photos in MySQL. Use object storage (S3) + CDN. DB only stores metadata (photo_id, s3_key, user_id).
Worked example F β URL shortener storage (small!)
Assumptions:
- 100M new links/month
- 500 bytes/row
- Keep 5 years
Per month = 100M Γ 500 B = 50 GB
Per year = 600 GB
5 years = 3 TB raw β ~6 TB with indexes
What this tells you: storage is easy; redirect QPS + cache is the real topic.
Step 3 β Estimating bandwidth (how fat is the pipe?)
Formula
Bandwidth β QPS Γ average response size
(Also estimate upload bandwidth separately if users send big files.)
Worked example G β feed API (JSON only)
Assumptions:
- Peak feed QPS = 35,000
- Each response β 50 KB JSON
35,000 Γ 50 KB = 1,750,000 KB/s β 1.75 GB/s β ~14 Gbps
What this tells you: many app servers + maybe response caching. Still lighter than shipping images through your API.
Worked example H β serving images without CDN (bad idea)
Assumptions:
- 10,000 image views/sec at peak
- Average image 200 KB
10,000 Γ 200 KB = 2,000,000 KB/s β 2 GB/s β ~16 Gbps from origin
What this tells you: put a CDN in front. Origin should mostly see cache misses.
Upload bandwidth example β video
Assumptions:
- 100,000 users upload a 50 MB video each day
Daily ingest = 100k Γ 50 MB = 5 TB/day
Avg upload rate = 5 TB / 86,400 β 58 MB/s β ~0.5 Gbps average
Peaks can be many times higher β need direct-to-S3 uploads
Putting it together β full mini case studies
Case 1: Pastebin
| Assumption | Value |
|---|---|
| Creates | 5M / day |
| Reads | 50M / day |
| Avg paste size | 10 KB |
| Retention | 1 year |
Write QPS β 5M/86400 β 58
Read QPS β 50M/86400 β 580
Peak reads (4Γ) β 2,300
Storage/year β 5M Γ 365 Γ 10 KB β 18 TB
Design implication
| Finding | Decision |
|---|---|
| Writes low | Simple API + DB fine |
| Reads higher | Cache hot pastes |
| Storage large | Body in S3, metadata in DB |
Case 2: Ticket booking (flash sale)
| Assumption | Value |
|---|---|
| Tickets on sale | 50,000 |
| Interested users hammering | 2,000,000 in 10 minutes |
| Each user retries checkout ~5 times |
Requests in 10 min β 2M Γ 5 = 10M
Seconds = 600
Effective QPS β 10M / 600 β 17,000 QPS spike
Design implication: queue + rate limit + hold seats. Average daily QPS is irrelevant β the spike is the product.
Case 3: Ride sharing location updates
| Assumption | Value |
|---|---|
| Concurrent drivers online | 100,000 |
| GPS update every | 4 seconds |
Write QPS β 100,000 / 4 = 25,000 location writes/sec
Design implication: donβt write every ping to Postgres as a row forever. Use Redis GEO / in-memory + sampled history.
Case 4: YouTube-like watch traffic (simplified)
| Assumption | Value |
|---|---|
| DAU | 50M |
| Videos watched / user / day | 5 |
| Avg bytes streamed / watch (adaptive) | 80 MB |
Watches/day = 50M Γ 5 = 250M
Bytes/day β 250M Γ 80 MB = 20,000 TB = 20 PB/day egress π±
Design implication: almost all bytes must come from CDN, not your origin. Your estimate just proved why Netflix/YouTube are CDN companies as much as app companies.
Read vs write β always compute the ratio
Read:Write ratio β read QPS : write QPS
| Ratio | Typical system | Lean toward |
|---|---|---|
| 100:1 | URL shortener, CDN origins | Cache, replicas |
| 10:1 | Social feed | Cache + async fanout |
| 1:1 | Chat send β receive | Careful with both paths |
| 1:10 | Logging / metrics | Queues, append stores |
When is one machine not enough?
Rough beginner guardrails (not laws):
| Resource | βStill OK on one strong boxβ | βStart planning scale-outβ |
|---|---|---|
| Simple API QPS | < a few thousand | > 10k sustained, or spiky |
| DB writes (single primary) | < a few hundredβ~1k TPS | Multi-thousand writes/sec |
| DB size | < a few TB | Many TB + heavy indexes |
| Outbound bandwidth | < 1 Gbps comfortable | Multi-Gbps sustained |
If your napkin math crosses these lines, mention replicas, cache, shard, queue, or CDN in the HLD β with a reason tied to the number.
A 5-minute interview recipe
Use this every time:
- Clarify DAU / actions (guess if needed, say youβre guessing)
- Compute avg QPS β apply peak factor
- Estimate record size Γ volume Γ retention β storage
- QPS Γ payload size β bandwidth (especially media)
- Read:write ratio β pick cache / queue / shard story
- Circle the bottleneck in one sentence
Example one-liner:
β~4k peak redirect QPS and 100:1 reads β Redis cache in front of Postgres; storage is only a few TB so sharding can wait.β
Common beginner mistakes
- Fake precision β βQPS = 1,157.407β β just say ~1,200
- Forgetting peaks β averages hide Black Friday
- Putting media size into the DB estimate β metadata β video bytes
- Ignoring retention β 1 day of logs β 5 years of logs
- Designing Kafka on day one for 5 QPS β numbers should drive complexity
Practice problems
Try these before opening the answers.
Practice 1
DAU = 5 million. Each user makes 8 API calls/day. Peak factor = 3.
What is peak QPS?
Practice 2
A chat app stores 200 million messages/day at 1 KB each. Keep 90 days.
Approx raw storage for 90 days?
Practice 3
An image CDN edge sees 20,000 requests/sec, 150 KB average.
Approx bandwidth?
Practice 4
E-commerce: 100k orders/day, each order write hits DB once. Are writes the bottleneck?
Answers
1. Requests/day = 5M Γ 8 = 40M β avg QPS β 40M/86400 β 460 β peak β 1,400 QPS.
2. Per day = 200M Γ 1 KB = 200 GB β 90 days β 18 TB raw (plus indexes/replicas in real life).
3. 20,000 Γ 150 KB = 3,000,000 KB/s β 3 GB/s β ~24 Gbps.
4. Write QPS β 100k/86400 β 1.2 QPS β trivial. Catalog reads and payment latency matter more than order write volume.
Check your understanding
- Roughly how many requests/day is 1,000 QPS?
- Why multiply by a peak factor?
- DAU = 1M, each uploads a 2 MB photo once/day β daily ingest?
- Name one system that is storage-heavy but write-QPS-light.
Answers
- β 1,000 Γ 86,400 β 86 million/day.
- Traffic is uneven; capacity must cover busy hours / events.
- 1M Γ 2 MB = 2 TB/day.
- Pastebin / photo metadata systems / analytics cold store β many answers work if justified.
Recap
- Estimates exist to find bottlenecks, not to impress with arithmetic
- Master three tools: QPS, storage, bandwidth
- Round bravely; state assumptions
- End with: βSo the hard part is X, therefore we add Y.β
Next: Clients, Servers & APIs