Skip to content
learn
  1. Learn
  2. High Level System Design
  3. Core Concepts and Back-of-the-Envelope Math

System Design HLD-02.04

Back-of-the-envelope estimation

Turn daily users into requests per second, storage, bandwidth and server counts in a few lines of arithmetic, and sanity-check the answer.

Beginner 18 min Last reviewed

The big idea

"Will one database be enough?" is impossible to answer by staring at a diagram, and easy to answer with five minutes of arithmetic. Back-of-the-envelope estimationRough calculations, done quickly with rounded numbers, that give the right order of magnitude for traffic, storage, bandwidth or machines. turns a vague sense of scale ("lots of users") into concrete numbers: requests per second, terabytes, servers. Those numbers decide the design. A thousand writes per second fits on one database; a million does not.

The goal is the right order of magnitude, not precision. Being within a factor of two or three is fine, because the decisions you make, one machine or ten, cache or no cache, shard or not, change at factors of ten. Round aggressively and keep the arithmetic easy enough to do out loud.

Think of planning a party. You do not need the exact guest count to know whether you need one pizza or fifty. "About 40 people, 3 slices each, 8 slices a pizza, about 15 pizzas" is the whole skill.

How it works

Step 1: Know your units

Data sizes go up by about a thousand each step:

Data size units from kilobyte to petabyte A log-scale ladder: a kilobyte is ten to the third bytes, a short text post; a megabyte ten to the sixth, a photo; a gigabyte ten to the ninth, an hour of HD video; a terabyte ten to the twelfth, one large disk; a petabyte ten to the fifteenth, a big company's data warehouse. bytesfeels like 1 KB (kilobyte) 10^3 a short text post or JSON record 1 MB (megabyte) 10^6 a photo 1 GB (gigabyte) 10^9 an hour of HD video 1 TB (terabyte) 10^12 one large disk 1 PB (petabyte) 10^15 a big company's data warehouse Figure 1. Each unit is about 1,000 times the last. Powers of two (1 KiB = 1,024 bytes) differ by a few percent, which never matters for an estimate.

Two time facts do most of the work. A day has 86,400 seconds; round it to 100,000 (10^5) and dividing becomes easy. A year has about 365 days, so roughly 3 x 10^7 seconds.

Step 2: Follow the funnel

Every estimate follows the same chain, from users to machines:

The estimation funnel from users to servers Five stages left to right: daily active users, actions per day, requests per second average and peak, storage, and number of servers. Each feeds the next. Daily users 200 M Actions / day x 2 writes, x 100 reads QPS / 10^5 s, x 3 peak Storage x size x days Servers peak / per-server Figure 2. Start from users and their behavior, derive request rates, then storage and machines. Each arrow is one multiplication or division.
  1. Requests per day = daily active users x actions per user per day. Split reads and writes; they scale differently.
  2. Average QPS = requests per day / 100,000.
  3. Peak QPS = average x 2 to 10. Traffic is not flat: evenings, events and launches spike. Use 3 when you have no better information.
  4. Storage = writes per day x bytes per write x days kept. Add replication (often x 3) when sizing disks.
  5. Bandwidth = QPS x bytes per response.
  6. Servers = peak QPS / what one server handles. A simple API server might handle thousands of requests per second; a heavy one, hundreds.

Step 3: A worked example

A Twitter-like service: 200 million daily users, each posting 2 times and reading their timeline 100 times a day, about 1 KB per post, kept for 5 years.

estimate.pyruns with python3 + numpy
# Back-of-the-envelope for a Twitter-like service
DAU = 200e6                 # daily active users
posts_per_user = 2          # writes per user per day
reads_per_user = 100        # timeline reads per user per day
post_bytes = 1_000          # text + metadata, about 1 KB
SECONDS_PER_DAY = 100_000   # 86,400 rounded for easy math

write_qps = DAU * posts_per_user / SECONDS_PER_DAY
read_qps = DAU * reads_per_user / SECONDS_PER_DAY
peak_qps = 3 * (write_qps + read_qps)
storage_5y = DAU * posts_per_user * post_bytes * 365 * 5

print(f"write QPS     {write_qps:>12,.0f}")
print(f"read QPS      {read_qps:>12,.0f}")
print(f"peak QPS (x3) {peak_qps:>12,.0f}")
print(f"storage, 5 y  {storage_5y / 1e12:>12,.0f} TB")
print(f"app servers at 5,000 QPS each: {peak_qps / 5_000:,.0f}")

