Back-of-the-envelope calculations
easy 25 minA back-of-the-envelope calculation is a quick, rounded sum that tells you whether a design is feasible.
When it comes up
The moments this idea belongs in a design interview, and the moments it does not.
In the room
When to reach for the envelope
| You hear | Do | Say |
|---|---|---|
| "Millions of users" | Ask daily, and how many requests each | "Daily users, or registered? I will assume 10 million daily." |
| "Photos" or "video" | Storage a year and bytes out | "5 TB a day, so object storage and a CDN." |
| "Keep it forever" | Storage with a growth line | "365 TB a year. I would move old files to cheaper storage." |
| "Real time" | Open connections, messages a second | "100,000 connections, so three gateways." |
| "How many servers?" | Peak, capacity, 70%, spare | "73, if one really does 1,000 a second." |
Options
How to answer a scale question
"How many servers would this need?"
BreaksA number at once
- How
- "About 50."
- Limit
- Nobody can check it, and the first follow-up sinks it.
- Choose when
- Never.
WorksLoad divided by capacity
- How
- "50,000 a second over 1,000 each is 50."
- Limit
- Uses full machines and no spare, and may have used the average.
- Choose when
- As a first line, if you then fix it.
StrongPeak, 70%, spare, and the assumption to test
- How
- "Peak 50,000. At 70% of 1,000 that is 72, plus one spare. The 1,000 is a guess; I would load test it."
- Limit
- Ten seconds longer.
- Choose when
- Whenever machines are asked for.