Part 2 · System Design Core Concepts

Back-of-the-Envelope Estimation, Step by Step

Five minutes of rough maths tells you whether you need one database or fifty. The numbers worth memorising, a seven-step recipe, and a full worked estimate for a photo-sharing app — with a calculator to try your own.

Lesson 1012 min readbeginner#estimation#interview

On this page

  1. The Problem
  2. The Core Idea
  3. How It Works
  4. Trade-offs
  5. In the Real World
  6. Interview Questions
  7. Key Takeaways
  8. Further Reading

The Problem

Someone asks: "We're building a photo-sharing app. Do we need one database or fifty? Will the photos fit on a few disks, or do we need petabytes of storage? How big should the cache be?"

You could guess. You could build it and find out, expensively. Or you could spend five minutes with rough maths and get answers that are close enough to make good decisions.

That's back-of-the-envelope estimation: quick, rough calculations (the kind you could do on the back of an envelope) that tell you the size of a problem. It's used in real design reviews, in capacity planning (working out how much hardware you will need), and in almost every system-design interview.

Three short terms come up all the time. QPS means "queries per second": how many requests hit your system each second. DAU means "daily active users": how many different people use the app on one day. Order of magnitude means the size of a number in powers of ten, such as 10, 1,000 or 1,000,000.

The Core Idea

Suppose you're planning food for a wedding. You don't count every grain of rice. You think: "About 500 guests, each eats about 200 g of rice, so 100 kg. Add 20% extra in case, so about 120 kg." That's close enough to order the right amount. It's clearly not 10 kg, and it's not 1,000 kg.

Estimation in system design works the same way:

  • Round aggressively. 86,400 seconds in a day becomes about 100,000.
  • Write down your assumptions. "Average photo is 2 MB."
  • Get the order of magnitude right. Is it 10, 1,000 or 1,000,000? Being off by 20% is fine. Being off by 100× is not.

How It Works

The numbers you need to remember

Powers of two (data sizes):

UnitApprox. bytesEasy way to remember
1 KB1,000 (really 1,024)A short text message or a small JSON object
1 MB1 millionA high-quality photo is a few MB
1 GB1 billionAbout an hour of standard-definition video
1 TB1 trillionA large laptop drive
1 PB1,000 TBBig-company territory

Handy shortcut: 2^10 ≈ 1,000, so 2^20 ≈ 1 million, 2^30 ≈ 1 billion, 2^40 ≈ 1 trillion.

Time conversions:

PeriodSecondsRounded
1 day86,400~100,000 (10^5)
1 month~2.6 million~2.5 million
1 year~31.5 million~30 million

So 1 million requests per day ≈ 12 requests per second on average. Remember that one; it's very useful.

Latency numbers (rough orders of magnitude):

OperationRough timeFeels like (if 1 ns = 1 second)
Read from CPU L1 cache~1 ns1 second
Read from main memory (RAM)~100 ns~2 minutes
Read 1 MB sequentially from RAM~50–100 µsabout 14 hours to 1 day
Random read from SSD~16–100 µshours to about a day
Round trip within one data centre~0.5 ms~6 days
Read 1 MB sequentially from SSD~0.1–1 msdays to ~2 weeks
Hard disk seek~2–10 ms~1–4 months
Round trip India ↔ US, or Europe ↔ US~100–250 ms~3–8 years

Latency is the time one operation takes, from start to finish. ns means nanosecond (one billionth of a second), µs means microsecond (one millionth) and ms means millisecond (one thousandth). A data centre is a building full of servers. Exact numbers change with hardware. What matters are the big lessons:

  • Memory is much faster than disk. That's why caches exist. A cache is a small, fast store that keeps a copy of data you read often, so you do not fetch it from the slow place each time.
  • SSDs are much faster than spinning disks, especially for random reads.
  • The network inside a data centre is fast. Across continents it's slow, and the speed of light won't improve.
  • Reading data sequentially is much faster than jumping around. Sequential means one piece after the next, in order. Random means jumping to different places.
  • Avoid unnecessary network round trips, especially long-distance ones.

