Back-of-Envelope Estimation - Complete Deep Dive

Prerequisites: None (this is foundational) Used in: Every HLD interview (first 3 minutes)


What is Back-of-Envelope Estimation?

Quick, approximate calculations to determine the scale of a system β€” how much storage, bandwidth, and compute you need. Interviewers use this to test whether you can think about scale before diving into design.

Real-world analogy: A contractor estimating materials before building a house. They don’t measure every nail β€” they estimate β€œ3-bedroom house, ~2000 sq ft, roughly 15,000 board feet of lumber, ~30 yards of concrete.” Close enough to plan. Same idea: estimate scale to make informed design decisions.

Interviewer: "Design Twitter"
You: "Let me estimate the scale first."

- 500M users, 200M daily active
- Each user reads ~100 tweets/day β†’ 20B reads/day β†’ ~230K QPS
- Each user posts ~0.5 tweets/day β†’ 100M writes/day β†’ ~1,150 QPS
- Read:Write ratio = 200:1 β†’ read-heavy! Need caching + fan-out

Now you know: optimize for reads, use cache heavily, consider fan-out-on-write.

Numbers You Must Memorize

Latency Numbers

flowchart TD
    subgraph Latency["LATENCY NUMBERS EVERY ENGINEER SHOULD KNOW"]
        L1["L1 cache: 0.5 ns"]
        L2["L2 cache: 7 ns"]
        RAM["RAM: 100 ns"]
        RAMR["Read 1 MB from RAM: 0.25 ms"]
        SSD["SSD random read: 150 us"]
        SSDR["Read 1 MB from SSD: 1 ms"]
        HDD["HDD seek: 10 ms"]
        HDDR["Read 1 MB from HDD: 20 ms"]
        DC["Same DC packet: 0.5 ms"]
        REDIS["Redis GET: 1 ms"]
        DBQ["DB query indexed: 1-5 ms"]
        DBS["DB query full scan: 50-500 ms"]
        CC["Cross-continent: 150 ms"]
        TLS["TLS handshake: 50-100 ms"]
    end

    classDef data fill:#fbbf24,stroke:#92400e,color:#000
    class L1,L2,RAM,RAMR,SSD,SSDR,HDD,HDDR,DC,REDIS,DBQ,DBS,CC,TLS data

Takeaways:

Powers of 2

Power Value Storage
2^10 1 Thousand 1 KB
2^20 1 Million 1 MB
2^30 1 Billion 1 GB
2^40 1 Trillion 1 TB
2^50 1 Quadrillion 1 PB

Quick conversions: 1 KB = 1,000 bytes (10^3), 1 MB = 10^6 bytes, 1 GB = 10^9 bytes, 1 TB = 10^12 bytes.

Time Conversions

Conversion Value
1 day 86,400 seconds β‰ˆ 100K sec
1 month 2.5 million seconds
1 year 30 million seconds

Shortcut: 1 day β‰ˆ 10^5 seconds. QPS from daily count: daily_count / 100,000 = average QPS. Peak QPS β‰ˆ 2-3x average QPS.

Common Data Sizes

Category Item Size
Text 1 character (ASCII) 1 byte
Β  1 character (UTF-8 avg) 2-3 bytes
Β  Tweet (280 chars) ~560 bytes
Β  Average JSON API response 1-5 KB
Β  Average web page 2-5 MB
Media Profile picture (compressed) 50-200 KB
Β  High-res photo 2-5 MB
Β  1 min video (720p) 50-100 MB
Β  1 min video (1080p) 100-200 MB
Β  1 hour video (1080p, compressed) 1-3 GB
Database User record (text fields) 1-2 KB
Β  Order record 2-5 KB
Β  Database row (average) 1 KB
Β  1 billion rows at 1 KB each 1 TB
Network HTTP request overhead 1-2 KB
Β  WebSocket frame overhead 2-14 bytes
Β  Average API call payload 1-10 KB

The Estimation Framework

For any system, estimate these three:

1. QPS (Queries Per Second)

Formula:
  QPS = Daily Active Users Γ— Actions per user per day / 86,400

Example (Twitter reads):
  DAU = 200M
  Reads per user per day = 100 (home timeline refreshes + scrolling)
  Read QPS = 200M Γ— 100 / 100,000 = 200,000 QPS
  Peak QPS = 200K Γ— 3 = 600K QPS

Example (Twitter writes):
  DAU = 200M
  Tweets per user per day = 0.5 (not everyone tweets daily)
  Write QPS = 200M Γ— 0.5 / 100,000 = 1,000 QPS
  Peak QPS = 1K Γ— 3 = 3,000 QPS

2. Storage

Formula:
  Storage = Daily new data Γ— Retention period

