01Why it matters
How many servers does it take?
A maps app has 200 million daily users. Before anyone draws boxes and arrows, someone has to ask: how many requests a second is that? A hundred? A million? The answer decides everything after it. A hundred fits on one machine, while a million needs a fleet, caches and careful sharding.
You don't need a spreadsheet to answer. A few known facts, round numbers and a minute of arithmetic get you to the right power of ten, and that is all the first sketch of a design needs. This is back-of-the-envelope estimation (also called Fermi estimation, after the physicist who was famous for it). It is the first step of every system-design interview and of real capacity planning, and this lesson gives you the method, the numbers to remember and practice.
02Key parts
The pieces you will use
- daily active users (DAU)
- How many people use the product on a typical day. Most estimates start here.
- QPS
- Queries (requests) per second. Traffic per day divided by the seconds in a day gives the average.
- peak factor
- How much busier the busiest time is than the daily average: often 2 to 10 times, more during a launch or a big event.
- order of magnitude
- The power of ten a number is closest to. 23,000 and 40,000 are both about 10^4; an estimate aims to get this right.
- headroom
- Spare capacity on purpose: servers planned to run well below 100% at the peak, because latency explodes near full load.
- hot set
- The small share of data that gets most of the traffic. Often about 20% of the keys get 80% of the reads, so a cache only needs the hot set.
03See it work
From users to requests a second
Start with what you know and multiply your way to what you need, keeping the units in sight:
- Requests a day = daily users × requests each. 200 million users × 10 tiles = 2 × 10^9 requests a day.
- Requests a second = requests a day ÷ seconds in a day. A day has 86,400 seconds; call it 10^5. So 2 × 10^9 ÷ 10^5 = 2 × 10^4: about 20,000 requests a second. (The exact figure, 23,100, is the same power of ten.)
Try one. Type your estimate in any form you like (23000, 23k, 2e4), then compare your working with the steps.
Estimate: Requests a second
Practice, not recordedA photo-sharing app has 50 million daily users, who each view 10 photos a day. About how many requests a second does it serve, on average?
- Daily users
- 50 million
- Photos per user a day
- 10
04Predict
Why not run servers at 100%?
Once you know the traffic, it is tempting to divide by what one server can do and stop there. But a server planned at 100% of its capacity has no slack to work a line down. Here one server is 95% busy: its service time is 100 ms, yet a request takes about 2 seconds on average, 20 times as long. The player stops before arrivals and asks whether each one will wait.
Make 4 predictions: step forward and answer each question before the next step plays.
0 of 4 madeThat is why capacity estimates divide by a target load, often 50–70% of what a server can do flat out, and then add a spare or two so the service survives a machine failing at the peak.
05Try it
Peaks and servers
Traffic follows the clock: evenings, Monday mornings, a big match or a launch. Size the system for its peak. Find the average, multiply by a peak factor, then divide by what one server can do at its target load.
Estimate: Peak traffic
Practice, not recordedA news site has 500 million daily users, who each read 10 articles a day. Its busiest hour runs at 5 times the daily average. About how many requests a second must it handle at the peak?
- Daily users
- 500 million
- Articles per user a day
- 10
- Peak ÷ average
- 5×
Estimate: How many servers
Practice, not recordedAt its peak a service gets 40,000 requests a second. One server can handle 1,000 a second flat out, but you want each to run at no more than 70% of that so latency stays low. About how many servers do you need?
- Peak requests a second
- 40,000
- One server, flat out
- 1,000
- Target load per server
- 70%
06Try it
Storage and bandwidth
Storage is items × size × time, then × the number of copies kept. Bandwidth is requests a second × bytes per response. Remember the prefixes: 10^3 is kilo, 10^6 mega, 10^9 giga, 10^12 tera and 10^15 peta. And networks are sold in bits: multiply bytes by 8.
Estimate: Storage a year
Practice, not recorded50 million users each upload 2 photos a day, 200 KB each. Everything is kept, and stored 3 times for safety. About how much storage does a year of them need?
- Active users a day
- 50 million
- Photos per user a day
- 2
- Size of each
- 200 KB
- Copies kept
- 3
Estimate: Bandwidth
Practice, not recordedA service sends 10,000 API responses a second, 2 KB each. About how much outgoing bandwidth does it need?
- Responses a second
- 10,000
- Size of each
- 2 KB
07Try it
Latency numbers, and the hot set
Every design is built on a few physical facts, which between them span about six powers of ten. They come from Jeff Dean's well-known list, and exact values vary with the hardware:
- a main-memory reference takes about 100 ns;
- a random read from an SSD takes about 100 µs, a thousand times slower;
- a round trip within a data centre takes about 0.5 ms;
- a disk seek takes about 10 ms;
- a round trip from California to Europe and back takes about 150 ms.
The estimation drills page has the full table.
Estimate: Latency budget
Practice, not recordedA request must be answered within 500 ms. About how many disk seeks could it make one after another in that time, if it did nothing else?
- Time budget
- 500 ms
- One of them (disk seek)
- 10 ms
These gaps are why caches exist. Reads are skewed (often 80% of them go to 20% of the keys), so keeping the hot 20% in memory answers most reads in microseconds instead of milliseconds.
Estimate: Cache memory
Practice, not recordedA database holds 50 million user profiles, 500 bytes each. As often happens, about 80% of reads go to the most popular 20%. How much memory does a cache need to hold that hot 20%?
- Items stored
- 50 million
- Size of each
- 500 bytes
- Hot share
- 20%
08Check yourself
Check yourself
Question 1 of 7
100 million daily users each make 10 requests a day. Roughly how many requests a second is that, on average?
Your answer comes back in Review in a few days, so it sticks.
Question 2 of 7
A service averages 10,000 requests a second and peaks at 4 times that. Each server handles 1,000 a second at your target load. How many servers do you need, before any spares?
Question 3 of 7
10 million users each post one 1 MB photo a day. Roughly how much raw storage is a year of photos, before replication?
Question 4 of 7
Two engineers estimate peak traffic at 23,148 and 20,000 requests a second. What should the design document say?
Question 5 of 7
Roughly how much slower is one disk seek (about 10 ms) than one main-memory reference (about 100 ns)?
Question 6 of 7
A service returns 5,000 responses a second of 200 KB each. About how much outgoing bandwidth does it need?
Question 7 of 7
Why plan servers for about 60–70% of their capacity at the peak, rather than 100%?
09Explain it back
Say it in your own words
Explain how you would estimate how many servers a service needs, starting from its daily users, and why you round to powers of ten and plan for the peak with headroom.
10Recap
What to remember
- Requests a second = daily users × requests each ÷ 10^5 (a day is 86,400 seconds).
- Size for the peak, not the average, and plan servers at 50–70% of their capacity, with spares.
- Storage = items × size × time × copies; bandwidth = requests a second × bytes each (× 8 for bits).
- Memory (~100 ns), SSD (~100 µs), a data-centre round trip (~0.5 ms), a disk seek (~10 ms) and an ocean crossing (~150 ms) span about six powers of ten. Count the slow steps on a request's path.
- Round to one digit and a power of ten. Within 2× is excellent; within 10× still picks the right design.
- More practice: the estimation drills.