Skip to content

Back of the Envelope Estimations

A reference guide for quick calculations in system design interviews. These estimations help validate architecture decisions and identify bottlenecks.


Powers of 2

Power Exact Value Approx Bytes
2^10 1,024 1 Thousand 1 KB
2^20 1,048,576 1 Million 1 MB
2^30 1,073,741,824 1 Billion 1 GB
2^40 1,099,511,627,776 1 Trillion 1 TB
2^50 1 Quadrillion 1 PB

Quick Conversions

1 KB = 1,000 bytes (for estimation, actually 1,024)
1 MB = 1,000 KB = 1 million bytes
1 GB = 1,000 MB = 1 billion bytes
1 TB = 1,000 GB = 1 trillion bytes
1 PB = 1,000 TB = 1 quadrillion bytes

Latency Numbers Every Programmer Should Know

Operation Latency Notes
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2, 200x L1
Compress 1KB with Zippy 3 µs
Send 1KB over 1 Gbps network 10 µs
Read 4KB randomly from SSD 150 µs ~1 GB/sec SSD
Read 1MB sequentially from memory 250 µs
Round trip within same datacenter 500 µs
Read 1MB sequentially from SSD 1 ms 4x memory
HDD disk seek 10 ms 20x datacenter RT
Read 1MB sequentially from HDD 20 ms 80x memory, 20x SSD
Send packet CA → Netherlands → CA 150 ms

Key Takeaways

  • Memory is fast, disk is slow
  • SSD is 4-20x faster than HDD
  • Network within datacenter is fast (~500µs)
  • Cross-continent is slow (~150ms)
  • Avoid disk seeks when possible
  • Compress data before sending over network

Availability Numbers

Availability % Downtime/Year Downtime/Month Downtime/Week
99% (two 9s) 3.65 days 7.31 hours 1.68 hours
99.9% (three 9s) 8.77 hours 43.83 minutes 10.08 minutes
99.99% (four 9s) 52.60 minutes 4.38 minutes 1.01 minutes
99.999% (five 9s) 5.26 minutes 26.30 seconds 6.05 seconds
99.9999% (six 9s) 31.56 seconds 2.63 seconds 0.60 seconds

Availability in Series vs Parallel

Series (both must work):

Availability = A1 × A2
Example: 99.9% × 99.9% = 99.8%

Parallel (either can work):

Availability = 1 - (1 - A1) × (1 - A2)
Example: 1 - (0.001 × 0.001) = 99.9999%


Time Conversions

Unit Seconds For Estimation
1 minute 60 ~100
1 hour 3,600 ~4,000
1 day 86,400 ~100,000
1 week 604,800 ~600,000
1 month 2,592,000 ~2.5 million
1 year 31,536,000 ~30 million

Quick Rules

  • Seconds in a day: ~100,000 (actually 86,400)
  • Seconds in a month: ~2.5 million
  • Seconds in a year: ~30 million

Traffic Estimations

Daily Active Users (DAU) to Requests

If 100M DAU, each user makes 10 requests/day:
= 100M × 10 = 1 billion requests/day
= 1B / 100,000 seconds = 10,000 RPS

General formula:
RPS = (DAU × requests_per_user) / 86,400

Peak vs Average

  • Peak traffic: Usually 2-3x average
  • Rule of thumb: Design for 3x average load

Storage Estimations

Common Object Sizes

Object Size
UUID/GUID 16 bytes
Unix timestamp 4-8 bytes
Integer (32-bit) 4 bytes
Integer (64-bit) 8 bytes
Tweet (text only) ~300 bytes
Metadata per record 100-500 bytes
User profile (basic) 1 KB
Small image (thumbnail) 10-50 KB
Medium image 100-500 KB
Large image (HD) 1-5 MB
Short video (1 min) 5-10 MB
Long video (1 hour, compressed) 500 MB - 2 GB

Database Row Sizes (Typical)

Simple record (id, timestamps, few fields): 100-500 bytes
User profile: 1-5 KB
Product listing: 2-10 KB

Bandwidth Estimations

Formula

Bandwidth = (Data size × Requests) / Time

Example: 1 million requests/day, 100 KB each
= 1M × 100 KB / 86,400 sec
= 100 GB / 86,400 sec
≈ 1.16 MB/sec
≈ 10 Mbps

Common Bandwidths

Connection Bandwidth
3G mobile 1-5 Mbps
4G mobile 10-50 Mbps
5G mobile 100-1000 Mbps
Home broadband 50-200 Mbps
Datacenter server 1-10 Gbps
AWS instance (typical) 1-25 Gbps

Common System Numbers

Social Media Scale (Reference)

Platform Metric Value
Twitter/X DAU ~250 million
Twitter/X Tweets/day ~500 million
Facebook DAU ~2 billion
Instagram DAU ~500 million
YouTube Videos watched/day ~5 billion
WhatsApp Messages/day ~100 billion
Google Searches/day ~8.5 billion

URL Shortener (like bit.ly)

New URLs/month: 100 million
Reads per write: 100:1
Total reads: 10 billion/month
Storage per URL: 500 bytes
Monthly storage: 100M × 500 = 50 GB

Chat Application

Messages/user/day: 40
Average message size: 100 bytes
1 million DAU:
- Messages/day: 40 million
- Storage/day: 4 GB
- Storage/year: 1.5 TB