Example (WhatsApp messages):
  DAU = 500M
  Messages per user per day = 40
  Average message size = 100 bytes (text) or 500 KB (media, 5% of msgs)
  
  Text: 500M Γ— 40 Γ— 100B = 2 TB/day
  Media: 500M Γ— 40 Γ— 0.05 Γ— 500KB = 500 TB/day
  
  Retain for 30 days: ~15,000 TB = 15 PB (just for messages!)

3. Bandwidth

Formula:
  Bandwidth = QPS Γ— Average response size

Example (YouTube streaming):
  Concurrent viewers = 5M
  Average bitrate = 5 Mbps (1080p)
  
  Egress bandwidth = 5M Γ— 5 Mbps = 25 Tbps
  Per server (10 Gbps link) = need 2,500 servers just for streaming

Example Calculations

Twitter/X

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  TWITTER ESTIMATION                                         β”‚
β”‚                                                             β”‚
β”‚  Given:                                                     β”‚
β”‚  - 500M total users, 200M DAU                              β”‚
β”‚  - Average: 2 tweets posted / day (among active tweeters)  β”‚
β”‚  - Average: 100 tweet reads / day (timeline + search)      β”‚
β”‚  - 10% of tweets have media (avg 500KB)                    β”‚
β”‚                                                             β”‚
β”‚  QPS:                                                       β”‚
β”‚  - Write QPS: 200M Γ— 0.5 / 100K = 1,000 QPS              β”‚
β”‚  - Read QPS: 200M Γ— 100 / 100K = 200,000 QPS             β”‚
β”‚  - Ratio: 200:1 read-heavy β†’ cache aggressively            β”‚
β”‚                                                             β”‚
β”‚  Storage (per day):                                         β”‚
β”‚  - Tweet text: 100M tweets Γ— 560B = 56 GB/day             β”‚
β”‚  - Media: 10M media Γ— 500KB = 5 TB/day                    β”‚
β”‚  - Metadata: 100M Γ— 200B = 20 GB/day                      β”‚
β”‚  - Total: ~5 TB/day β†’ 150 TB/month β†’ 1.8 PB/year         β”‚
β”‚                                                             β”‚
β”‚  Bandwidth:                                                 β”‚
β”‚  - Read: 200K QPS Γ— 5KB avg response = 1 GB/s egress      β”‚
β”‚  - Media: 50K media reads/s Γ— 500KB = 25 GB/s             β”‚
β”‚                                                             β”‚
β”‚  Design Implications:                                       β”‚
β”‚  - Read-heavy β†’ CDN + cache (Redis for timelines)          β”‚
β”‚  - Media-heavy storage β†’ object store (S3)                 β”‚
β”‚  - Fan-out-on-write for feed generation                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

YouTube

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  YOUTUBE ESTIMATION                                         β”‚
β”‚                                                             β”‚
β”‚  Given:                                                     β”‚
β”‚  - 2B total users, 1B DAU                                  β”‚
β”‚  - Average watch time: 30 min/day                          β”‚
β”‚  - 500 hours of video uploaded per minute                  β”‚
β”‚  - Video stored in 5 resolutions                           β”‚
β”‚                                                             β”‚
β”‚  Storage (uploads):                                         β”‚
β”‚  - 500 hours/min = 30,000 hours/hour = 720,000 hours/day  β”‚
β”‚  - 1 hour raw video β‰ˆ 3 GB                                β”‚
β”‚  - 720K hours Γ— 3 GB = 2.16 PB/day (raw)                  β”‚
β”‚  - Γ— 5 resolutions = ~10 PB/day (transcoded)              β”‚
β”‚  - Per year: ~3.6 EB (exabytes!)                          β”‚
β”‚                                                             β”‚
β”‚  Bandwidth (streaming):                                     β”‚
β”‚  - Peak concurrent viewers: ~100M                          β”‚
β”‚  - Average bitrate: 5 Mbps                                β”‚
β”‚  - Peak bandwidth: 100M Γ— 5 Mbps = 500 Tbps              β”‚
β”‚  - CDN handles 95%+ β†’ origin serves ~25 Tbps             β”‚
β”‚                                                             β”‚
β”‚  Design Implications:                                       β”‚
β”‚  - Massive object storage (S3/GCS)                         β”‚
β”‚  - Heavy CDN usage (edge caching for popular videos)       β”‚
β”‚  - Async transcoding pipeline (multiple resolutions)       β”‚
β”‚  - Adaptive bitrate streaming (client picks quality)       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

