2. Back-of-Envelope Estimation
1
The picture to keep in your head2
2.1 Why estimate at all?3
2.2 Which units and sizes should you know?4
2.3 What time shortcuts make the maths easy?5
2.4 Which latency numbers should every developer know?6
2.5 How do you turn daily users into requests per second?7
2.6 Why does the read/write ratio matter?8
2.7 Why size for the peak, not the average?9
2.8 How do you estimate storage over the years?10
2.9 How do you estimate bandwidth?11
2.10 How much memory does the cache need?12
2.11 How many servers do you need?13
2.12 How do you round, and how do you know you're not way off?14
Memory card and where the analogy breaks15
Practice: five levels16
Interview questions17
Solutions18
Sources19
Code lab2. Back-of-Envelope Estimation
Memory card and where the analogy breaks
3 min read+10 XP
The memory card (tear this page out)
| # | Question | Memory code |
|---|---|---|
| 2.1 | Why estimate? | Size decides shape |
| 2.2 | Units? | King Midas Gave Tea Parties: KB, MB, GB, TB, PB, each ×1,000 |
| 2.3 | Time shortcuts? | A day is 100k seconds. A million a day is 12 a second. |
| 2.4 | Latency numbers? | Nano for memory, micro for the building, milli for the disk and the world |
| 2.5 | Users to requests per second? | Times, divide, times |
| 2.6 | Read/write ratio? | Read-heavy? Copy it. Write-heavy? Spread it. |
| 2.7 | Peak vs average? | Plan for 1 pm, not the daily average |
| 2.8 | Storage? | Writes × size × days × copies |
| 2.9 | Bandwidth? | Network speaks bits, storage speaks bytes. Times eight. |
| 2.10 | Cache memory? | Cache the hot 20% |
| 2.11 | Servers? | Peak ÷ per-server, leave headroom, add a spare |
| 2.12 | Rounding and checks? | Right zeros, not right decimals |
The whole chapter in one line: Count the guests, plan for the lunch rush, round hard, and never forget the times eight.
Where the analogy breaks
- Guests don't multiply overnight. Users can. A viral moment can bring 10 times the traffic in an hour, so systems need room to grow quickly (autoscaling, Chapter 6).
- Food is eaten once. Data is kept, copied and backed up. Storage keeps growing every day, which is why you multiply by years and copies.
- A caterer sees the guests arrive. A system has to predict them. That's why you state your assumptions and design for the peak.
Quick check
Five questions on this chapter. Pick an answer, then check it.
quiz