Back-of-the-Envelope Estimation
Quick, rough math for traffic, storage and bandwidth that tells you which parts of a design will strain.
What is it?
Before choosing a database or adding a cache, you need a feel for the size of the problem. Is it 10 requests per second or 100,000? 1 GB of data or 1 PB? These numbers decide the design: one Postgres box handles the first; the second needs sharding.
Back-of-the-envelope estimation is quick, rounded math to get the order of magnitude right. You don't need exact answers. You need to know whether something fits on one machine, in memory, or in a single network link. Round aggressively (a day is about 100,000 seconds), state your assumptions out loud, and sanity-check the result.
Explain like I'm 10
Before a road trip, you don't calculate fuel to the millilitre. You think: 'about 600 km, the car does about 15 km per litre, so about 40 litres; one tank is 50, so no refuel stop needed.' Good enough to make the decision.
Examples
Worked example: a photo-sharing app
Assumptions
100M daily active users (DAU)
Each user views 50 photos/day, uploads 0.1 photos/day
Average photo: 500 KB (after compression)
Keep photos for 10 years
Requests per second (1 day ≈ 86,400 s ≈ 10^5 s)
Reads: 100M × 50 / 10^5 = 5×10^9 / 10^5 = 50,000 QPS
Writes: 100M × 0.1 / 10^5 = 10^7 / 10^5 = 100 QPS
Peak ≈ 2–3× average → ~150,000 read QPS, ~300 write QPS
Read:write ratio ≈ 500:1 → read-heavy: cache + CDN
Storage
New per day: 10M photos × 500 KB = 5 TB/day
Per year: 5 TB × 365 ≈ 1.8 PB/year
10 years: ≈ 18 PB (×3 replicas ≈ 55 PB raw) → object storage
Bandwidth
Egress: 50,000 views/s × 500 KB = 25 GB/s ≈ 200 Gbps → must be a CDN
Ingress: 100 uploads/s × 500 KB = 50 MB/s ≈ 400 MbpsHandy conversions as code
const SECONDS_PER_DAY = 86_400; // round to 1e5 in your head
function averageQps(dailyActiveUsers: number, actionsPerUserPerDay: number) {
return (dailyActiveUsers * actionsPerUserPerDay) / SECONDS_PER_DAY;
}
function bytesPerSecondToGbps(bytesPerSecond: number) {
return (bytesPerSecond * 8) / 1e9;
}
averageQps(10_000_000, 20); // ≈ 2,315 QPS
bytesPerSecondToGbps(2_315 * 20_000); // 20 KB responses ≈ 0.37 GbpsHow it works
1. Powers of two (data sizes) - 2^10 ≈ 1 thousand → KB - 2^20 ≈ 1 million → MB - 2^30 ≈ 1 billion → GB - 2^40 ≈ 1 trillion → TB - 2^50 → PB - Handy sizes: a char ≈ 1 byte (ASCII), an int ≈ 4 bytes, a long or timestamp ≈ 8 bytes, a UUID = 16 bytes (36 as text), a tweet-sized row ≈ a few hundred bytes, a compressed photo ≈ hundreds of KB, a minute of HD video ≈ tens of MB.
2. Latency numbers every engineer should know (classic figures popularised by Jeff Dean and Peter Norvig; exact values vary by hardware, but the ratios are what matter): - L1 cache reference: ~1 ns - Main memory reference: ~100 ns - Compress 1 KB (fast codec): ~2–3 µs - Read 4 KB randomly from SSD: ~16–150 µs - Read 1 MB sequentially from memory: ~10–250 µs - Round trip within a datacenter: ~0.5 ms - Read 1 MB sequentially from SSD: ~0.05–1 ms - Disk (HDD) seek: ~10 ms - Read 1 MB sequentially from HDD: ~5–20 ms - Round trip California ↔ Netherlands: ~150 ms
Takeaways: memory is ~1,000× faster than a network hop, disk seeks are slow, cross-continent round trips are very slow, and sequential reads beat random ones.
3. Rates - 1 day ≈ 10^5 seconds, 1 month ≈ 2.5 × 10^6 s, 1 year ≈ 3 × 10^7 s. - 1 million per day ≈ 12/s; 1 billion per day ≈ 12,000/s. - Peak traffic ≈ 2–10× average depending on the product.
4. Rough machine capacity (orders of magnitude, workload-dependent) - A single app server: hundreds to a few thousand simple requests/s. - A well-tuned relational DB on one node: thousands to tens of thousands of simple queries/s. - An in-memory cache node (Redis): on the order of 100,000 ops/s. - A server NIC: 10–25 Gbps is common; 1 Gbps ≈ 125 MB/s.
The method: write down assumptions → compute QPS (average and peak) → storage (per item × items per day × retention × replication) → bandwidth (QPS × payload size × 8) → compare against capacity → note what each number implies for the design.
Why does it exist?
Design choices are driven by scale. Without numbers, people either over-engineer (sharding a database that would fit in RAM) or under-engineer (a single server for 200 Gbps of traffic). A few minutes of rough math catches both, and it gives you a shared, checkable basis for decisions.
When to use it
At the start of any design, in capacity planning, when reviewing a proposal ("will this fit in one Redis?"), when estimating cloud cost, and early in a system design interview, right after requirements.
When not to use it
It doesn't replace load testing or production metrics. Once the system exists, measure. And don't spend half an interview on precise arithmetic: get the order of magnitude, say what it implies, and move on.
Common mistakes
Designing for average traffic and forgetting peak (often 2–10× higher) and growth.
Mixing up bits and bytes: network links are quoted in bits per second, storage in bytes. Multiply by 8.
Forgetting replication, indexes and backups, which can multiply raw storage by 3× or more.
Doing precise arithmetic (86,400 × 37) instead of rounding (10^5 × 40) and losing time and clarity.
Producing numbers and never saying what they mean for the design (e.g. '50k read QPS, so we need a cache').
Practice exercises
- Easy:
A service gets 500 million requests per day. Estimate average QPS and a plausible peak QPS.
- Medium:
Estimate storage for a chat app with 50M DAU sending 40 messages a day, 200 bytes each, kept for 5 years with 3× replication.
- Hard:
Estimate the egress bandwidth and number of edge servers a video platform needs if 10M concurrent viewers watch at 5 Mbps, and each edge server can push 40 Gbps. What does this tell you about the design?
Interview questions
Why do back-of-the-envelope estimates in a design discussion?
To get the order of magnitude of traffic, storage and bandwidth, which decides the architecture: whether data fits on one machine or in memory, whether you need a cache, a CDN or sharding.
How do you convert daily requests into QPS quickly?
Divide by about 10^5 (seconds in a day, 86,400). So 1M/day ≈ 12 QPS and 1B/day ≈ 12,000 QPS. Then multiply by a peak factor of 2–10×.
Roughly how much slower is a datacenter network round trip than a main memory read?
About 5,000×: ~100 ns for memory versus ~0.5 ms for a round trip within a datacenter. That's why caching in process memory, and batching network calls, matter.
What is 2^30 bytes, and why do powers of two matter?
About 1 GB (a billion bytes). Powers of two map quickly to KB/MB/GB/TB/PB (2^10, 2^20, 2^30, 2^40, 2^50), which makes size math fast.
A service returns 100 KB responses at 20,000 QPS. What bandwidth does it need?
20,000 × 100 KB = 2 GB/s, × 8 = 16 Gbps. That's more than one typical server NIC, so you'd spread it across machines or put a CDN in front.
How do you estimate storage for a system?
Size per item × items per day × days of retention × replication factor, plus overhead for indexes and metadata. Then check whether it fits on one node or needs sharding or object storage.
Why do you need to distinguish read and write QPS?
They scale differently. Reads can be absorbed by caches, CDNs and replicas; writes must reach the primary store, so write-heavy systems need partitioning or queues instead.
Why is sequential disk I/O so much faster than random I/O, and how does that influence design?
Random reads pay a seek (≈10 ms on HDD) or per-request overhead (SSD) for each block, while sequential reads stream. Designs like log-structured storage, append-only logs and batch writes exploit that.
Your estimate shows 3 TB of hot data that needs sub-millisecond reads. What does that imply?
It won't fit in one machine's RAM cheaply, so you'd shard an in-memory cache across nodes (e.g. ~30 nodes with 128 GB usable each, plus replicas) or decide which subset is actually hot and cache only that.
How would you sanity-check an estimate?
Compare with known reference points (a single Postgres can do thousands of QPS; a 10 Gbps NIC moves ~1.25 GB/s), check units (bits vs bytes, per day vs per second), and see whether the result agrees with any real product numbers you know.