Chapter 06 of 33

Back-of-the-Envelope Estimation

Before an engineer draws a single box on the whiteboard, they need a feel for the size of the problem. Is this a system that handles 10 requests per second or 100,000? Does it store a few gigabytes or several petabytes? The answers decide almost everything else: whether one database is enough, whether you need a cache, whether you need a CDN, and how many servers to buy.

The quick, rough calculation that answers these questions is called back-of-the-envelope estimation (the name comes from doing the maths on the back of an envelope, not in a spreadsheet). In the previous chapter, Latency, Throughput & Availability, we learned what these metrics mean. In this chapter we learn to put numbers on them, fast and with confidence.

Back-of-the-envelope estimation is a quick calculation, using simple assumptions and rounded numbers, that gives the order of magnitude of a system's traffic, storage, bandwidth and server needs.

The goal is not an exact answer. The goal is to be right to within a factor of about 2 to 10, so that you make the right design decision. "We need about 50 servers" and "we need about 60 servers" lead to the same design. "We need 5 servers" and "we need 5,000 servers" do not.


Why Estimation Matters

  • It drives the design. A read rate of 50 QPS fits on one small database. A read rate of 500,000 QPS needs caching, replicas and probably sharding.

  • It exposes the bottleneck. Often the shocking number is not QPS but bandwidth or storage. A photo app may have modest QPS but need hundreds of Gbps of outgoing bandwidth.

  • It is expected in interviews. In the chapter How to Approach a System Design Interview we saw that estimation comes right after clarifying requirements. Interviewers watch how you reason: stating assumptions, rounding sensibly, and checking units.

  • It is used in real work. Capacity planning, cloud cost estimates and "will this feature melt the database?" questions are all back-of-the-envelope maths.


The Toolkit: Numbers to Remember

1. Powers of Ten and Powers of Two

Storage is measured in bytes, and the unit names map to powers of ten (SI) or powers of two (binary). For estimation, treat them as the same; the difference is under 13% even at the petabyte level.

Unit

Power of 10

Power of 2

Roughly

Kilobyte (KB)

103

210 = 1,024

a thousand

Megabyte (MB)

106

220

a million

Gigabyte (GB)

109

230

a billion

Terabyte (TB)

1012

240

a trillion

Petabyte (PB)

1015

250

a quadrillion

Strictly, the binary units are called KiB, MiB, GiB and so on. In interviews nobody minds if you use 1 KB = 1,000 bytes, as long as you are consistent.

A very useful habit is to multiply by thinking in exponents:

1 million users × 1 KB each  = 10^6 × 10^3 bytes = 10^9 bytes  = 1 GB
10 million items × 2 MB each = 10^7 × (2 × 10^6)  = 2 × 10^13   = 20 TB
1 billion rows × 500 bytes   = 10^9 × 500         = 5 × 10^11   = 500 GB

2. Time Conversions

Period

Exact seconds

Estimation shortcut

1 day

86,400

≈ 105 (about 16% high)

1 month (30 days)

2,592,000

≈ 2.5 × 106

1 year (365 days)

31,536,000

≈ 3 × 107

The single most useful conversion in this whole chapter:

1 million requests per day ≈ 12 requests per second (exactly 1,000,000 / 86,400 = 11.6).

From that one fact you can scale: 100 million/day ≈ 1,200 QPS; 1 billion/day ≈ 12,000 QPS.

3. Rough Latency Numbers

We met these in Latency, Throughput & Availability; here is a quick recap. They are orders of magnitude on typical modern hardware, not exact values. Hardware varies, but the ratios between them are what matter.

Operation

Rough time

CPU L1 cache reference

~1 ns

Main memory (RAM) reference

~100 ns

SSD random read (4 KB)

~10 to 100 µs

Round trip inside one data centre

~0.5 ms

Hard disk seek

~5 to 10 ms

Round trip Mumbai ↔ US West Coast

~200 to 250 ms

Three lessons fall out of this table, and they appear again and again in later chapters:

  • Memory is roughly 100 to 1,000 times faster than an SSD random read (and 50,000 to 100,000 times faster than a hard-disk seek). That is why keeping hot data in memory, which we will call caching later in this course, works so well.

  • Disk seeks are slow, so databases prefer sequential I/O.

  • Crossing continents costs hundreds of milliseconds no matter how fast the servers are. That is why we put copies of content close to users with CDNs (the next chapter) and run servers in multiple regions.

