Back-of-Envelope Estimation

📘 Chapter 1: Thinking in Systems ⏱️ 9 min read 📐 Lesson 3 of 4

Before diving into architecture, experienced engineers estimate. Not with spreadsheets and precise data — with napkin math. The goal isn't precision; it's knowing whether you need 1 server or 1,000, 1 GB of storage or 1 PB.

Why Estimation Matters

Estimation helps you:

  • Choose technologies: SQLite vs. distributed Cassandra cluster
  • Plan capacity: How many servers? How much storage?
  • Detect impossible requirements: "Store all user data in RAM" — is that even feasible?
  • Communicate: Give stakeholders rough timelines and cost estimates

Numbers Every Engineer Should Know

OperationLatencyNotes
L1 cache reference0.5 nsBlazing fast
L2 cache reference7 ns14× L1
RAM access100 nsMain memory
SSD random read150 μs1,500× RAM
HDD seek10 ms100,000× RAM
Send 1 KB over network (same DC)0.25 msDatacenter network
Read 1 MB from SSD1 msSequential
Read 1 MB from network10 ms~100 MB/s
Round trip within same datacenter0.5 ms
Round trip CA → Netherlands150 msSpeed of light limit

The Scale of Data

KB MB GB TB PB EB A text email ~5 KB A photo ~3 MB A movie (HD) ~5 GB 1M photos ~3 TB Netflix catalog ~15 PB Global internet /day ~5 EB ×1,000 ×1,000 ×1,000 ×1,000 ×1,000 10³ B 10⁶ B 10⁹ B 10¹² B 10¹⁵ B 10¹⁸ B
Fig 1. Data scale — each step is 1,000× bigger.

The Estimation Framework

Follow this step-by-step process for any system:

Step-by-Step Framework

  1. Total users → How many people use the product?
  2. Daily Active Users (DAU) → Typically 20-50% of total users
  3. QPS (Queries Per Second) → DAU × actions per user / 86,400 seconds
  4. Peak QPS → Usually 2-5× average QPS
  5. Storage → Size per object × objects per day × retention period
  6. Bandwidth → QPS × average response size

Real-World Example: YouTube Storage Estimation

Let's estimate storage for a YouTube-like video service:

Assumptions:
• 500 hours of video uploaded per minute
• Average video: 1080p, ~2.5 GB/hour after compression
• Keep 3 resolutions (1080p, 720p, 480p) ≈ 4.5 GB total/hour

Daily uploads:
  500 hours/min × 60 min × 24 hours = 720,000 hours/day

Daily storage:
  720,000 hours × 4.5 GB/hour = 3,240,000 GB = ~3.2 PB/day

Annual storage:
  3.2 PB × 365 = ~1,168 PB ≈ 1.2 EB/year

Bandwidth (serving):
  Assume 1B video views/day, avg 5 min at 720p (~300 MB/hour = 25 MB/5 min):
  1,000,000,000 × 25 MB = 25,000 PB = ~290 GB/s average

These numbers tell us: we need a distributed object storage system (like Google's Colossus), not a traditional filesystem. And we need a CDN — 290 GB/s can't come from one location.

Estimation Calculator

Input your assumptions and see derived capacity metrics: