Back-of-envelope estimation
What breaks
Section titled “What breaks”The interviewer reads you the prompt:
Design the public pages for a booking platform. 50,000 salons each have a page with their services and a gallery of photos. Customers open the page on their phones and book.
You have done lesson 0.2, so you ask about requirements first. Then you draw: a load balancer, one app server, a database, and the photos on the app server’s disk. To be safe, you add a cache in front of the database.
The interviewer asks: will one app server do? You say probably. How long does a page take to build? You say fast. How fast? There is no number behind the word.
So the interviewer does the arithmetic. Each salon page is opened 200 times a day, so 50,000 pages make 10,000,000 page views a day. Say evenings are busiest and the peak is ten times the average: about 1,000 page views a second. Each page shows 20 photos of 200 KB. That is 4 MB per page, and 4,000 MB, or 4 GB, every second. In bits, 32 gigabits a second. A server with a 1 Gbps network link can send about 125 MB a second.
The design is short by a factor of about 30 on the one thing you did not check. Meanwhile the cache you added protects a database that, as this lesson will show, was never under pressure.
What broke? Not the boxes. You had no numbers, so you could not see which part of the design was under load. Lesson 0.2 made estimates step 2 and said an estimate exists to make a decision. This lesson is how to make one in a minute.
Jeff Dean, in his 2009 talk on building large distributed systems, calls this an “important skill: ability to estimate performance of a system design – without actually having to build it!” Google’s SRE workbook names the reason the boxes are not enough: “All systems will eventually have to run on real computers in real datacenters using real networks.”
Terms used in this lesson:
- A back-of-envelope estimate (from lesson 0.2) is a rough calculation, done in a minute, that tells you the order of size: tens of something, or tens of thousands.
- Requests per second (QPS) is the rate at which work arrives. Peak is the highest rate you must survive; average is total work divided by total time.
- Latency is how long one operation takes. Throughput is how many operations finish per second. Bandwidth is how many bytes a link or disk can move per second.
- IOPS (input/output operations per second) is how many separate reads or writes a disk can do each second.
- A limit is the known capacity you compare an estimate with: a network link, a disk, one machine’s memory.
Mental model
Section titled “Mental model”Count times size, divided by time, then compare with one limit. Every estimate in this lesson has that shape. Requests per second is a count divided by time. Storage is a count times a size. Bandwidth is a rate times a size. The number means nothing until it sits next to a limit, and the gap between them is the answer:
- Far below the limit — say a hundred times below — this part is not the problem. Stop.
- Far above it — this is your design decision. One machine will not do; say what replaces it.
- Within about ten times of it — the assumptions matter. Ask the interviewer, or state the safer assumption.
The three bands are this course’s rule of thumb, not a published standard.
Diagram
Section titled “Diagram”Three slides: rates, then sizes, then the comparison that makes the decision. Swipe or scroll sideways.
Walking the salon prompt through the estimates
Section titled “Walking the salon prompt through the estimates”The same prompt from “What breaks”, one estimate at a time. Each starts with its assumptions, said aloud.
Requests per second. A day has 86,400 seconds. Round it to 100,000: the error is about 14%, and dividing by 10⁵ is easy in your head. 10,000,000 page views a day ÷ 100,000 = 100 a second on average (the exact answer is about 116). Where does the peak come from? Ask. If the interviewer says “you decide”, choose a factor and give your reason: assume bookings bunch in the evenings, and ten times the average, about 1,000 a second. The factor is an assumption, and you say so.
The writes are smaller. Assume each salon takes 20 bookings a day: 1,000,000 bookings a day, about 12 a second.
Storage. Storage is count × size × how long it is kept × how many copies. Bookings: 1,000,000 a day × 1 KB = 1 GB a day, about 365 GB a year. Photos: 50,000 salons × 50 photos × 2 MB for the original = 5,000,000 MB, or 5 TB. Photos outweigh a year of bookings by more than ten to one. That already tells you they belong somewhere other than the bookings database.
Google’s SRE workbook works an example the same way. For an ads system with 500,000 search queries a second, it treats each log entry as 2 KB and multiplies: (5 × 10⁵ queries a second) × (8.64 × 10⁴ seconds a day) × (2 × 10³ bytes) = 86.4 TB a day, which it rounds up to about 100 TB.
A note on units. KB here means 1,000 bytes, not 1,024. NIST notes that computer professionals “started using the SI prefix ‘kilo’ to mean 1024”, and in December 1998 the IEC approved separate binary prefixes: KiB, MiB, GiB, TiB. The gap is 2.4% at kilo and about 10% at tera. AWS quotes its disk limits in MiB and GiB. In an interview, use powers of ten and say so; the gap never changes an order of size.
Bandwidth. Bandwidth is rate × size. 1,000 pages a second × 20 photos × 200 KB = 4 GB a second. Networks are quoted in bits, so multiply by 8: 32 Gbps. A 1 Gbps link moves 125 MB a second. Dean’s table agrees to the order of size: it lists “send 2K bytes over 1 Gbps network” at 20,000 ns, which is 2,000 bytes in 20 microseconds, or 100 MB a second.
So the photos are about thirty times over the limit of one server’s link. That is the design decision: photos are served from somewhere built for it, not from the app server. Lesson 1.9 covers object storage and CDNs. For now, naming the problem and the number is enough.
Latency. Here you need numbers you know before the interview. Dean’s 2009 table is the well-known one:
| Operation | Time (2009) |
|---|---|
| L1 cache reference | 0.5 ns |
| Main memory reference | 100 ns |
| Send 2 KB over a 1 Gbps network | 20,000 ns (20 µs) |
| Read 1 MB sequentially from memory | 250,000 ns (0.25 ms) |
| Round trip within the same data centre | 500,000 ns (0.5 ms) |
| Disk seek | 10,000,000 ns (10 ms) |
| Read 1 MB sequentially from disk | 20,000,000 ns (20 ms) |
| Packet from California to the Netherlands and back | 150,000,000 ns (150 ms) |
Do not memorise the digits. Memorise the steps: memory is nanoseconds, a round trip inside one data centre is under a millisecond, a spinning-disk seek is about ten milliseconds, and a trip across an ocean is about a hundred and fifty.
Now the salon page. If the 20 photos sit on one spinning disk and are read one after another, the seeks cost 20 × 10 ms = 200 ms and reading 4 MB costs 4 × 20 ms = 80 ms: 280 ms before a byte is sent. Read them all at once and the page waits for one seek and one 200 KB read: 10 ms + 4 ms = 14 ms. Same disk, same photos, twenty times faster, and you found it without building anything.
Dean’s own example is the same shape: an image results page with 30 thumbnails takes “30 seeks * 10 ms/seek + 30 * 256K / 30 MB/s = 560 ms” read serially, and “10 ms/seek + 256K read / 30 MB/s = 18 ms” read in parallel. He adds that this “ignores variance, so really more like 30-60 ms, probably”. An estimate gives you the order of size, not the measurement.
Requests in flight — Little’s law. How many servers do 1,000 page views a second need? Rate alone does not say, because a request that takes longer occupies a server for longer. Little’s law connects them. In John Little’s words, “the average number of items in a queuing system, denoted L, equals the average arrival rate of items to the system, λ, multiplied by the average waiting time of an item in the system, W”. So L = λW.
Assume a page takes 200 ms to build. 1,000 a second × 0.2 seconds = 200 requests in flight at any moment. That number, not the rate, is what you size against: worker threads, database connections, open sockets. If one server can work on 50 requests at once (an assumption, said aloud), you need four servers at peak, before any spare for a server failing. Little notes the law “holds under remarkably general conditions”, but it speaks of averages: use your peak rate, not the daily one.
Back to the cache. The bookings database takes about 12 writes a second. AWS documents a gp3 SSD volume at a baseline of 3,000 IOPS (checked 2026-11-29). Even if each booking cost several disk operations, 12 a second sits far below that limit. On these numbers the database was never the problem, and the cache from the opening was protecting the wrong part.
Trade-offs
Section titled “Trade-offs”Rounding hard against calculating exactly. How precise should the numbers be? Precise enough to settle the decision, and no more. Dividing by 100,000 instead of 86,400 is about 14% off, and no design choice in the salon answer changes with 14%. The SRE workbook goes further and rounds up on purpose, “to make sure we don’t prematurely hit a limit”. The cost of rounding up is a design sized a little larger than it needs to be. The cost of exact arithmetic is minutes you need for the deep dive. The workbook states the priority plainly: “examples of sound reasoning and assumption making are more important than any final values.”
Average against peak. Which one do you size for? Peak decides how many servers and how much bandwidth, because that is when the system fails. Average decides storage and cost, because those add up over time. The salon answer used both: peak for the 32 Gbps, the daily total for the 5 TB. The cost of peak is that you have to invent a factor. Ask for it; when you cannot, state it and move on.
Old numbers against current ones. Dean’s table is from 2009 and assumes spinning disks. Norvig’s similar table, on a page dated 2001–2014, puts a disk seek at 8 ms rather than 10: the two well-known tables already disagree. Current cloud storage is a different shape. AWS documents gp3 SSD volumes at “single-digit millisecond latency”, io2 Block Express volumes at “an average latency of under 500 microseconds for 16KiB I/O operations”, and an st1 hard-disk volume at a maximum of 500 IOPS (all checked 2026-11-29). The SRE workbook’s own example assumes “a common 4 TB HDD might be able to sustain 200 input/output operations per second”. So use the old table for the steps between memory, data centre, disk and ocean. When a decision rests on one number, such as how many IOPS a volume gives, say it is a dated figure, or look it up.
Estimating against measuring. An estimate picks the candidate design; it does not prove it. Dean’s next slide after the arithmetic is “Write Microbenchmarks!” — a benchmark “builds intuition for back-of-the-envelope calculations”. The variance he flagged in the thumbnail example is the gap only measuring closes. In an interview you estimate. At work you estimate, then measure the part the estimate says is close to its limit.
Decimal units against binary ones. Powers of ten are faster in your head; binary units match how AWS quotes its disk limits. The 10% gap at tera never changes a decision in an interview. It can change one in a capacity plan, so there use the unit the provider uses.
Drill 1 — interview question
Section titled “Drill 1 — interview question”“Design a chat service. Users send 2 billion messages a day; a message averages 100 bytes of text; messages are kept for five years.” Do only the estimates, aloud, in five minutes: average and peak requests per second, total storage, and the one design decision the numbers settle.
Model answer
Assumptions, said first. 2,000,000,000 messages a day. 100 bytes each, ignoring metadata for now. Kept five years. Three copies of every message, so one machine failing loses nothing. Peak is three times the average, assuming use is spread across the waking day rather than in one short burst; I would ask whether that holds.
Requests per second. 2 × 10⁹ ÷ 10⁵ = 20,000 writes a second on average (exactly about 23,000). Peak at three times: about 70,000 a second.
Storage. 2 × 10⁹ × 100 bytes = 200 GB a day. A year is about 73 TB. Five years is about 365 TB. Three copies: about 1.1 PB.
Decision. A petabyte does not fit on one machine, and 70,000 writes a second is close to the maximum of one gp3 SSD volume (80,000 IOPS, checked 2026-11-29), with no room for growth. So the messages must be split across many machines. How to split them is a later step, and lesson 3.3 teaches it. The numbers also say what is not the problem: 70,000 messages of 100 bytes is 7 MB a second, small for the network.
Rubric
- States assumptions, including the peak factor and copies, before calculating — 2
- Requests per second right to the order of size, average and peak — 2
- Storage right to the order of size, with retention and copies — 2
- Compares at least one number with a named limit — 2
- Names the decision the numbers settle, and one thing that is not a problem — 2
Total 10. 8 or more is a pass.
Drill 2 — interview question
Section titled “Drill 2 — interview question”The interviewer takes your chat estimate and adds two things. “Each message takes 50 ms on the server, and one server can work on 1,000 requests at once. How many servers at peak? Then: 10% of messages now carry a 1 MB photo. What changes?”
Model answer
Servers. Little’s law: requests in flight = rate × time = 70,000 a second × 0.05 seconds = 3,500. At 1,000 per server, that is four servers’ worth of work at peak. Four is the floor, not the answer: one failing leaves three, which cannot carry the peak, so I would say at least five and let the availability target set the final number.
Photos. 10% of 2 × 10⁹ is 2 × 10⁸ photos a day. At 1 MB each, 200 TB a day — a thousand times the 200 GB of text. At peak, 10% of 70,000 is 7,000 photos a second × 1 MB = 7 GB a second, or 56 Gbps. Everything I said about text is now a rounding error. The decision: photos take their own path, uploaded to and served from storage built for large files, and the message only carries a reference to the photo. The message servers keep the job they were sized for.
Rubric
- Uses rate × time (Little’s law) rather than rate alone — 2
- Arithmetic right to the order of size for servers in flight — 2
- Adds spare capacity for a failure and says why — 2
- Photo storage and bandwidth right to the order of size — 2
- Says the photos change the design and proposes a separate path — 2
Total 10. 8 or more is a pass.
Drill 3 — hands-on exercise
Section titled “Drill 3 — hands-on exercise”Measure the latency table on your own machine, then redo an estimate with your numbers.
- Write a small program, in any language, that times four things, each many times, and reports the median: reading one value from a large array in memory at random positions; reading a 1 MB file you have just written; a network round trip to a machine on the same network (a router or another computer); and a round trip to a server on another continent.
- Put your numbers next to Dean’s 2009 table. Mark each row “within ten times” or “not”.
- For any row that is not, write one sentence on why. (Is your disk an SSD? Was the file still in memory, cached by the operating system?)
- Redo the salon page latency estimate (20 photos, read one after another, then all at once) with your disk numbers. Does the decision change?
- Keep the page. You will use your own numbers in every later estimate.
Exit test
Section titled “Exit test”Answer without notes.
- A service gets 50,000,000 requests a day, and peak is four times the average. Roughly what is the peak in requests per second? Show the arithmetic.
- A photo app stores 1,000,000 new photos a day at 3 MB each, keeps them forever and stores two copies. Roughly how much storage does one year need? Is one 1 Gbps link enough to receive the uploads, on average?
- Put these in order from fastest to slowest and give each an order of size: a disk seek, a main memory reference, a round trip within one data centre, a packet across an ocean and back.
- A service handles 2,000 requests a second at peak, and each takes 300 ms. How many requests are in flight? What would you size against that number?
- Your estimate says the database takes 15 writes a second. What do you conclude, and what do you stop doing?
Further reading
Section titled “Further reading”- Jeff Dean, Designs, Lessons and Advice from Building Large Distributed Systems, LADIS 2009, slides 23–28: “Numbers Everyone Should Know”, the thumbnail calculation and “Write Microbenchmarks!” — https://www.cs.cornell.edu/projects/ladis2009/talks/dean-keynote-ladis2009.pdf. Dated 2009.
- Google, The Site Reliability Workbook, chapter 12, “Introducing Non-Abstract Large System Design” — https://sre.google/workbook/non-abstract-design/. A full estimate worked from requirements to machine counts.
- John D. C. Little, “Little’s Law as Viewed on Its 50th Anniversary”, Operations Research 59(3), 2011 — https://doi.org/10.1287/opre.1110.0940. The law, in its author’s words.
- Peter Norvig, Teach Yourself Programming in Ten Years, the timing table — https://norvig.com/21-days.html. A second table to compare with Dean’s.
- AWS, Amazon EBS volume types — https://docs.aws.amazon.com/ebs/latest/userguide/ebs-volume-types.html, and General Purpose SSD volumes — https://docs.aws.amazon.com/ebs/latest/userguide/general-purpose.html. Current disk limits; checked 2026-11-29, and they change.
- NIST, Prefixes for binary multiples — https://physics.nist.gov/cuu/Units/binary.html. KB against KiB.