4. Typical Capacity Assumptions

When an interviewer does not give these, state a reasonable value and move on:

  • One stateless web/app server: a few hundred to a few thousand QPS (depends heavily on the work per request). Using 1,000 QPS is a common, defensible assumption.

  • One relational database node: thousands of simple queries per second; far less for heavy joins.

  • One in-memory cache node (like Redis): on the order of 100,000 simple operations per second.

  • Peak traffic: typically 2 to 3 times the daily average (higher for event-driven apps like ticket sales or cricket score updates).


The Standard Estimation Recipe

Almost every estimate follows the same five steps:

  1. Users: start from Daily Active Users (DAU). If given Monthly Active Users (MAU), assume DAU is some fraction (often 20% to 50%).

  2. Traffic (QPS): actions per user per day × DAU ÷ 86,400. Do reads and writes separately. Multiply by a peak factor.

  3. Storage: new items per day × size per item. Multiply by retention period and replication factor.

  4. Bandwidth: QPS × size per request (or response). Convert bytes/s to bits/s (× 8) when comparing with network links.

  5. Memory / servers: cache size from the "hot" fraction of data; server count = peak QPS ÷ per-server capacity.

The core formulas:

QPS (average)  = DAU × actions per user per day / 86,400
QPS (peak)     = QPS (average) × peak factor
Storage        = items per day × size per item × days retained × replicas
Bandwidth      = QPS × bytes per request
Servers        = peak QPS / QPS one server can handle   (round up, add headroom)
In-flight      = QPS × average time per request          (Little's Law)

The last line is Little's Law, which we met in Latency, Throughput & Availability: the average number of requests in the system equals the arrival rate times the average time each one spends there. It tells you how many concurrent connections, threads or database connections you need.


Worked Example 1: A Photo-Sharing App

Let's estimate an Instagram-style app. First, write down the assumptions clearly. In an interview, say them out loud.

Assumptions
-----------
Daily active users (DAU)        : 50 million
Photos uploaded per user per day: 0.2   (1 in 5 users uploads one photo)
Photos viewed per user per day  : 30
Average photo size              : 2 MB
Metadata per photo              : 500 bytes (id, owner, caption, time, location...)
Peak factor                     : 3
Replication factor              : 3
Retention                       : 5 years

Step 1: Traffic

Uploads per day = 50M × 0.2 = 10 million
Views per day   = 50M × 30  = 1.5 billion

Write QPS (avg) = 10,000,000 / 86,400    ≈ 116
Write QPS (peak)= 116 × 3                ≈ 350

Read QPS (avg)  = 1,500,000,000 / 86,400 ≈ 17,400
Read QPS (peak) = 17,400 × 3             ≈ 52,000

Read : write ratio = 1.5 billion / 10 million = 150 : 1

What this tells us: the system is extremely read-heavy. Design effort should go into the read path: caching, read replicas and a CDN.

Step 2: Storage

Photo storage per day  = 10M × 2 MB      = 20 TB/day
Photo storage per year = 20 TB × 365     = 7.3 PB/year
5 years, one copy      = 7.3 PB × 5      = 36.5 PB
5 years, 3 replicas    = 36.5 PB × 3     ≈ 110 PB

Metadata per day       = 10M × 500 bytes = 5 GB/day
Metadata, 5 years      = 5 GB × 1,825    ≈ 9 TB (before replication)

What this tells us: photos (blobs) and metadata live in completely different worlds. 110 PB of photos needs an object store (covered in Object Storage & File Storage), while 9 TB of metadata fits comfortably in a sharded database or even a few large database servers.

Step 3: Bandwidth

Ingress (uploads) = 20 TB/day / 86,400 s ≈ 231 MB/s ≈ 1.85 Gbps

Egress (views, full-size photos)
                  = 17,400 QPS × 2 MB    ≈ 34.7 GB/s ≈ 278 Gbps   (average!)

278 Gbps on average (and roughly 3 times that at peak) is enormous. Two design ideas follow immediately:

  • Serve smaller versions. A feed thumbnail of 200 KB instead of the 2 MB original cuts egress by 10×, to about 27.8 Gbps.

  • Serve from a CDN. Most views hit popular photos, so edge servers close to users can serve them without touching our origin.

Step 4: Cache Memory

A common rule of thumb is the 80/20 rule: about 20% of the items get about 80% of the traffic. So caching the hottest 20% of each day's data catches most reads.

Metadata read per day = 1.5 billion views × 500 bytes = 750 GB
Cache 20% of that     = 0.2 × 750 GB                 = 150 GB

150 GB of RAM is a handful of cache nodes. Very affordable.

Step 5: Servers

Peak total QPS = (17,361 + 116) × 3 ≈ 52,400
Assume one app server handles ~1,000 QPS
Servers = 52,400 / 1,000 ≈ 53  → plan for ~60-70 with headroom and failures

Little's Law: if each request takes 200 ms,
In-flight requests = 52,400 × 0.2 ≈ 10,500 concurrent requests

Notice how the answer changes the conversation: the hard parts are 110 PB of storage and hundreds of Gbps of egress, not the QPS.

Verifying the Arithmetic with a Script

In real work, it is worth checking the maths with a few lines of code. Here is a Python version of the calculation above.

SECONDS_PER_DAY = 86_400

def human(n):
    for unit in ["B", "KB", "MB", "GB", "TB", "PB"]:
        if n < 1000:
            return f"{n:.2f} {unit}"
        n /= 1000
    return f"{n:.2f} EB"

DAU, UPLOADS, VIEWS = 50_000_000, 0.2, 30
PHOTO, PEAK, REPLICAS, YEARS = 2_000_000, 3, 3, 5

uploads_day = DAU * UPLOADS
views_day = DAU * VIEWS
write_qps = uploads_day / SECONDS_PER_DAY
read_qps = views_day / SECONDS_PER_DAY

print(f"Write QPS avg/peak : {write_qps:,.1f} / {write_qps * PEAK:,.1f}")
print(f"Read QPS avg/peak  : {read_qps:,.1f} / {read_qps * PEAK:,.1f}")
per_day = uploads_day * PHOTO
print("Storage per day    :", human(per_day))
print("5 years x 3 copies :", human(per_day * 365 * YEARS * REPLICAS))
egress = read_qps * PHOTO
print("Egress             :", human(egress) + "/s", f"= {egress * 8 / 1e9:.1f} Gbps")

Output:

Write QPS avg/peak : 115.7 / 347.2
Read QPS avg/peak  : 17,361.1 / 52,083.3
Storage per day    : 20.00 TB
5 years x 3 copies : 109.50 PB
Egress             : 34.72 GB/s = 277.8 Gbps

Worked Example 2: A Text Post Service

Now a Twitter-style service where posts are mostly short text.

Assumptions
-----------
DAU                       : 200 million
Posts per user per day    : 2
Size of a post + metadata : 300 bytes
Posts with media          : 10%, average 1 MB each
Posts read per user / day : 100
Peak factor               : 2

Write QPS = 200M × 2 / 86,400       ≈ 4,630
Read QPS  = 200M × 100 / 86,400     ≈ 231,000   (peak ≈ 463,000)

Text storage per day  = 400M × 300 B        = 120 GB/day ≈ 44 TB/year
Media storage per day = 400M × 0.10 × 1 MB  = 40 TB/day

Again the lesson repeats: text is cheap, media is expensive. The text data for a whole year (about 44 TB) is smaller than one day of media (40 TB). And the read QPS of nearly half a million at peak tells you this design will lean heavily on caching. The full design is in the chapter Design a News Feed.


Estimating Cleverly: Rounding Tricks

  • Round early, round to friendly numbers. 86,400 → 105; 365 → 400 (or keep 365 for storage); 17,361 → 17,000.

  • Keep track of which direction you rounded. Using 105 seconds per day gives a QPS about 14% lower than the exact value. That is fine, but say so.

  • Work in exponents. 5 × 107 users × 30 views = 1.5 × 109 views. Divide by 105: 1.5 × 104 = 15,000 QPS. (Exact: 17,361. Close enough.)

  • Sanity-check against reality. If you estimate that a college notice board needs 50 PB, something went wrong (probably a unit).


Bytes vs Bits: The Bandwidth Trap

Storage and file sizes are in bytes (B). Network links are rated in bits per second (bps). 1 byte = 8 bits.

231 MB/s  × 8 = 1,848 Mbps ≈ 1.85 Gbps
34.7 GB/s × 8 = 278 Gbps

A 10 Gbps network card can move at most about 1.25 GB/s. Forgetting the ×8 makes your bandwidth estimate 8 times too small, which is one of the most common estimation mistakes.


Read-Heavy vs Write-Heavy: What the Ratio Tells You

Pattern

Example

Design focus

Read-heavy (100:1 or more)

Photo app, news site, URL shortener

Caching, CDN, read replicas

Balanced

Chat messages (each message written once, read by a few people)

Efficient writes and fan-out, partitioning

Write-heavy

Logging, metrics, IoT sensor data, ride location updates

Append-friendly storage, queues, batching, sharding


Common Mistakes

  • Forgetting the peak. Average QPS is not what breaks systems; peak QPS does. Always apply a peak factor.

  • Mixing bytes and bits. Multiply by 8 when going from MB/s to Mbps.

  • Ignoring replication. Storing 3 copies means 3 times the disk. Add backups too if they matter.

  • Over-precision. Writing "17,361.11 QPS" wastes time. "About 17,000" is the right answer.

  • Silent assumptions. If you assume 2 MB per photo, say it. Interviewers grade the reasoning, not the final digit.

  • Estimating everything. Only estimate what affects the design. If storage is tiny, say "storage is negligible" and move on.

  • Treating metadata and blobs together. They have very different sizes and very different storage systems.


Interview Questions

1. A service receives 500 million requests per day. What is its average QPS? What would you plan for at peak?

500,000,000 / 86,400 ≈ 5,800 QPS on average. With a peak factor of 2 to 3, plan for roughly 12,000 to 17,000 QPS. (Quick method: 500M / 105 = 5,000, slightly low.)

2. 10 million new users sign up per month, each with a 2 KB profile. How much profile storage do you need for 3 years with 3 replicas?

Users after 3 years = 10M × 36 = 360 million. Storage = 360M × 2 KB = 720 GB. With 3 replicas ≈ 2.16 TB. Small enough for a modest database cluster.

3. A video service streams 1 million concurrent videos at an average of 5 Mbps each. What is the total egress?

1,000,000 × 5 Mbps = 5,000,000 Mbps = 5 Tbps. This is why video platforms serve almost everything from CDNs and caches inside ISP networks.

4. A system handles 20,000 QPS and each request takes 50 ms on average. How many requests are in progress at any moment?

By Little's Law, in-flight = 20,000 × 0.05 = 1,000 requests. So you need enough threads/connections across the fleet to hold about 1,000 concurrent requests, plus headroom.

5. Why is it acceptable to approximate 86,400 seconds per day as 100,000?

Because estimation aims for the right order of magnitude. The approximation introduces about a 14% error in QPS, which does not change any design decision. It makes mental division far easier.

6. Your estimate shows read QPS is 200 times write QPS. What design choices does that suggest?

A strongly read-heavy system benefits from caching (application cache and CDN), read replicas of the database, and possibly precomputing results so reads are cheap. Writes are rare, so a slightly slower write path (for example, updating caches on write) is acceptable.


Summary

  • Back-of-the-envelope estimation gives the order of magnitude of traffic, storage, bandwidth and servers so you can choose the right design.

  • Key facts: 1 day = 86,400 s ≈ 105 s; 1 million/day ≈ 12 QPS; KB/MB/GB/TB/PB step by 1,000.

  • Recipe: DAU → QPS (reads and writes, with peak) → storage (× retention × replicas) → bandwidth (× 8 for bits) → cache and servers.

  • Little's Law: in-flight requests = QPS × time per request.

  • State every assumption, round aggressively, and check units.

  • Estimates often reveal the true bottleneck: for media apps it is storage and egress bandwidth, which leads directly to object stores and CDNs.

Estimate first, design second: the numbers tell you which problems are worth solving.