All posts
System Design Mastermind · F03
  • System design
  • Interview prep
  • Estimation
  • Capacity planning

Back-of-envelope estimation: from users to servers in one minute

Foundations F03. Turn "500 million users" into requests per second, peak load, storage, bandwidth, in-flight requests, servers and cache size, with round numbers and the latency figures worth memorising. Each idea is told as a story you'll remember, with a lab where every number picks a design decision.

22 Oct 2026 · 20 min read · interactive

Share

Start here

"Design a chat app for 500 million people." Is that one database or a thousand? One server or a fleet across three zones? You can't tell until you turn users into requests per second, bytes on disk and bits on the wire.

Back-of-envelope estimation is that conversion, done in a minute with round numbers. Interviewers don't check your arithmetic to the last digit; they check that you get the number of zeros right, say your assumptions out loud, and let the result change the design. This page gives you the few numbers to memorise and the eight moves that turn "big" into a decision.

The one story for this page

The dabbawala's lunch-hour sum

Mumbai's dabbawalas are often reported as about 5,000 people moving about 2 lakh home-cooked lunches a day, by train, bicycle and handcart, with famously few mistakes.

Run their numbers like an interviewer would:

  • Per person: 2,00,000 tiffins ÷ 5,000 dabbawalas = about 40 tiffins each. (capacity per server)
  • The rush: the tiffins aren't spread over 24 hours. Almost all of them must arrive in a window of an hour or two before lunch. (peak, not average)
  • In flight: at 12:30, tens of thousands of tiffins are on trains at the same moment. Platforms and racks must hold them all. (concurrency)
  • Weight: if a box weighs about a kilo (a guess), 2 lakh boxes is roughly 200 tonnes moving across the city every day. (storage and bandwidth)
  • Spare hands: someone is ill every day, and the system still delivers. (headroom, N+2)

Nobody needs the exact count to plan this. They need the right order of magnitude and the busiest hour. Each concept below is one line of that sum.

✅ Seen: a company said so (cited)🔶 Inferred / typical🧭 Interview choice

Orders of magnitude: get the zeros right

Round every input to one significant figure and powers of ten, keep units on every number, and aim to be within 2–3× of the truth, never 10× off.

The story · remember it like this

The kirana uncle's total

You put 14 items on the counter. Before the calculator comes out, the kirana uncle glances and says "around 900". The bill comes to ₹874.

He didn't add 14 prices. He rounded each to a nice number and added those. Being ₹26 off doesn't matter; saying "₹90" or "₹9,000" would. That's the whole skill: fast, rough, and the right number of zeros.

What it really is

