Skip to main content

Back-of-Envelope Estimation

Back-of-envelope estimation provides quick calculations to justify design decisions and identify potential bottlenecks in system design.

Purpose

Estimation determines:

  • Design feasibility
  • Potential bottlenecks
  • Technology selection
  • Infrastructure sizing

Powers of Two

PowerExact ValueApproximation
2^101,024~1 thousand (KB)
2^201,048,576~1 million (MB)
2^301,073,741,824~1 billion (GB)
2^40~1 trillion (TB)

Unit Conversions:

  • 1 byte = 8 bits
  • 1 KB = 1,000 bytes
  • 1 MB = 1,000 KB
  • 1 GB = 1,000 MB

Common Data Sizes

Data TypeSize
char1 byte
int324 bytes
int64 / timestamp8 bytes
UUID16 bytes
Short string (username)20-50 bytes
URL100-200 bytes
Email5-50 KB
Image (compressed)200 KB - 1 MB
Video (1 min, compressed)5-50 MB

Time Conversions

PeriodSeconds
1 day86,400 (~100,000)
1 month2.5 million
1 year30 million

Calculation: 1 million requests per day = 1,000,000 / 100,000 = 10 requests/second

Estimation Framework

Step 1: Clarify Scale

Define or estimate:

  • Daily active users (DAU)
  • Actions per user per day
  • Data size per action

Step 2: Calculate Request Rate

Multiply daily active users by actions per user to get total daily requests. Divide by 86,400 seconds per day to get queries per second (QPS). Multiply QPS by 2-5 to estimate peak traffic, depending on traffic patterns.

Step 3: Calculate Storage

Multiply daily requests by data size per request to get daily storage. Multiply by 365 for yearly storage. Multiply by 5 for five-year projections.

Step 4: Calculate Bandwidth

Multiply QPS by average request size for incoming bandwidth. Multiply QPS by average response size for outgoing bandwidth.

Example: URL Shortener

Assumptions:

  • 100M new URLs per month
  • 10:1 read-to-write ratio
  • Average URL length: 100 bytes
  • Short code: 7 bytes

Write QPS: 100 million URLs per month divided by 2.5 million seconds per month equals approximately 40 writes per second.

Read QPS: 40 writes multiplied by a 10:1 read ratio equals 400 reads per second. At 3x peak, this becomes 1,200 reads per second.

Storage (5 years): 100 million URLs per month times 12 months times 5 years equals 6 billion URLs. Each entry requires 7 bytes (short code) plus 100 bytes (long URL) plus 8 bytes (timestamp), totaling 120 bytes per entry. 6 billion entries at 120 bytes equals approximately 720 GB.

Bandwidth: Write bandwidth: 40 requests per second times 100 bytes equals 4 KB/s. Read bandwidth: 400 requests per second times 120 bytes equals 48 KB/s.

Example: Social Media Feed

Assumptions:

  • 500M DAU
  • 5 feed views per user per day
  • 20 posts per feed
  • Each post: 1 KB text + 200 KB media reference

Read QPS: 500 million DAU times 5 feed views divided by 86,400 seconds per day equals approximately 29,000 requests per second. At 3x peak, this becomes 87,000 requests per second.

Bandwidth (outgoing): 29,000 requests per second times 20 posts per request times 1 KB per post (text only) equals approximately 580 MB/s. Media content requires separate CDN distribution.

Example: Chat Application

Assumptions:

  • 100M DAU
  • 50 messages sent per user per day
  • Average message: 100 bytes

Message QPS: 100 million DAU times 50 messages per user divided by 86,400 seconds per day equals approximately 58,000 messages per second.

Daily storage: 100 million users times 50 messages times 100 bytes per message equals 500 GB per day. Annual storage requirement is approximately 180 TB.

Connection handling: With 10% of users online at any time, the system handles 10 million concurrent WebSocket connections. Each connection requires approximately 10 KB of memory, totaling 100 GB for connection state.

Latency Reference Numbers

OperationTime
L1 cache hit1 ns
L2 cache hit4 ns
Main memory100 ns
SSD random read100 us
HDD seek10 ms
Same datacenter round trip500 us
Cross-region round trip50-150 ms

Memory access is approximately 100,000x faster than HDD seeks.

Throughput Reference Numbers

ResourceThroughput
SSD sequential read500 MB/s
HDD sequential read100 MB/s
1 Gbps network125 MB/s
10 Gbps network1.25 GB/s
Single Redis instance100K ops/s
Single MySQL (simple queries)1-10K QPS
Single web server1-10K req/s

Estimation Shortcuts

ConversionFormula
Daily to per-secondDivide by 100,000
Monthly to per-secondDivide by 2.5 million
Peak multiplier2-5x average (3x default)
Storage bufferAdd 20-30% for indexes, metadata, replication

Common Errors

  1. Missing peak load calculations - Systems must handle traffic spikes
  2. Ignoring replication - 3x replication requires 3x storage
  3. Missing metadata overhead - Indexes, timestamps, and IDs add storage
  4. Unit confusion - Verify bytes vs bits, seconds vs milliseconds
  5. Over-precision - Approximate values (e.g., "~50 GB") are appropriate for estimation