Skip to content

Estimating out loud

The estimation stage of an interview is five or six minutes in which the interviewer cannot see your head. They hear a sequence of numbers, and what they learn from it is whether you know which numbers matter, whether you notice when one looks wrong, and whether the arithmetic ends in a decision. The answer itself matters less than the reasoning that produced it.

Google’s Site Reliability Workbook says the same about its own design exercise. It calls the method Non-Abstract Large System Design: turn a whiteboard design into concrete estimates of resources, and treat examples of sound reasoning and assumption making as more important than any final value. An estimate with a wrong assumption that you stated can be corrected in one sentence by the interviewer. An estimate with a right number and no assumptions cannot be corrected at all, and it cannot be trusted either.

Mental model. An estimate said out loud is a chain of small claims, and every link is checkable. Each assumption is a link the interviewer can replace, and the conclusion is the last link: what the number means for the design.

The earlier module already taught the arithmetic (requests per second, storage, bandwidth and powers of ten). This lesson is about doing it in front of someone, in a few minutes, and in the order they can follow.

The Arena scenario for global messaging gives this brief: 100 million users, 20 million of them active on a day, and 5 billion messages a day. The case study of the same name works from a bigger service, 200 million daily users, so its figures differ from the ones here. Here is the estimate, one claim at a time.

Quantity Working Result
Share of users active on a day 20 million ÷ 100 million 20%
Messages per active user per day 5 billion ÷ 20 million 250
Messages per second, on average 5,000,000,000 ÷ 86,400 57,870
Peak, assuming 3 times the average 57,870 × 3 173,611, said as about 174,000
Storage written per day, at 200 bytes a message 5 billion × 200 bytes 1 TB
Storage for a year, with 3 copies 1 TB × 365 × 3 1,095 TB, about 1.1 PB
Link speed for the messages coming in, at the peak 173,611 × 200 bytes × 8 about 278 Mbps
Connected at the peak, assuming 20% of the daily users 20 million × 0.2 4 million
Gateway servers, assuming 50,000 connections each 4 million ÷ 50,000 80

Three of those numbers are not in the brief and are assumptions you must say: the peak of 3 times the average, the 200 bytes a message and the three copies. The 20% connected and the 50,000 connections per server are two more, taken from the chat case study. None is a measurement of a real service. The brief gave 5 billion messages a day, so the interviewer will not argue about it. They may well ask whether it counts messages sent or messages delivered, because in a group chat one sent message is several deliveries. Asking that question out loud is part of the answer.

The calculator below starts on the brief. Its fields are Daily active users (in millions), Requests per user per day and Peak-to-average ratio. A message sent is the request here, so 250 is the number of messages per active user.

Traffic calculator

Your numbers

million users

How many different people use the product on a typical day: daily active users, not registered accounts.

requests per user per day

Count the requests that reach the system, not the screens the user sees: opening one page can send ten requests.

×

How many times busier the busiest moment is than the average. It depends on the product and on time zones, so take it from your own traffic when you can. The starting 3 is only a round number for illustration.

Changing the numbers needs JavaScript. The result is for the starting numbers.

Result

Peak requests per second174K

On average: 57.9K requests per second.

How it is calculated

Each step shows its formula, the numbers that go in, and the figure that comes out.

  1. Requests per day

    D = U × q

    Every user makes the same number of requests, so the day's total is the number of users times the requests each one makes.

    U daily active users
    20M
    q requests per user per day
    250

    D requests per day5B

  2. Average requests per second

    A = D ÷ d

    Spread over the whole day. A day has 86 400 seconds; in back-of-envelope mode it is taken as 100 000.

    D requests per day
    5B
    d seconds in a day
    86.4K

    A average requests per second57.9K

  3. Peak requests per second

    P = A × f

    A system is sized for its peak, not for its average.

    A average requests per second
    57.9K
    f peak-to-average ratio
    3

    P peak requests per second174K

What a day's requests mean per second
Requests per dayAverage per second
1M11.6
10M116
100M1.16K
1B11.6K
5B · your traffic57.9K
10B116K
Model notes

Assumptions

  • Every user makes the same number of requests. Real users do not: a few heavy users, bots and automatic retries add requests, so measure the spread if it matters.
  • The peak is the average times the ratio you enter. Real peaks depend on the product, the time of day and the time zones of the users, and a single event can exceed any ratio, so take it from your own traffic.

Simplifications

  • A day has 86 400 seconds. In back-of-envelope mode it is taken as 10^5 seconds, the nearest power of ten, so the averages come out about 14% lower than the exact ones.
  • In back-of-envelope mode, the counts and sizes you enter are rounded to the nearest power of ten before anything is calculated. The result is an order of magnitude, not a figure to buy against.

Parameter values are illustrative. They are not benchmarks of any real product.

Follow the steps. 20 million users making 250 requests each are 5,000,000,000 requests a day. Divided by 86,400 seconds, that is 57,870 per second on average, and three times that is 173,611 at the peak. In an interview you would say “about 58,000 on average, about 174,000 at the peak”, and write only those two.