Four habits make estimates fast and safe:

  • Round to one significant figure: 86,400 → 100,000; 365 → 400 (or keep 365 if it's easy). Errors partly cancel.
  • Work in powers of ten: 5 × 10⁸ users × 4 × 10¹ messages = 2 × 10¹⁰ messages a day.
  • Memorise the power-of-two ladder: 2¹⁰ ≈ 10³ (thousand, KB), 2²⁰ ≈ 10⁶ (MB), 2³⁰ ≈ 10⁹ (GB), 2⁴⁰ ≈ 10¹² (TB). The gap grows: at "tera" binary is about 10% bigger, which an estimate can ignore.
  • Bits vs bytes: storage is counted in bytes, networks in bits per second. One byte = 8 bits. Mixing them is an 8× error.

Then sanity-check against something you know: "that's more messages than WhatsApp sends", or "that's one laptop's disk".

In a real system 🧭 Interview choice · core habit

Strictly, a kilobyte (KB) is 1,000 bytes and a kibibyte (KiB) is 1,024 bytes; the binary prefixes (Ki, Mi, Gi) were standardised so the two stop being confused. Disk makers and network speeds use decimal; operating systems often show binary. For estimation, treat them as equal and say so.

Interview guides (third party) agree on what is judged here: stated assumptions, units on every number and rounded arithmetic, not precision.

Trade-offs
  • More precision costs time and adds nothing if an input (users, messages per user) is already a guess.
  • Round in a consistent direction when it matters: round load up and capacity down, so errors land on the safe side.
Say it in the interview

I'll round aggressively and keep the units. If any number changes the design, I'll come back and refine it.

Trap

Doing long division on the whiteboard to four digits while dropping a factor of 1,000 between KB and MB. Precision without the right magnitude is worse than useless.

Per day to per second, then the peak

A day has 86,400 seconds (call it 10⁵), so 1 million a day is about 12 a second; then multiply by a peak factor, because you design for the busiest second, not the average one.

The story · remember it like this

Tatkal at 10 o'clock

A railway counter sells a few thousand tickets across a whole day. Spread evenly, that's a handful a minute; one clerk could do it.

But Tatkal booking opens at 10:00 sharp, and a big share of the day's demand arrives in the first few minutes. A counter sized for the average would have a queue out of the station by 10:01. Nobody sizes the counter for the day. They size it for 10:00.

What it really is

Two steps, always in this order:

  • Average rate = count per day ÷ 86,400. Shortcut: ÷ 10⁵. So 1M/day ≈ 10/s, 100M/day ≈ 1,000/s, 1B/day ≈ 10,000/s (exact: 11.6, 1,160, 11,600).
  • Peak rate = average × peak factor. A daily rhythm (people sleep, then all wake up) gives 2–3×. A scheduled event (a sale at 12:00, a match, a ticket release) can give 10× or far more.

Ask where the peak comes from: time of day, time zones (a single-country app has a sharper peak than a global one), or events. State the factor as an assumption.

In a real system ✅ Seen · Twitter, Aug 2013

Twitter reported a steady state of about 5,700 Tweets per second (more than 500 million a day: 500M ÷ 86,400 ≈ 5,800, the same number). On 3 August 2013, during a TV airing of "Castle in the Sky" in Japan, it hit a one-second peak of 143,199 Tweets per second, about 25× the average, and stayed up.

A system sized for a normal 3× peak would have needed roughly 8× more capacity that night. Event-driven peaks like this (a TV moment, a match, a sale at 12:00) are why the peak factor is an assumption you state and defend, not a constant.

Trade-offs
  • Provisioning for the peak wastes money the rest of the day; autoscaling helps, but only if it can scale faster than the spike arrives.
  • For extreme, short spikes, it's often better to queue or shed load (a waiting room) than to buy capacity for one minute a year.
Say it in the interview

500 million a day is about 6,000 a second on average. Peaks are maybe 3× for a normal day, so I'll design for about 20,000 a second, and more if there are launch-style events.

Trap

Stopping at the average. Average QPS is only a step; the design decisions (shards, servers, autoscaling, queues) come from the peak.

Reads, writes and fan-out

Estimate writes and reads separately: the read:write ratio tells you whether to spend effort on caches and replicas (read-heavy) or on partitioning the write path (write-heavy).

The story · remember it like this

One wedding card, three hundred readers

Your cousin posts the wedding invitation in the family WhatsApp group. One write. Then 300 relatives open it, many of them three times to check the venue. Nearly a thousand reads.

The opposite happens in the society's visitor register at the gate: the guard writes every entry all day, and someone reads it only when something goes missing. Same notebook idea, completely different design.

What it really is

Write down three numbers:

  • Writes per second (new messages, posts, uploads, location updates).
  • Reads per second (feeds, page views, lookups), usually written as a ratio to writes.
  • Fan-out: how many places one write must reach. A post to 1,000 followers can be 1 write and 1,000 reads later (fan-out on read) or 1,000 inbox writes now (fan-out on write).

Read-heavy (10:1 and up) points to caching, read replicas and CDNs. Write-heavy (location pings, metrics, logs) points to partitioning, append-only logs and batching. Many systems are both, on different data.

In a real system 🔶 Inferred · typical ratios

A URL shortener is the classic read-heavy case: each short link is written once and clicked many times, so a 100:1 read ratio is a common interview assumption (🔶 typical, not a published number).

Uber's driver location updates are the opposite: drivers send a ping every few seconds, so the write rate is huge and most points are never read individually. Part 01 sizes that write path; it's why locations live in memory, not in a disk database.

Trade-offs
  • Fan-out on write makes reads cheap but makes one celebrity post cost millions of writes; fan-out on read is the reverse. Many feeds mix both.
  • A cache only helps reads that repeat. A high read ratio with no repetition (long-tail lookups) still hits the database.
Say it in the interview

Writes are about 2,000 a second at peak; reads are 100× that. So the read path is where the work is: cache plus replicas, and the primary only takes writes.

Trap

Quoting one "QPS" number. A single total hides whether you need a cache or a sharded write path, which is the decision the interviewer wants to see.

Storage: count × size × time × copies

Storage = items per day × bytes per item × days kept × copies, plus room for indexes; media is thousands of times bigger than text, so find the biggest thing you store first.

The story · remember it like this

The society CCTV recorder

The notice by the lift says "CCTV recordings are kept for 30 days". The secretary had to buy a hard disk for that.

Sixteen cameras × a few gigabytes per camera per day × 30 days. Add a second disk because one will fail. Change any one of those numbers (more cameras, 90 days, 4K cameras) and the disk changes. That one line of multiplication is every storage estimate you'll ever do.

What it really is

The formula, factor by factor:

  • Count: items written per day (from the traffic estimate).
  • Size: bytes per item. Text message ~100–200 bytes with metadata; a row with a few fields ~0.5–1 KB; a compressed phone photo ~0.2–1 MB; a minute of HD video tens of MB.
  • Time: retention. Forever, 5 years, 30 days, or "until delivered".
  • Copies: replication, typically 3 for durability, plus backups.

Then add 20–50% for indexes and metadata. Find the dominant term first: if 10% of messages carry a 500 KB photo, the photos are over 99% of the bytes and the text is a rounding error.

In a real system ✅ Seen · WhatsApp, Oct 2020

WhatsApp said in October 2020 that it delivers roughly 100 billion messages a day. As an exercise (🔶 not how WhatsApp actually stores messages): 10¹¹ messages × 100 bytes = 10¹³ bytes = 10 TB of text a day; kept a year and copied 3 times, about 11 PB.

HDFS, Hadoop's file system, defaults to 3 copies of each block, one on the writer's rack and two on another rack, which is why "× 3" is the usual starting assumption.

Trade-offs
  • More copies buy durability and read capacity but multiply cost; erasure coding gets similar durability for about 1.5× instead of 3×, at the price of slower repair.
  • Shorter retention is the cheapest storage optimisation. Ask how long data must be kept before you design for "forever".
Say it in the interview

Text is small: about 10 TB a day before replication. Media dominates, so blobs go to object storage and the database only keeps metadata and pointers.

Trap

Forgetting replication and retention, or estimating text and forgetting the media. Both are 3× to 1000× errors, enough to pick the wrong database.

Bandwidth: bits per second on the wire

Bandwidth = requests per second × bytes per response × 8; for video it's concurrent viewers × bitrate, and once it reaches terabits, the answer is a CDN.

The story · remember it like this

IPL final in a housing society

One TV in the clubhouse showing the final: no problem. Now every one of 400 flats streams it on a phone and a smart TV at the same time, over the same building fibre.

The match didn't get heavier. The number of people pulling a copy of it at once did. The society's internet line, not any single TV, becomes the bottleneck.

What it really is

Two forms:

  • Request-response: peak reads/s × response size × 8 = bits per second out (egress). Inbound (uploads) is computed the same way from writes.
  • Streaming: concurrent viewers × bitrate. Bitrates are already in bits per second.

Compare with what one machine can push (a server NIC is commonly 10–100 Gbit/s, 🔶 typical) and with what it costs: cloud egress is billed per GB, so bandwidth is often the biggest bill in media systems.

In a real system ✅ Seen · Hotstar, Jul 2019

Hotstar reported 25.3 million concurrent viewers for the India vs New Zealand World Cup semi-final in July 2019. Netflix recommends 3 Mbit/s for 720p and 5 Mbit/s for 1080p. If every viewer pulled 3 Mbit/s, that's 25.3M × 3 Mbit/s ≈ 76 Tbit/s (🔶 order of magnitude; real streams mix bitrates).

No single data centre serves that. Video is delivered from CDN caches and servers inside ISP networks, close to viewers; the origin only serves each segment a few times.

Trade-offs
  • A CDN cuts egress and latency for content many people share, but helps little for personalised or one-off responses.
  • Lower bitrates and better codecs cut bandwidth but cost CPU to encode and can cost quality; adaptive bitrate lets each viewer pick.
Say it in the interview

Peak egress is about 700 Gbit/s, mostly photos. That's past what we'd serve from our own servers, so images go through a CDN and the API only returns URLs.

Trap

Multiplying by bytes and quoting the result as Mbps (an 8× error), or forgetting that streaming load is set by concurrent viewers, not requests per second.

Latency numbers worth knowing

Memory is about 100 ns, a round trip inside a data centre about 0.5 ms, a disk seek about 10 ms and a round trip across the world about 150 ms; each step is roughly 10–100× slower than the last.

The story · remember it like this

Fetching sugar for chai

Scale the numbers so one memory read takes one second, like reaching for the sugar jar on the kitchen shelf.

  • Asking another server in the same data centre: about 1.5 hours, like walking to the market and back.
  • One old spinning-disk seek: about a day, like a trip to the next town.
  • A round trip from California to the Netherlands and back: about 17 days, like posting a letter to a cousin abroad and waiting for the reply.

You'd never cross the ocean to fetch sugar for every cup. Software does exactly that when it makes one cross-region call per item in a loop.

What it really is

Jeff Dean's well-known list (2009), worth knowing by order of magnitude:

  • Main memory reference: 100 ns. Read 1 MB sequentially from memory: 250 µs.
  • Round trip within the same data centre: 500 µs.
  • Disk seek: 10 ms. Read 1 MB sequentially from disk: 20 ms.
  • Packet California → Netherlands → California: 150 ms.

Modern hardware moved some of these: an NVMe SSD random read is roughly 10–100 µs (🔶 typical), so "disk" now usually means SSD. Some numbers can't move: light in fibre covers about 200 km per millisecond, so Mumbai to Delhi and back is at least ~12 ms however fast the servers are.

In a real system ✅ Seen · Jeff Dean, 2009

Use them to budget a request. A page that needs 5 sequential calls to services in the same data centre spends ~2.5 ms on the network: fine. The same 5 calls across continents spend ~750 ms: the page feels broken.

That's why designs read from memory caches (100 ns to microseconds) instead of databases on the hot path, keep chatty services in one region, and send users to the nearest region (F01 covers the round trips).

Trade-offs
  • Memory is fastest but costs far more per GB than SSD and loses data on restart unless you persist or replicate it.
  • Batching many small calls into one saves round trips but adds waiting and makes failures coarser.
Say it in the interview

A cross-region round trip is about 100–150 ms, so the write path can't wait on another continent; within a region a hop is under a millisecond, so a few internal calls are fine.

Trap

Treating the network as free. Serial calls across regions, or an N+1 query loop to the database, turn a millisecond design into a second.

Concurrency: Little's law

Requests in the system = arrival rate × time each one spends inside (L = λW); it turns QPS and latency into threads, connections and memory.

The story · remember it like this

The Udupi restaurant on a Sunday

An Udupi restaurant serves 120 families an hour on Sunday morning, and each family stays about 30 minutes over dosa and filter coffee.

How many tables are full at any moment? 120 per hour × half an hour = 60 tables. If service slows and families stay 45 minutes, the same crowd needs 90 tables, and the queue on the pavement grows. The owner didn't get more customers. Each one just stayed longer.

What it really is

John Little proved in 1961 that, over the long run, average number in a system (L) = average arrival rate (λ) × average time in the system (W). It holds for any queue discipline and doesn't need a particular traffic pattern, as long as the averages exist.

Three everyday uses:

  • Threads or workers: 10,000 req/s × 0.2 s = 2,000 requests in progress, so a thread-per-request server needs ~2,000 threads.
  • Connection pools: 3,000 queries/s × 5 ms = 15 connections busy on average; size the pool with headroom above that.
  • Open connections: for WebSockets, "in the system" is every online user, so concurrency equals people online, not requests per second.
In a real system ✅ Seen · Little, 1961

It explains a classic outage pattern. A database slows from 5 ms to 500 ms per query; at the same 3,000 queries/s, in-flight queries jump from 15 to 1,500. Connection pools run out, threads block waiting, and upstream services time out, all from latency, without any rise in traffic.

That's why timeouts, bounded queues and load shedding matter: they cap W when something downstream slows.

Trade-offs
  • Async I/O lets one server hold many thousands of in-flight requests cheaply; a thread per request is simpler but each thread costs memory (often ~1 MB of stack, 🔶 typical).
  • Lower latency directly reduces the resources you need, so a cache can save servers, not just time.
Say it in the interview

At 20,000 requests a second and 100 ms each, about 2,000 are in flight at once. That sets the thread and connection-pool sizes, and tells me a slowdown downstream will pile up fast.

Trap

Sizing servers only by requests per second and ignoring latency. When latency rises, in-flight work rises with it, and that's what exhausts threads and connections.

From numbers to machines: capacity, headroom and the hot set

Servers = peak load ÷ (one server's capacity × a safe utilisation), plus spares for a deploy and a failure; cache = the hot slice of data, checked against RAM per node.

The story · remember it like this

Buses for the school trip

450 children, 50 seats a bus. Nine buses? The teacher books eleven.

Buses aren't loaded to the last seat (teachers, bags, the one child who gets car-sick and needs the front). And one bus might not turn up. Planning to 100% of capacity with zero spares means one surprise strands a class at the zoo.

What it really is

Three steps:

  • Capacity per machine: measure it, or use a stated assumption. A simple stateless API server: thousands of requests/s; an in-memory cache node: around 100,000 simple operations/s; a database primary: a few thousand to tens of thousands of small writes/s, depending heavily on the query (all 🔶 rough).
  • Headroom: plan for 50–70% utilisation, because latency climbs steeply as a server nears 100% busy. Then add spares: N+2 lets you lose one machine to a deploy and another to a failure at the same time.
  • Memory check for caches and in-memory data: hot set (often "20% of data gets 80% of reads", 🔶 rule of thumb) ÷ usable RAM per node = number of nodes, before replicas.

Count by every limit (CPU, memory, connections, disk, bandwidth) and take the largest. That limit is your bottleneck, and usually the deep dive.

In a real system ✅ Seen · Redis docs

Redis's own benchmark docs show a single instance doing about 180,000 simple SETs per second without pipelining, and over 1.5 million with pipelining, while warning these numbers depend on hardware and workload and aren't targets.

So 1 million cache reads/s is ~10 nodes by throughput. But if the hot set is 2 TB and each node has ~100 GB of usable RAM, memory needs ~20 nodes. Memory wins; that's the number you say.

Trade-offs
  • More headroom is safer and absorbs spikes, but idle capacity is money; autoscaling trims it for stateless tiers, not for databases.
  • Bigger machines mean fewer to manage but larger blast radius when one dies; many small ones spread risk but add coordination.
Say it in the interview

At ~20,000 peak requests a second, 5,000 per server and 60% utilisation, that's 7 servers, so I'd run 9 across two zones. The cache is limited by memory, not throughput, so I'll shard it.

Trap

Dividing peak by capacity and stopping. No headroom, no spares, and only one resource checked; the real bottleneck is often memory or connections, not CPU.

Try it: an estimate that picks the design

Pick a system, then change one assumption at a time. Every card shows the math with your numbers and the design decision it forces. Numbers are rounded and typical, for teaching.

Start from

WhatsApp-like text chat for India: 500M daily users × 40 messages, each read about twice (1:1 plus small groups), kept a year.

What we're sizingNumberHow we got itSo we decide
1 · Traffic: per day → per second → the peak
Writes per secondDesign for the busiest second, not the average one. The average is only a step on the way.231K avg · 694K peak
500M users × 40 = 20B writes/day
÷ 86,400 s = 231K/s (in your head: ÷ 10⁵ ≈ 200K/s)
× peak 3 = 694K/s
Far beyond one database primary. Partition (shard) writes by a key such as user or chat id, and put a log or queue in front to absorb bursts.
Reads per second at peakThe read:write ratio tells you which path to optimise.1.4M/s
231K writes/s × 2 reads each × peak 3 = 1.4M/s
Reads and writes are close: caching helps less, so the write path is where the design effort goes.
2 · Storage and bandwidth
Storage you must buyCount, size, time, copies. Indexes and metadata add more; real systems often add 20–50% on top.4.38 PB
20B/day × 200 B = 4.00 TB/day
× 365 × 1 years = 1.46 PB
× 3 copies = 4.38 PB
Petabytes: object storage (S3-style) for the bytes, a sharded database only for the metadata, and tiering or deletion for old data.
Bandwidth out at peakNetworks are sold in bits per second, storage in bytes. Multiply by 8 when you cross over.2.22 Gbit/s
1.4M reads/s × 200 B × 8 bits = 2.22 Gbit/s
Modest. A few load-balanced servers can send this directly.
3 · Machines, concurrency and cache
App serversNever plan to run servers at 100%: queues explode near full load. Keep spare servers for a deploy and a failure at the same time.697
usable per server: 5.0K × 60% = 3.0K/s
2.1M peak req/s ÷ 3.0K = 695 servers
+ 2 spare (N+2) = 697
Hundreds of servers: autoscaling, several zones, and a request router are part of the design, not an afterthought.
Requests in flight at onceThroughput × time in system = how many are inside. That's your threads, connections or memory per request.104K
Little's law: 2.1M req/s × 0.05 s = 104K in flight
Many requests are in flight at once. Use async I/O (event loops) rather than a thread per request, and size connection pools to match.
Cache for the hot dataA rule of thumb: a small slice of recent data gets most of the reads. Check it against your access pattern.800 GB
20% of one day's new data: 4.00 TB × 0.2 = 800 GB
More than one big cache node holds. Shard the cache (consistent hashing) and keep a replica of each shard.

Try: switch to Photo feed and watch bandwidth jump to hundreds of Gbit/s, the reason every photo and video app uses a CDN. Then set "Peak ÷ average" to 25, Twitter's 2013 record day, and see the servers multiply. Thresholds in "So we decide" are rough, typical values for teaching, not limits of any product.

Remember it

One line per idea. Read this the night before.

  1. The kirana uncle's total: round hard, keep units, get the zeros right. 2¹⁰ ≈ 10³; 1 byte = 8 bits.
  2. Tatkal at 10:00: per day ÷ 10⁵ = per second (1M/day ≈ 12/s), then × the peak factor. Design for the peak.
  3. One wedding card, 300 readers: count reads and writes separately; the ratio picks cache or sharding.
  4. The society CCTV: storage = count × size × days kept × copies (+20–50%). Media dominates.
  5. IPL in the society: bandwidth = req/s × bytes × 8, or viewers × bitrate. Terabits means CDN.
  6. Sugar for chai: memory 100 ns, data-centre hop 0.5 ms, disk seek 10 ms, across the world 150 ms.
  7. The Udupi Sunday: in flight = rate × time inside (L = λW). Slower service means more tables, not more guests.
  8. Buses for the trip: peak ÷ (capacity × 60%) + 2 spares; check every resource, memory often wins.

Check yourself

Answer out loud, then open.

100 million daily users each send 20 messages a day. What's the peak write rate?

2 billion messages a day.

  • Average: 2 × 10⁹ ÷ 10⁵ ≈ 20,000/s (exact: ÷ 86,400 ≈ 23,000/s).
  • Peak: a daily rhythm gives ~3×, so ~60,000–70,000/s.
  • That's beyond one database primary, so writes need partitioning (for example by conversation id).

Say it About 20,000 a second on average, call it 70,000 at peak, so I'll shard the message store.

A photo app stores 50 million new photos a day at 500 KB each, keeps them 5 years with 3 copies. How much storage?

Count × size × time × copies:

  • Per day: 5 × 10⁷ × 5 × 10⁵ bytes = 2.5 × 10¹³ = 25 TB.
  • 5 years: 25 TB × ~1,800 days ≈ 45 PB.
  • 3 copies: ~140 PB, before thumbnails and metadata.

Petabytes of blobs means object storage, with only metadata in a database. Erasure coding instead of 3 full copies would cut it roughly in half.

Your API serves 5,000 requests/s at 200 ms average latency. A dependency slows and latency becomes 2 s. What happens?

Little's law: in-flight requests go from 5,000 × 0.2 = 1,000 to 5,000 × 2 = 10,000, with no change in traffic.

  • Thread pools and connection pools sized for ~1,000 run out.
  • New requests queue or are rejected, and callers time out and retry, adding load.
  • Defences: timeouts on the slow call, bounded queues, load shedding, and a circuit breaker so you fail fast instead of piling up.
Why is 86,400 replaced with 100,000 in interviews, and when is that not OK?

It's 16% off, which is far below the uncertainty in the inputs (users, actions per user), and it makes the division instant.

It's not OK when you're near a hard limit (for example "is it just under or just over one machine?"). Then do the exact division, or better, add headroom so the answer doesn't depend on 16%.

A live match has 20 million concurrent viewers at an average of 2 Mbit/s. How much egress, and what does it imply?

20 × 10⁶ × 2 × 10⁶ bit/s = 4 × 10¹³ bit/s = 40 Tbit/s.

  • Far more than any single data centre's servers should push: deliver segments through CDNs and caches inside ISP networks.
  • The origin only serves each video segment to the caches, a tiny fraction of viewers.
  • Use adaptive bitrate so viewers on weak connections take lower rates instead of stalling.
You estimate 1 million cache reads/s and a 3 TB hot set. How many cache nodes?

Count by every limit and take the largest:

  • Throughput: ~100,000 simple ops/s per node (🔶 rough) → ~10 nodes.
  • Memory: 3 TB ÷ ~100 GB usable per node → ~30 nodes.
  • Memory wins: ~30 primaries, plus a replica each for failover, so ~60 nodes, sharded with consistent hashing.
When should you skip estimation in an interview?

When no number would change the design. If every plausible scale leads to the same diagram, say so and move on; some interviewers prefer estimating only at the moment a decision needs it.

Do estimate when choosing between one database and shards, cache size, whether a CDN is needed, or how many connections a real-time system holds.

Where you'll use this in the series

  • Uber: from tap to pickup · the capacity calculator: location pings per second and memory for the geo index
  • The interview framework · scale questions whose answers become the inputs here
  • How a request travels · round-trip latency, the network side of the latency numbers
  • Replication and sharding · when the write and storage numbers outgrow one machine
  • Caching · hot-set sizing and hit ratios
  • Video streaming (YouTube / Netflix) · concurrent viewers × bitrate, and why CDNs (coming)
  • URL shortener · a read-heavy estimate from start to finish (coming)

Sources

Checked October 2026. Company figures are as published on the dates shown and are used as orders of magnitude; the WhatsApp storage sum is an exercise, not how WhatsApp stores messages. Jeff Dean's latency list is from 2009 (SSDs have since replaced most disk seeks). Capacity figures per server and the 'So we decide' thresholds are rough, typical values for teaching.

System Design Mastermind · Foundations

Series home

All of Foundations

18 publishedStart here: the concepts every design uses, each told as a story you'll remember.

F01

How a request travels: DNS, load balancers, gateways and open connections

Name → address (DNS) → open a secure line once and reuse it (TCP, TLS) → nearby copies for static files (CDN) → spread and guard the work (load balancer, gateway) → find colleagues inside (discovery) → keep a line open for live updates.

20 min · interactive Preview
F02

The interview framework: requirements, numbers and scope before boxes

Agree what users must do (three core requirements) → put numbers on how well (p99 latency, availability, durability, staleness) → say what's out of scope → sketch the simple end-to-end design → go deep only where a number breaks it.

22 min · interactive Preview
F03

Back-of-envelope estimation: from users to servers in one minute

Users × actions ÷ 86,400 (≈10⁵) = average per second → × peak factor → split reads and writes → storage = count × size × time × copies → bandwidth × 8 bits → in flight = rate × latency → servers = peak ÷ (capacity × 60%) + 2 spares.

You're reading this Preview
F04

APIs and real-time communication: REST, gRPC, retries, webhooks and live updates

Nouns + HTTP verbs (user from the token) → REST outside, gRPC inside → cursor pagination → POST with an Idempotency-Key, retries with backoff and jitter → add, don't change → poll for rare updates, SSE for one-way live, WebSockets for both ways → webhooks are at-least-once → thin connection gateways with resume and push fallback.

22 min · interactive Preview
F05

Databases: data models, indexes and transactions

Relational by default (each fact once, keys, constraints) → key-value / document / wide-column / graph only for a named access pattern → B-tree for reads, LSM for heavy writes → composite index with equality columns first, then the sort → one transaction per local change, made durable by the write-ahead log → know your isolation level → win races with a conditional write and a unique constraint.

24 min · interactive Preview
F06

Replication and sharding: copying and splitting your data

Copies scale reads and survive failures (leader + followers); splits scale writes and size (shards). Replicate first; shard only when data size or write rate outgrows one leader → pick the shard key from the main query → hash it into many fixed slots so growth moves ~1/(N+1) → name your hot key and your one cross-shard query.

25 min · interactive Preview
F07

Caching: hit ratios, invalidation and stampedes

Cache what is read far more than it changes → say the expected hit ratio and size the database for the misses → cache-aside with a TTL; on writes, update the database then delete the key → coalesce misses on hot keys and jitter TTLs → plan for the cache failing or restarting empty, because by then the system depends on it.

24 min · interactive Preview
F08

Consistency, CAP and quorums: what replicas promise

Say what each operation needs, not what the system is: strong (linearizable) for money, stock, seats and uniqueness; read-your-writes for a user's own data; eventual for counts, feeds and pages → during a partition, strong operations fail on the minority side, the rest keep serving (CAP) → on a normal day, strong costs a round trip to a quorum (PACELC) → with N copies, W + R > N makes reads overlap the latest write, but it isn't linearizability.

25 min · interactive Preview
F09

Coordination: clocks, leaders, locks and consensus

Don't order events across machines by wall-clock time; let one leader assign the order → elect that leader by majority vote with increasing terms, so a split network can't elect two → give it a lease so a dead leader is replaced without anyone proving it died → and a fencing token the storage checks, so a paused old leader can't do harm → use consensus (Raft) for the few decisions that must be agreed, not for every request.

25 min · interactive Preview
F10

Queues and event streams

Put a queue between work that can wait and the caller, so a spike becomes lag instead of an outage → use a task queue for jobs and an event log (Kafka) when many consumers need every event, replay or per-key order → key by the entity whose order matters and size partitions for peak consumers → deliver at least once and make consumers idempotent → retry a few times with backoff, then dead-letter → scale on lag → publish through an outbox, never "save, then publish".

25 min · interactive Preview
F11

Idempotency, exactly-once and sagas

Treat a timeout as unknown, never as failed → make writes idempotent by design (set, don't add; client IDs; conditional writes) → for the rest, an idempotency key per intent, stored with the result in the same transaction as the effect → consumers deduplicate by message ID in the same transaction → exactly-once holds only inside one boundary → across services, use a saga of local steps with compensations, not 2PC → compensable steps first, the pivot (capture payment) next, retryable steps last, on a durable orchestrator.

25 min · interactive Preview
F12

Scaling and performance

State latency as a percentile at a stated load → size each tier to the utilisation where its p99 is still flat (pooled, least-request balancing lets you run hotter) → budget fan-out calls against the page deadline, hedge stragglers → scale up first, scale out stateless tiers → name the shared resource (database, lock, connections) that caps the speed-up → find the saturated resource and cut work per request → pre-scale known peaks, autoscale on the signal that saturates → under overload, shed the lowest-priority work fast and budget retries.

24 min · interactive Preview
F13

Reliability and disaster recovery

Turn the target into a downtime budget → cut hard dependencies, because chains multiply → spread copies across zones (cells for blast radius) → timeouts from the deadline, one layer of jittered retries under a budget → circuit breakers with fallbacks and a bulkhead per dependency → fast, non-flapping health checks (readiness checks dependencies, liveness doesn't) → statically stable: spare capacity already running, config cached → PITR plus tested restores, because replicas copy mistakes → the cheapest DR strategy that meets RTO and RPO, drilled.

25 min · interactive Preview
F14

Observability and safe deployments

Metrics to notice, traces to locate, logs to explain (joined by a trace ID) → watch latency percentiles, traffic, errors and saturation → set an SLO per user journey and treat 1 − SLO as an error budget → page on burn rate over two windows, not on CPU → canary every change on a slice with automated analysis against a baseline → keep every version compatible with its neighbours (expand, migrate, contract) so rollback is always possible → ship dark behind flags, and stage config like code → when it breaks: one commander, mitigate first, blameless postmortem.

25 min · interactive Preview
F15

Security essentials for system design

Prove who the caller is (slow salted hashes, MFA, passkeys, rate-limited login) → carry identity in short-lived signed tokens with revocable refresh tokens, or in sessions you look up → delegate with OAuth code flow + PKCE, sign in with OpenID Connect → check this user against this object on every request, least privilege for people and services, audit logs → TLS 1.3 at the edge, mTLS inside, no trust from network location → envelope encryption with a KMS, secrets in a vault, tokenise what you needn't keep → treat all input as data (parameterise, encode, CSRF tokens, no user-chosen fetches) → absorb floods and abuse at the edge.

26 min · interactive Preview
F16

Search, feeds and geo building blocks

Search: analyse text into terms → inverted index of sorted postings → BM25 or hybrid (BM25 + vectors via RRF) retrieval of ~1,000 candidates → learned ranker → shards with replicas, fed from the database by CDC, refreshed every second. Typeahead: precomputed top-k per prefix in memory. Feeds: push IDs into followers' timelines, pull celebrities at read time, hydrate, filter, rank, page with cursors. Geo: index by cell (geohash, S2, H3), search the cell plus neighbours, exact distance on the few candidates.

27 min · interactive Preview
F17

Data pipelines: batch and stream

Pick batch or stream by how fresh each output must be. Get data in with log-based CDC (snapshot, then the WAL) and schemas that evolve safely; land raw events as Parquet in lakehouse tables partitioned by date. Batch jobs map, shuffle and reduce one partition and overwrite it, so retries and backfills are safe. Stream jobs window by event time, fire on watermarks, decide whether late events wait, correct or drop, and checkpoint state with offsets for exactly-once effect, with transactional or idempotent sinks. Reprocess by replaying retained data (Kappa) rather than keeping two codebases (Lambda).

28 min · interactive Preview
F18

AI foundations: inference, RAG and agents

Latency is time to first token (prefill reads the prompt, compute-bound) plus output tokens × time per token (decode, memory-bound), so stream answers and limit by tokens. GPU memory is weights plus a KV cache per request; long prompts, not users, fill it. Continuous batching shares each weight read across many requests, cutting cost per token by 10× or more until time per token hits its target. Route easy requests to small models, cache shared prompt prefixes, quantize carefully. RAG retrieves, reranks and cites a few permission-filtered chunks; agents are tool-calling loops with budgets, idempotent tools and approval for irreversible steps. Evaluate every change on an eval set, and design so a model fooled by prompt injection still can't do damage.

30 min · interactive Preview

More posts