Database Estimations

Read/Write Ratios (Typical)

Application Read:Write
Social media feed 100:1 to 1000:1
E-commerce catalog 100:1
Chat application 1:1 to 5:1
Analytics/logging 1:10 to 1:100
User registration 1000:1

Database Capacity

Database Practical Limit
Single MySQL 1-5 TB comfortable
Single PostgreSQL 1-10 TB comfortable
DynamoDB partition 10 GB
MongoDB single node 2-5 TB comfortable
Redis single node 25-50 GB practical

Query Performance

Operation Typical Latency
Primary key lookup 1-5 ms
Indexed query 5-50 ms
Full table scan (1M rows) 100ms - seconds
Join across large tables seconds

Caching Estimations

Cache Hit Ratio

  • Good: 80-90%
  • Excellent: 95%+
  • Poor: < 70%

Memory Sizing

If 20% of data is accessed 80% of the time:
Cache size = 20% of total data size

Example: 100 GB database
Effective cache: 20 GB

Cache Performance

Cache Latency Throughput
In-process (local) 1-10 µs millions/sec
Redis/Memcached 0.5-1 ms 100K-1M ops/sec
CDN edge cache 10-100 ms varies

Estimation Framework

Step-by-Step Approach

  1. Clarify requirements
  2. Read-heavy or write-heavy?
  3. Consistency requirements?
  4. Latency requirements?

  5. Estimate scale

  6. DAU/MAU
  7. Requests per user
  8. Data per request

  9. Calculate QPS (Queries Per Second)

    Average QPS = DAU × queries_per_user / 86,400
    Peak QPS = Average QPS × 3
    

  10. Calculate storage

    Daily storage = requests × data_per_request
    Yearly storage = daily × 365
    5-year storage = yearly × 5
    

  11. Calculate bandwidth

    Bandwidth = QPS × data_size
    

  12. Estimate servers needed

    Servers = QPS / queries_per_server
    (Typical web server: 1,000-10,000 QPS)
    


Quick Reference Formulas

QPS Calculation

QPS = (DAU × actions_per_day) / 86,400
Peak QPS = QPS × 2 to 3

Storage Calculation

Storage = users × data_per_user × retention_period
or
Storage = requests × data_per_request × retention_period

Bandwidth Calculation

Bandwidth (bytes/sec) = QPS × average_request_size
Bandwidth (Mbps) = Bandwidth (bytes/sec) × 8 / 1,000,000

Servers Needed

Web servers = Peak QPS / 10,000 (conservative)
Database connections = Servers × connections_per_server

Example: Design Twitter

Requirements

  • 300 million MAU, 150 million DAU
  • Each user: 2 tweets/day, reads 100 tweets/day
  • Tweet size: 300 bytes + metadata = 500 bytes
  • 10% tweets have image (200 KB avg)

Calculations

Write QPS:

Tweets/day = 150M × 2 = 300 million
Write QPS = 300M / 86,400 ≈ 3,500 QPS
Peak Write QPS ≈ 10,000 QPS

Read QPS:

Reads/day = 150M × 100 = 15 billion
Read QPS = 15B / 86,400 ≈ 170,000 QPS
Peak Read QPS ≈ 500,000 QPS

Storage (1 year):

Text: 300M tweets/day × 500 bytes × 365 = 55 TB/year
Images: 30M images/day × 200 KB × 365 = 2.2 PB/year
Total: ~2.3 PB/year

Bandwidth:

Read: 500K QPS × 500 bytes = 250 MB/sec text
Plus images: significant additional bandwidth


Example: Design URL Shortener

Requirements

  • 100 million new URLs/month
  • Read:Write = 100:1
  • URL stored for 5 years
  • Short URL: 7 characters

Calculations

Write QPS:

100M / (30 × 86,400) ≈ 40 QPS
Peak: 80 QPS

Read QPS:

40 × 100 = 4,000 QPS
Peak: 8,000 QPS

Storage (5 years):

URLs = 100M × 12 months × 5 years = 6 billion URLs
Storage = 6B × 500 bytes = 3 TB

Short URL combinations:

7 chars, base62 = 62^7 = 3.5 trillion combinations
More than enough for 6 billion URLs


Common Mistakes to Avoid

  1. Forgetting peak traffic - Always design for 2-3x average
  2. Ignoring read/write ratio - Caching strategies depend on this
  3. Underestimating metadata - Indexes, timestamps add up
  4. Forgetting replication - 3x storage for replication
  5. Ignoring network overhead - Headers, protocols add bytes
  6. Not considering growth - Plan for 2-5 years ahead
  7. Precise calculations - Round numbers are fine in interviews

Cheat Sheet

Seconds/day:     ~100K (86,400)
Seconds/month:   ~2.5M
Seconds/year:    ~30M

1 KB = 1,000 bytes
1 MB = 1,000 KB
1 GB = 1,000 MB  = 1 billion bytes
1 TB = 1,000 GB  = 1 trillion bytes

Typical web server: 1K-10K QPS
Typical DB server:  1K-10K QPS
Redis/Memcached:    100K+ ops/sec

Memory access:      100 ns
SSD random read:    150 µs
HDD seek:           10 ms
Network RT (DC):    500 µs
Network RT (cross-continent): 150 ms