Output

write QPS            4,000
read QPS           200,000
peak QPS (x3)      612,000
storage, 5 y           730 TB
app servers at 5,000 QPS each: 122

Now read the numbers like a designer:

  • 4,000 writes per second fits on a single well-tuned database. Writes are not the problem.
  • 200,000 reads per second is not something one database should serve. Reads must come from caches and replicas, and timelines are likely precomputed. The 50 : 1 read to write ratio is the key design fact.
  • 730 TB of posts (before replication) is far more than one machine holds, so the data must be partitioned across many.
  • About 120 app servers at peak, if each handles 5,000 requests per second, which is a fleet, not a cluster you name by hand.

Four numbers, and the outline of the architecture is already clear: cache-heavy reads, sharded storage, a large stateless app tier.

Step 4: Sanity-check the answer

Before trusting a number, compare it with something you know. 730 TB in 5 years is about 400 GB a day: plausible for text from hundreds of millions of people. 200,000 QPS is in the range large consumer services report. If a calculation said a chat app needs 3 servers or 3 million, recheck the units: a factor of 1,000 error usually means KB and MB were mixed up.

Try it

This interactive needs JavaScript. The diagrams and text above cover the same idea.

Try this:

  1. Press Twitter-like and check the numbers match the worked example.
  2. Press WhatsApp-like. Reads and writes are nearly equal: messaging is write-heavy, so the design focuses on write throughput and delivery, not caching.
  3. Press YouTube-like. Uploads per user are tiny, but each one is enormous. Storage dominates everything: this is why video platforms are mostly storage and CDN problems.

Going deeper

Cache sizing with the 80/20 rule

Access is usually skewed: a small share of items gets most of the reads. A common starting assumption is that caching the hottest 20 percent of a day's data serves most reads. For the example: 400 million posts a day x 1 KB x 20 percent is about 80 GB, which fits in the memory of a handful of cache servers. Caching is covered in Why caching works .

Say your assumptions out loud

In interviews and design documents, the assumptions matter more than the arithmetic. "I assume 2 posts per user per day and a peak factor of 3" lets others correct an input instead of distrusting the whole result. The interview framework in A repeatable framework builds on this.

Trade-offs

OptionWins whenLoses when
Quick order-of-magnitude estimate Early design and interviews: decides cache, shard, fleet size in minutes Capacity purchases and launch planning, which need load tests and real data
Detailed capacity model Budgets, hardware orders and launch readiness Early exploration, where the inputs are guesses anyway
Load testing Finding the real per-server limit and the true bottleneck Deciding between designs you have not built yet

Common mistakes

  • Forgetting the peak. Average traffic hides the evening spike that actually takes you down.
  • Mixing units, especially bits and bytes (network links are quoted in bits per second) and KB versus MB.
  • Lumping reads and writes together. Their ratio drives the architecture.
  • Chasing precision. Spending ten minutes on the third significant digit wastes the point of estimating.
  • Forgetting replication and indexes when sizing storage; real disk use is often 3 or more times the raw data.

Check yourself

  1. A service has 10 million daily users, each making 50 requests a day. Roughly what is the average QPS?

    Show answer

    B. About 5,000 10^7 x 50 = 5 x 10^8 requests a day; divided by 10^5 seconds gives about 5,000 per second.

  2. Users upload 1 million photos a day at 2 MB each, kept forever. About how much new storage per year, before replication?

    Show answer

    B. About 730 TB 2 TB a day x 365 is about 730 TB a year.

  3. Average QPS is 20,000. What peak should you plan for if you know nothing else?

    Show answer

    B. About 60,000 Plan for a peak several times the average; 3x is a common default.

  4. Reads are 100 times more frequent than writes. What does that suggest?

    Show answer

    B. Invest in caching and read replicas Read-heavy workloads benefit most from serving repeated reads from caches and replicas.

Recap

  • Aim for the right order of magnitude, with rounded numbers you can say out loud.
  • A day is about 10^5 seconds; a year about 3 x 10^7.
  • Users x actions / 10^5 = average QPS; plan for a peak about 3 times higher.
  • Storage = writes per day x size x days, then multiply for replication.
  • The read to write ratio and total storage usually decide the architecture.

Get new lessons by email

Get new posts on backend and AI internals. No spam, unsubscribe anytime.

Your email is only used to send new posts. Privacy

Next up