WhatsApp

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  WHATSAPP ESTIMATION                                        β”‚
β”‚                                                             β”‚
β”‚  Given:                                                     β”‚
β”‚  - 2B total users, 500M DAU                                β”‚
β”‚  - 40 messages sent per user per day                       β”‚
β”‚  - 5% messages contain media (avg 200KB)                   β”‚
β”‚  - Text message avg: 100 bytes                             β”‚
β”‚                                                             β”‚
β”‚  QPS:                                                       β”‚
β”‚  - Messages: 500M Γ— 40 / 100K = 200,000 QPS              β”‚
β”‚  - Peak: 600K QPS                                          β”‚
β”‚  - Per connection: mostly idle (WebSocket)                  β”‚
β”‚                                                             β”‚
β”‚  Storage (per day):                                         β”‚
β”‚  - Text: 20B msgs Γ— 100B = 2 TB/day                       β”‚
β”‚  - Media: 1B Γ— 200KB = 200 TB/day                         β”‚
β”‚  - Total: ~200 TB/day (dominated by media)                 β”‚
β”‚                                                             β”‚
β”‚  Connections:                                               β”‚
β”‚  - 500M concurrent WebSocket connections (peak)            β”‚
β”‚  - 50K connections per server β†’ 10,000 servers             β”‚
β”‚                                                             β”‚
β”‚  Design Implications:                                       β”‚
β”‚  - WebSocket at massive scale                              β”‚
β”‚  - Media stored in blob storage, only URL in message       β”‚
β”‚  - End-to-end encryption (keys per device)                 β”‚
β”‚  - Message queuing for offline users                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Estimation Cheat Sheet

Metric Formula Example
QPS DAU Γ— actions/user / 86,400 200M Γ— 10 / 100K = 20K QPS
Peak QPS Average QPS Γ— 2-3 20K Γ— 3 = 60K QPS
Storage/day New items/day Γ— item size 1M Γ— 5KB = 5 GB/day
Storage/year Storage/day Γ— 365 5 GB Γ— 365 = 1.8 TB
Bandwidth QPS Γ— avg response size 20K Γ— 10KB = 200 MB/s
Servers needed Peak QPS / QPS per server 60K / 1000 = 60 servers
Cache size Hot data Γ— size 20% of 1TB = 200 GB Redis

Common Mistakes to Avoid

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  βœ— Being too precise: "2,314,814 QPS"                       β”‚
β”‚  βœ“ Round aggressively: "about 2.3M QPS, let's say 2-3M"   β”‚
β”‚                                                             β”‚
β”‚  βœ— Forgetting peak vs average                               β”‚
β”‚  βœ“ Always multiply average by 2-3x for peak                β”‚
β”‚                                                             β”‚
β”‚  βœ— Ignoring read vs write ratio                             β”‚
β”‚  βœ“ Calculate both β€” it drives caching and architecture     β”‚
β”‚                                                             β”‚
β”‚  βœ— Not stating assumptions                                  β”‚
β”‚  βœ“ "I'll assume 200M DAU and 50 reads/user/day"           β”‚
β”‚                                                             β”‚
β”‚  βœ— Spending more than 3-5 minutes on estimation            β”‚
β”‚  βœ“ Quick numbers, then move to design                      β”‚
β”‚                                                             β”‚
β”‚  βœ— Estimating without connecting to design decisions        β”‚
β”‚  βœ“ "200K read QPS means we need aggressive caching"        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

When to Use / When NOT to Use

Use Back-of-Envelope When:

When NOT to Stress:


Real-World Scale References

Company Key Numbers
Google Search 8.5B searches/day β†’ ~100K QPS
Twitter 500M tweets/day, 200B timeline reads/day
Netflix 15% of global internet bandwidth, 200M subscribers
WhatsApp 100B messages/day across 2B users
Uber 100M rides/month, millions of location updates/second
Instagram 2B MAU, 100M photos uploaded daily

Common Interview Questions

Q: β€œHow many servers do we need for this system?” A: Calculate peak QPS first. Assume a single application server handles 500-1000 simple requests/sec (varies by complexity). Divide peak QPS by per-server capacity. Add 30% headroom. For example: 60K peak QPS / 1000 per server = 60 servers + 30% = ~80 servers.

Q: β€œCan this fit in a single database?” A: Check two things: (1) Storage β€” a single Postgres instance handles up to ~10TB comfortably. (2) QPS β€” a single instance handles ~5-10K simple reads/sec, ~1-5K writes/sec with good indexes. If you exceed either, you need sharding or read replicas.

Q: β€œHow much cache do we need?” A: Apply the 80/20 rule: 20% of data serves 80% of requests. Calculate: total data size Γ— 20% = cache size. For 1TB of user data: 200GB Redis. At $25/GB/month for Redis, that’s $5000/month β€” often worth it to avoid DB load.

Q: β€œWhat’s the bandwidth cost?” A: Egress bandwidth costs ~$0.05-0.12/GB on cloud providers. If you serve 100 TB/month: ~$5,000-$12,000/month for bandwidth alone. This is why CDNs are essential β€” they reduce origin egress and often cost less per GB.


← Back to Fundamentals Next: Fan-Out Patterns β†’

Free system design + DSA prep. If it helped you crack an interview, consider supporting.