Back-of-the-envelope estimation

Quick, rough maths to estimate traffic, storage and bandwidth, so your design decisions are based on scale.

Why it matters

Without numbers you can't tell whether one server is enough or you need a hundred. Estimation turns a vague 'big app' into numbers that decide the design.

The idea

You turn the number of users into requests per second (QPS), storage per day and per year, and bandwidth. Rough is fine. A day has 86,400 seconds, about 100,000, so 1 million requests a day is about 12 per second. Peak traffic is often 2–5 times the average.

Working out how much food to buy for a party: number of guests × how much each person eats, plus extra for the hungry ones (the peak).

Party guests are a fixed number. Real traffic has spikes, like a viral post or a sale, that can be 10 times normal or more, so you design for the peak, not the average.

How it works

  1. Start from users: daily active users × actions per user per day = actions per day.
  2. Divide by about 100,000 (the seconds in a day, rounded) to get the average per second, then multiply by 2–5 for the peak.
  3. Split reads and writes. Example: 10 million users each read 20 pages and post 1 item a day → 200 million reads (about 2,000 a second) and 10 million writes (about 100 a second).
  4. Storage: writes per day × size of each item × days kept. 10 million posts × 1 KB = 10 GB a day, about 3.6 TB a year, or about 11 TB with 3 copies.
  5. Bandwidth: requests per second × response size. 2,000 reads a second × 100 KB = 200 MB a second going out.
  6. Then decide: is that one database or many? Does the hot data fit in a cache's memory? Do we need a CDN?

Example

A Twitter-like app: 300 million daily users, each posting 2 tweets a day, gives 600 million tweets a day, about 7,000 writes per second on average and maybe 15,000–20,000 at peak. At about 300 bytes each, that's 180 GB of text a day, or about 65 TB a year before media and replication.

Key points

Common mistakes

Not true: 1 Gbps ≈ 1 GB of data a second.
In fact: Network speeds are given in bits, and a byte is 8 bits. 1 Gbps is about 125 MB a second.

Not true: Sizing: plan for the average load; the peak needs no extra planning.
In fact: Traffic comes in peaks, often several times the average. Size the system for the peak, or it fails just when it is needed most.

In the interview

I'll estimate the scale first, because it decides the design. For example, 100 million requests a day is only about 1,200 per second on average, maybe 5,000 at peak. A few load-balanced app servers and one database with read replicas can handle that. If it were 100 times more, I'd plan for sharding and heavy caching.

Part of Unit 0: How system design interviews work in the free System Design course.