Rounding is allowed, and hiding it is not. Say what you rounded and which way.

In a mental calculation a day is taken as 100,000 seconds, as the powers of ten lesson explains. Then 5 × 10^9 ÷ 10^5 is 50,000 a second, which is about 14% below the exact 57,870. A clean way to say it: “A day is 86,400 seconds; I’ll use 100,000 to keep it quick, so my averages are about 14% low, and I’ll correct for that when it matters.” If it matters, use 86,400. Here a 14% error would not change a single decision below, but if you were choosing between 8 and 9 servers it would.

Round the final answer to one or two significant digits and keep the exact figure only where the next step needs it. “About 174,000” is easier to compute with and to remember than 173,611, and the extra digits claim a precision that the 3 and the 200 never had.

Bentley says to double-check all calculations, especially quick ones, and the way to do it in a room is by a different route to the same number.

For the peak, count the people instead. At the peak 4 million users are connected, from the table. To make 173,611 messages a second each of them must send one about every 23 seconds (4,000,000 ÷ 173,611 = 23.0). Ask whether that is believable for a busy time. If the answer had come out as one message every 2 seconds, one of the numbers would be wrong, and you would look for it now. Here it does not contradict the first route, and you say so: “That agrees, so I’ll go on.”

Two routes that agree within a factor of two are a good sign. Two that differ by a factor of ten mean a mistake in a unit or an assumption, and saying that you found it is better than not having made it.

Storage is the product of three things said aloud: how many messages, how big each is, and how long they are kept with how many copies. The calculator below starts on the global messaging numbers, with a year of retention. Its fields are Events per day (in millions), Size of one event, Retention and Copies of the data.

Storage calculator

Your numbers

million events per day

How many records, messages or rows are written each day.

kB

The average size of one event as it is stored, metadata included. Measure a sample: a size on the network is not a size on disk.

days

How many days the data is kept before it is deleted. Once the retention period has filled, the storage stops growing.

copies

How many full copies are stored: 1 is no replica, 3 is a primary and two replicas.

Changing the numbers needs JavaScript. The result is for the starting numbers.

Result

Storage to provision1.1 PB

Each day adds 3 TB, in all copies.

How it is calculated

Each step shows its formula, the numbers that go in, and the figure that comes out.

  1. Written per day, one copy

    W = E × s

    One day's events, each of the average size.

    E events per day
    5B
    s size of one event
    200 B

    W written per day, one copy1 TB

  2. Stored per day, all copies

    S = W × c

    Every copy is a full copy, so each day adds c times as much.

    W written per day, one copy
    1 TB
    c copies
    3

    S stored per day, all copies3 TB

  3. Stored once the retention period has filled

    R = S × t

    Data older than t days is deleted, so after t days the storage stops growing. This is the figure to provision.

    S stored per day, all copies
    3 TB
    t retention in days
    365

    R storage once the retention period has filled1.1 PB

Written and still stored over a period, all copies
Period (days)WrittenStill stored
13 TB3 TB
3090 TB90 TB
365 · your retention1.1 PB1.1 PB
Model notes

Assumptions

  • The same number of events arrive every day. Real volumes grow, peak and fall, so check the growth separately.
  • Every event takes the average size. A few very large events can change the total, so use the average of the whole stream, not of a sample of small ones.

Simplifications

  • Only the events are counted. Indexes, metadata and logs add bytes, and compression removes some, so the size on disk differs from this figure.
  • Each copy is a full copy. Storage that uses erasure coding keeps less than the same number of full copies would.
  • No headroom is added. Disks are not filled to the brim, and a system needs room to grow and to rebuild after a failure, so provision more than this figure.
  • Sizes use decimal units: 1 TB is 10^12 bytes. Some tools show binary units, where 1 TiB is 2^40 bytes, about 10% more than 1 TB.
  • In back-of-envelope mode, the counts and sizes you enter are rounded to the nearest power of ten before anything is calculated. The result is an order of magnitude, not a figure to buy against.

Parameter values are illustrative. They are not benchmarks of any real product.

5 billion messages of 200 bytes are 1 TB written each day, for one copy. A year is 365 TB, and three copies make 1,095 TB, which is about 1.1 PB. The size of a message is the number to say with most care. If 200 bytes is really 1,000, with the metadata a real message carries, every storage figure is 5 times larger: 5 TB a day, and 5,475 TB, about 5.5 PB, for a year of three copies. The honest answer is the one with the assumption attached: “At 200 bytes, about 1.1 PB; at 1 kB it is five times that.”

The link is a smaller number: 173,611 messages of 200 bytes are 34.7 MB a second, which is about 278 Mbps. It counts only the messages coming in. Every message is also delivered to its recipients, so the traffic going out is larger, by the average number of recipients. Say that in one sentence and move on: bandwidth is not the constraint here.

An estimate that ends in a number has not finished. The last link is the one that decides something, and it is the one that interviewers most often wait for.

