Module 0 - Core Concepts

Back-of-Envelope Estimation

The art of quickly calculating system requirements using approximations. Essential for system design interviews and capacity planning.

15 min readInterview Critical

Back-of-Envelope Calculator

Quick estimates for system design interviews

1.0M users
Peak = 3x average
10.0M
Daily Requests
116
Avg QPS
348
Peak QPS
3.4 TB
Storage/Year
0.9 Mbps
Avg Bandwidth
2.7 Mbps
Peak Bandwidth
1
Servers @ 1K QPS
Quick Formulas
QPS = Daily Requests / 86,400
Peak QPS = Avg QPS × Peak Multiplier
Storage = Requests × Data Size × Days
Servers = Peak QPS / QPS per Server

1Why Estimation Matters

Why This Matters
Imagine you're building a bridge. Before drawing blueprints, you need to know: How many cars per hour? How heavy are the trucks? What's the wind speed?

System design is the same. Before choosing technologies, you need to estimate traffic, storage, and bandwidth to know if your design can handle the load.
Right-size Infrastructure

Avoid over-provisioning (wasting money) or under-provisioning (outages).

Interview Success

Interviewers expect you to estimate QPS, storage, and bandwidth unprompted.

Justify Decisions

We need sharding because 1B rows will not fit on one machine - more convincing with numbers.

2Essential Numbers to Memorize

Pro Tip
You don't need exact numbers. Interviewers want to see your thought process. Use powers of 2 and round aggressively. Being off by 2x is fine; being off by 100x is not.

Powers of 2 (Data Sizes)

PowerExact ValueApproxName
2^101,0241 Thousand1 KB
2^201,048,5761 Million1 MB
2^301,073,741,8241 Billion1 GB
2^401,099,511,627,7761 Trillion1 TB
2^50~1 Quadrillion1 Quadrillion1 PB

Time Conversions

Seconds/day
86,400
~100K
Seconds/month
2.6M
~2.5M
Seconds/year
31.5M
~30M
Requests/day @ 1 QPS
86,400
~100K

Latency Numbers (Approximate)

L1 cache reference
1 ns
L2 cache reference
4 ns
RAM reference
100 ns
SSD random read
150 μs
HDD seek
10 ms
Same datacenter roundtrip
0.5 ms
Cross-continent roundtrip
150 ms
Key insight: Memory is ~1000x faster than SSD, SSD is ~100x faster than HDD, Network varies wildly.

Typical Data Sizes

Tweet/Text message
~200 bytes
Metadata record
~1 KB
Web page
~2 MB
Image (compressed)
~200 KB
HD Video (1 min)
~50 MB
4K Video (1 min)
~300 MB

3The Estimation Framework

1
Clarify the Scope
What exactly are we estimating? Daily active users? Storage for 5 years? Peak QPS?
2
Make Assumptions
State your assumptions clearly. "Assume 100M DAU, each user makes 10 requests/day..."
3
Calculate Step by Step
Break complex calculations into simple steps. Show your work.
4
Sanity Check
Does the answer make sense? Compare to known systems.

4Common Estimation Scenarios

Estimate QPS for a Twitter-like service with 300M monthly active users.
Calculation
  1. 1. Monthly Active Users (MAU) = 300M
  2. 2. Daily Active Users (DAU) = 50% of MAU = 150M
  3. 3. Each user views timeline ~10 times/day
  4. 4. Total daily requests = 150M × 10 = 1.5B requests/day
  5. 5. QPS = 1.5B / 86,400 ≈ 17,000 QPS
  6. 6. Peak QPS = 2× average = ~35,000 QPS
✓ Result:~17K QPS average, ~35K QPS peak
How much storage does Twitter need for tweets over 5 years?
Calculation
  1. 1. Tweets per day = 500M
  2. 2. Average tweet size = 200 bytes (text only)
  3. 3. Daily storage = 500M × 200B = 100GB/day
  4. 4. Yearly storage = 100GB × 365 = 36.5TB/year
  5. 5. 5-year storage = 36.5TB × 5 = 182.5TB
  6. 6. With 3x replication = 182.5TB × 3 ≈ 550TB
✓ Result:~550 TB for text tweets over 5 years
Estimate bandwidth for Instagram serving 500M DAU.
Calculation
  1. 1. DAU = 500M users
  2. 2. Each user views ~20 images/day
  3. 3. Average image size = 200KB
  4. 4. Daily data transfer = 500M × 20 × 200KB = 2PB/day
  5. 5. Per second = 2PB / 86,400s ≈ 23GB/s
  6. 6. In bits = 23GB × 8 = 185 Gbps
✓ Result:~185 Gbps bandwidth requirement

5Quick Reference Formulas

QPS from DAU
QPS = (DAU × actions/user) / 86,400
100M DAU × 10 actions = 1B/day ≈ 12K QPS
Storage per Year
Storage = items/day × size × 365
1M items × 1KB = 365GB/year
Bandwidth
BW = QPS × response_size
10K QPS × 100KB = 1GB/s
Servers Needed
Servers = Total QPS / QPS per server
100K QPS / 10K = 10 servers
Cache Size
Cache = working_set × hit_rate_target
Top 20% data handles 80% requests
Replication Factor
Total = Raw × Replication Factor
1TB × 3 replicas = 3TB total

6Practice: Estimate a URL Shortener

Try This Exercise

Design a URL shortener (like bit.ly) and estimate:

  • How many URLs can be shortened per day?
  • How much storage is needed for 10 years?
  • What QPS should the read service handle?
Sample Answer

Assumptions: 100M new URLs/month, 100:1 read:write ratio

Write QPS: 100M / (30 × 86400) ≈ 40 QPS

Read QPS: 40 × 100 = 4,000 QPS

Storage: 100M × 12 months × 10 years × 500B = 6TB

With overhead: 6TB × 3 (replication) = 18TB total

7Common Mistakes

Forgetting peak vs average
Peak is usually 2-10x average. Design for peak, cost for average.
Ignoring replication
Data is usually replicated 3x. Storage = Raw × Replication Factor.
Wrong time units
Be careful with seconds vs milliseconds, bits vs bytes.
Not stating assumptions
Always say 'Assuming X...' so interviewer can correct you early.

8Key Takeaways

1Memorize key numbers: 86,400 seconds/day, powers of 2, latency hierarchy.
2Use the framework: Clarify → Assume → Calculate → Sanity Check.
3Round aggressively. 2^10 ≈ 1000 is good enough.
4Always consider peak load (2-10x average) and replication (usually 3x).
5Show your work step by step. Process matters more than exact answer.
6Sanity check against known systems (Twitter does ~300K tweets/sec).

9Interview Follow-up Questions

Interview Follow-up Questions

Common follow-up questions interviewers ask

10Test Your Understanding

Test Your Understanding

5 questions

1

A service has 500M monthly active users, 20% are daily active. Each user makes 8 requests per day. What is the approximate QPS?

2

You need to store 10 million images, each 500KB on average. How much storage is needed with 3x replication?

3

Which is approximately correct: 2^30 equals?

4

A system needs to handle 50,000 QPS at peak. Your servers handle 2,000 QPS each. How many servers minimum (with 25% buffer)?

5

Reading from RAM is approximately how much faster than reading from SSD?

0 of 5 answered