Rough capacity anchors (very workload-dependent):

  • One well-tuned app server: roughly hundreds to a few thousand simple requests per second.
  • One relational database (a database that stores data in tables, such as PostgreSQL or MySQL) on good hardware: often thousands to tens of thousands of simple queries per second.
  • One Redis instance (Redis is a very fast database that keeps its data in memory; people often use it as a cache): often tens of thousands to 100,000+ simple operations per second.

Treat these as starting guesses, not facts. Real numbers depend heavily on what each request does, so measure your own system when it matters.

The estimation recipe

Most estimates follow the same steps:

  1. 1
    Users
    how many daily active users (DAU)?
  2. 2
    Actions
    reads and writes per user per day
  3. 3
    Traffic
    requests/day → average QPS → peak QPS
  4. 4
    Storage
    size per item × items per day × days kept (× copies)
  5. 5
    Bandwidth
    QPS × size of each response
  6. 6
    Memory / cache
    how much hot data to keep in RAM
  7. 7
    Servers
    peak QPS ÷ what one server handles, plus headroom
The estimation recipe. Every step feeds the next, and every step ends with “so the design needs…”. · flow

Average QPS is the number of requests per second over a whole day. Peak QPS is the number in the busiest moment. Two formulas do most of the work:

Text
Average QPS = requests per day ÷ 86,400   (≈ ÷ 100,000)Peak QPS    = average QPS × 2 to 10       (depends on how "spiky" traffic is)

A social app with an evening rush might use ×3. A ticket sale that opens at exactly 10:00 AM might need ×50 or more.

Worked example: a photo-sharing app

Let's estimate for an Instagram-like app. We write our assumptions first:

  • 10 million daily active users (DAU).
  • Each user views 50 photos per day.
  • 1 in 5 users uploads one photo per day (0.2 uploads per user).
  • Average original photo size: 2 MB.
  • Photos are shown in the feed as a resized ~200 KB version.
  • Each photo has about 1 KB of metadata (owner, caption, time, location).
  • Peak traffic = 3× average.
  • Keep photos forever. Plan for 5 years.

Step 1: Traffic (QPS)

Reads (photo views):

Text
10M users × 50 views = 500 million views/day500M ÷ 100,000 ≈ 5,000 reads/second (average)Peak ≈ 5,000 × 3 = 15,000 reads/second