Earlier in the course a database that answers an indexed lookup in 5 ms, four at a time, did 800 per second (URL shortener). That figure belongs to that model, and it is used here only to show the form of the sentence. If a database of that kind had to absorb the peak of 173,611 writes a second, it would take about 217 of them (173,611 ÷ 800 = 217). The sentence for the interview is then: “A single primary cannot absorb the writes, so the data has to be split across many machines, and I’ll choose the key to split on.” That is the design decision the arithmetic forces.

The same exercise gives the opposite conclusion for some numbers. One terabyte a day is a lot of storage over a year, but its size is not what shapes the design; the rate of writes is. Say which of your numbers is the constraint and which are not, as the URL shortener estimate does when it finds that its first limit is reads.

Use the same five moves every time. They are step 3 of the 10-step model in the first lesson, Estimate, made concrete, and the first of them is a piece of step 1, Clarify.

  1. Ask what the number counts. Sent or delivered, per user or per account, one region or all.
  2. State the assumptions before using them, with a number each: the peak ratio, the size, the copies, the retention.
  3. Compute in the open, in round numbers, and say what you rounded.
  4. Check by a second route, and say whether it agrees.
  5. Say what it means: which number is the constraint, and what it forces in the design.

The Arena’s estimation stage asks for numbers in labelled fields and shows afterwards whether each is within a tolerance of the expected figure. That check is a convenience and is never counted in your score. What you score yourself on, with the rubric, is the working: were the assumptions stated, was the arithmetic shown, and did it end in a design consequence. Try the habit on the URL shortener and global messaging scenarios, and write the working, not only the results.

A short check of the method follows.

Interview Arena: check the estimate

This quiz needs JavaScript to check your answers.

Question 1 of 5

A brief says: 100 million users, 20 million active on a day, 5 billion messages a day.

About how many messages per second is that on average? Use 86,400 seconds for a day.

Enter a number and choose its unit.

Question 2 of 5

Your first route gives a peak of 1,736,111 messages per second. The brief implies 4 million people connected at the peak, so by a second route each of them would send a message about every 2.3 seconds.

What do you do?

Choose one answer.

Question 3 of 5

You estimated 5 billion messages a day at 200 bytes each: 1 TB a day, and with a year of retention and 3 copies, 1,095 TB. The interviewer asks: "And if a message is really 1 kB?"

Which answer is the best one?

Choose one answer.

Question 4 of 5

5 billion messages a day, 200 bytes each, kept for 365 days, with 3 copies of the data.

About how much storage is that?

Enter a number and choose its unit.

Question 5 of 5

The peak is 173,611 writes per second. In the course model a database does 800 operations per second, so 173,611 ÷ 800 is about 217 of them.

Which sentence is the best last link of the estimate?

Choose one answer.

What happens if an estimate is off by a factor of ten?

Section titled “What happens if an estimate is off by a factor of ten?”

The usual causes are small. A missing zero, users where the brief meant active users, a per-minute rate used as a per-second rate, a size in bits where bytes were meant. They are easy to make in a hurry and each is large.

Suppose the peak comes out ten times too low, 17,361 messages a second instead of 173,611. At 800 per second per database that is 17,361 ÷ 800 = 21.7, so you would say 22 databases, which can serve 22 × 800 = 17,600 a second. The real peak, 173,611, is 986% of that. It is the situation described in the first lesson of the capacity module: above 100% there is no steady state, and the queue grows for as long as the peak lasts. The design you drew would fail at its first busy hour, and the interviewer will find it by asking one question about the peak.

Suppose it comes out ten times too high instead, 1,736,111 a second. You would say about 2,170 databases rather than 217. Nothing breaks, but the design costs ten times as much and the interviewer will wonder whether you can tell a plausible number from an implausible one. The two mistakes are not equal in a real system, where an undersized one fails and an oversized one wastes money, and neither is a good answer.

The most common slip is the one in the brief: 100 million users is not 20 million. Using the larger number gives 25 billion messages a day and 289,352 a second on average, five times too high. The second route above catches it, because the number of connected users it needs is no longer plausible. That is what the second route is for.

  • In an interview the estimate is judged by its reasoning: say what you count, state each assumption before you use it, and end with what the number means for the design.
  • For the brief of 100 million users, 20 million of them active, and 5 billion messages a day: 250 messages per active user, 57,870 messages per second on average and 173,611 at a peak of 3 times the average, said as about 174,000.
  • Storage is 1 TB a day at 200 bytes a message, 365 TB for a year, and 1,095 TB (about 1.1 PB) with 3 copies. At 1,000 bytes it is five times that. The link for the incoming messages is about 278 Mbps.
  • Round in the open: using 100,000 seconds for a day gives 50,000 a second, about 14% below the exact figure. Say what you rounded.
  • Check by a second route: 4 million connected users would each send a message about every 23 seconds at the peak.
  • A peak ten times too low gives a design at 986% of its capacity, and one ten times too high costs ten times as much. Using users instead of active users makes the average five times too high, at 289,352 a second.

Next: drawing and checking an architecture, and why a drawing needs the same arithmetic.

Your progress

Built by GhaziAlibi.

© ShardCraft. All rights reserved.