Skip to content

First principles · 2 of 4

Napkin math

Step 1 · The pattern

From a day to a second

The shop takes 8.6 million checkouts a day. A day has 86,400 seconds, so that is about 100 a second on average. The database was sized for that: a quiet afternoon at the average rate is easy. (Numbers are illustrative; one dot here stands for 100 checkouts a second.)

  • a checkout
  • done

In short

Napkin math: how it works and how it breaks

Capacity starts with arithmetic you can do on a napkin. 8.6 million checkouts a day is about 100 a second on average, since a day has 86,400 seconds. Traffic bunches into peaks, though: at dinner here it reaches five times the average. And one checkout is not one database call: it reads the cart, checks stock, writes the order and records the payment, four queries in all. A database sized for 100 queries a second therefore meets 2,000 at dinner and collapses. The estimate that holds multiplies the average by the peak factor and by the calls each action makes, then divides by a target utilisation of about 70% to leave headroom for bursts and for losing a server. Write the working down, so the next person can check each step.

What this simulation simplifies

  • The simulation is scaled down: one dot a second stands for 100 checkouts a second.
  • Every query takes the same time here; real queries vary widely, and slow ones cut capacity further.
  • Extra capacity is shown as read replicas taking a share of queries; writes usually need sharding or a bigger primary instead.

How this comes up in interviews

"Estimate the read and write load for a service with 50 million users. Walk me through it."

Then they ask

  1. What peak factor would you use, and why?
  2. How much storage after three years?
  3. Which number in your estimate are you least sure of?

A strong answer covers

  • State assumptions out loud: daily active users, actions per user, read/write mix.
  • Daily total ÷ 86,400 for the average; multiply by a peak factor from real traffic shapes.
  • Multiply by fan-out: the calls each action makes to each backend.
  • Divide by a target utilisation (around 60-70%) for headroom.
  • Storage: bytes per item × items × retention × copies.

Points to cover, not a script. Say them in your own words and tie them to a system you have worked on.

On one page: the track cheat sheet.

Last reviewed: Official documentation

Diagrams are our own simulations: the timings, rates and counts in them are illustrative, not measurements. Captions are original wording.