(With the exact 86,400, it's about 5,800 average and 17,000 peak. Close enough.)

Writes (uploads):

Text
10M × 0.2 = 2 million uploads/day2M ÷ 100,000 = 20 uploads/second (average)Peak ≈ 60 uploads/second

Insight: the ratio is 250 reads for every write. This is a very read-heavy system, so we should design for fast reads. We use caching, CDNs and read replicas. A CDN (content delivery network) is a group of servers around the world that keep copies of files close to users. A read replica is a copy of a database that only answers read requests.

Step 2: Storage

Photos:

Text
2M uploads/day × 2 MB = 4 TB per day4 TB × 365 ≈ 1.5 PB per year5 years ≈ 7.5 PB

Plus resized versions (thumbnails and feed-size images), say another 20%, so about 9 PB over 5 years.

Insight: this is far too much for database servers, so photos go in object storage. Object storage (like Amazon S3) is a service that stores files as separate objects and scales to huge sizes. It also keeps several copies of your data so it is not lost (this is called durability). So we don't need to multiply by the replication factor ourselves here.

Metadata:

Text
2M photos/day × 1 KB = 2 GB per day× 365 ≈ 730 GB per year5 years ≈ 3.7 TB

Insight: metadata is small. A single well-configured relational database with replicas can hold this for years. To shard means to split one big database into smaller parts, each on its own server. We don't need to shard on day one, but we should plan for it.

Step 3: Bandwidth

Bandwidth is how much data moves through a network link each second. Gbps means gigabits per second. Outgoing data is also called egress. Outgoing (serving feed photos):

Text
500M views/day × 200 KB = 100 TB per day100 TB ÷ 86,400 s ≈ 1.2 GB per second ≈ ~10 Gbps averagePeak ≈ 30 Gbps

Incoming (uploads):

Text
4 TB/day ÷ 86,400 ≈ 46 MB/s ≈ ~0.4 Gbps average

Insight: ~10–30 Gbps of image traffic is a strong signal to use a CDN. You don't want all of that coming from your own servers. It also shows why resizing images matters. Serving the original 2 MB file instead of 200 KB would mean 10× more bandwidth and a much bigger bill.

Step 4: Cache (memory)

A common rule is the 80/20 rule: about 20% of the content gets 80% of the views. So let's cache metadata for the "hot" 20% of daily reads:

Text
500M reads/day × 1 KB metadata = 500 GB of metadata read per dayCache 20% ≈ 100 GB

Insight: 100 GB fits comfortably in a small Redis cluster, a few nodes with plenty of RAM. The photos themselves are cached by the CDN, not by Redis.

Step 5: Number of servers

Assume one app server can handle about 1,000 requests per second for these simple API calls:

Text
Peak 15,000–17,000 QPS ÷ 1,000 ≈ 15–17 serversAdd headroom (run ~60–70% busy) and room for one zone failing → ~25–30 servers

Insight: this is a horizontally scaled, stateless app tier (post 7). "Horizontally scaled" means we add more servers instead of buying a bigger one. "Stateless" means a server keeps no user data between requests, so any server can answer any request. Tens of servers is very manageable, so we don't need anything unusual.

The summary you'd write on a whiteboard:

WhatEstimateDesign impact
Read QPS (peak)~15–17kCache + CDN + read replicas
Write QPS (peak)~60A single primary DB is fine for writes
Photo storage~1.5 PB/yearObject storage, not a database
Metadata~730 GB/yearOne relational DB + replicas for now
Egress bandwidth~10–30 GbpsCDN is required; resize images
Cache~100 GBSmall Redis cluster
App servers~25–30Stateless, behind a load balancer

In about ten minutes, we've gone from "a photo app" to concrete decisions about storage type, CDN, cache size and server count.

read QPS (avg)
2.3 K
DAU × reads ÷ 86,400
write QPS (avg)
231
peak QPS (×3)
7.6 K
storage, 5 yr × 3 copies
219.0 TB
read bandwidth
37 Mbps
app servers
10
peak ÷ per-server, +30% headroom

Cache the hottest 20% of a day's reads: about 80.0 GB of RAM. Round every number — the goal is the right order of magnitude, not the exact figure.

Your own envelope. Move the sliders and watch every number — and the design it implies — change together. · interactive

Tips for good estimates

  • Write assumptions down and say them out loud. If someone says "users upload more like 1 photo a day", you just multiply by 5.
  • Round to easy numbers. 86,400 becomes 100,000; 2.6 million becomes 2.5 million. Your answer will be within about 20%, which is fine.
  • Use scientific notation for big numbers. 5 × 10^8 is easier to multiply than 500,000,000.
  • Keep units attached. Mixing up bits and bytes (Gbps vs GB/s) is a common 8× mistake: 1 byte is 8 bits, so 1 GB/s ≈ 8 Gbps.
  • Sanity-check the result. "10 PB for a small startup?" If it looks odd, recheck your assumptions.
  • Use estimates to make decisions, not to show off maths. Always finish with "so this means…".
  • Separate reads and writes. They usually lead to different design choices.
  • Don't forget peaks. Systems fail at peak, not on average.

Common mistakes

  • Using average QPS to size servers and forgetting peak traffic.
  • Forgetting that data accumulates over years.
  • Ignoring metadata vs media differences: one is small and structured, the other huge and unstructured.
  • Spending 20 minutes on precise arithmetic. Precision doesn't matter here; direction does.
  • Treating capacity anchors (like "1,000 requests per server") as facts instead of assumptions.
~100 K
seconds in a day
really 86,400
~12 QPS
per 1 M requests/day
average, before peaks
2¹⁰ ≈ 10³
KB → MB → GB → TB
each step ×1,000
×8
bytes → bits
1 GB/s ≈ 8 Gbps
~100 ns
RAM read
vs ~100 µs SSD, ~100+ ms across continents
×3
typical peak
×50 for a flash sale at 10:00 sharp
The anchors that make every estimate fast. · numbers

Trade-offs

  • Estimates are rough by design. They're great for choosing an architecture, but not for final hardware orders or budgets. For those, load-test the real system (send it fake traffic and watch how it copes).
  • Over-estimating leads to over-engineering and wasted money. Under-estimating leads to outages. When unsure, estimate a range ("between 10k and 30k QPS") and design for the high end of what's realistic in the next year or two.
  • Rules of thumb (80/20 caching, 3× peak) are starting points. Real traffic patterns can be very different, so replace assumptions with real metrics once you have them.

In the Real World

Capacity planning at big companies. Before big events (a festive-season sale, a product launch, a cricket final), engineering teams at e-commerce and streaming companies estimate expected peak traffic from past events and growth, then scale up and load-test ahead of time. It's this same estimation recipe, just done with real historical data.

Jeff Dean's latency numbers. Jeff Dean is a Google engineer. In talks about building large systems at Google, he shared a list of "latency numbers every programmer should know". People still share versions of that list today. Some interactive versions show how the numbers have changed over the years.

Cloud bills. Many startups have been surprised by large data transfer (egress) bills. A quick bandwidth estimate like the one above (10+ Gbps of images) would have shown early that a CDN and image resizing were needed, both for speed and for cost.

System design interviews. Almost every system-design interview at large tech companies includes a quick estimation step. Interviewers care less about the exact number and more about whether you state assumptions clearly, handle units correctly, and use the numbers to justify design choices.

Interview Questions

Q1Estimate the QPS for a service with 50 million DAU, each making 20 requests a day.

50 M × 20 = 1 billion requests a day. Divide by ~100,000 seconds: about 10,000 QPS on average (11,600 with the exact 86,400). With a 3× peak factor, plan for ~30,000–35,000 QPS.

Q2How do you estimate storage for five years?

Size per item × items per day × 365 × 5, then multiply by the replication factor if you store copies yourself (often 3), and add room for indexes and growth. Split media from metadata — they usually end up in different systems.

Q3Why separate reads and writes in an estimate?

They lead to different designs. A 250:1 read-heavy system wants caching, CDNs and read replicas; a write-heavy one wants partitioning, queues and write-optimised storage. A single “QPS” number hides that choice.

Q4What's a common unit mistake?

Mixing bits and bytes: network links are sold in bits per second, storage in bytes. 1 GB/s is about 8 Gbps, so confusing them is an 8× error. Also watch KB vs KiB, and per-day vs per-second.

Q5How precise should an estimate be?

Right to within a factor of two or so. The goal is the order of magnitude that drives a decision — one database or fifty, RAM or disk, CDN or not. State assumptions out loud and round aggressively instead of spending minutes on arithmetic.

Key Takeaways

  • Estimation gives you the order of magnitude fast. That's enough to choose an architecture.
  • Memorise a few anchors:
    • 1 day ≈ 100k seconds; 1M requests/day ≈ 12 QPS.
    • Memory is much faster than SSD, which is much faster than disk.
    • Cross-continent round trips take ~100+ ms.
  • Follow the recipe: users → actions → QPS (average and peak) → storage → bandwidth → cache → servers.
  • Write assumptions down, round aggressively, keep units straight, and always end with "so the design needs…".
  • Replace estimates with real measurements and load tests once the system exists.

Further Reading

  • System Design Interview: An Insider's Guide by Alex Xu (chapter 2, "Back-of-the-envelope Estimation")
  • The System Design Primer on GitHub (sections "Back-of-the-envelope calculations", "Powers of two table" and "Latency numbers every programmer should know")
  • The "napkin-math" project on GitHub by Simon Eskildsen (modern, benchmarked reference numbers)
  • Jeff Dean's talk "Designs, Lessons and Advice from Building Large Distributed Systems"

This wraps up Part 2. Next up, Part 3: The Building Blocks, starting with "Anatomy of a Request: From Browser to Database".

Published by Jainik · Last updated · How these lessons are made

Keep learning

Part of the study guide

Related series