Part 8 of 9 · 2 min read
A full estimate, from question to decision
One estimate that ends in a design choice, using every tool from this page.
A full estimate, from question to decision
The task: "Estimate the load for a photo-sharing app." The numbers below are made up to show the method.
Assumptions (written first):
- 5,000,000 monthly users, 40 percent active each day: 2,000,000 daily users.
- Each active user views 20 photos and uploads 0.2 photos a day. (Most people look, few post.)
- An average uploaded photo is 2 MB. A viewed photo is served at 200 KB after resizing.
- Peak factor: 3.
- Photos are kept for 5 years, with 3 copies.
Requests.
- Views: 2,000,000 × 20 = 40,000,000 a day. ÷ 86,400 is about 460 per second. Peak is about 1,400.
- Uploads: 2,000,000 × 0.2 = 400,000 a day. ÷ 86,400 is about 4.6 per second. Peak is about 14.
Views outnumber uploads 100 to 1. The system is read heavy, which suggests caching and a content delivery network.
Storage.
- 400,000 photos × 2 MB = 800,000 MB = 800 GB a day.
- Per year: 800 GB × 365 is about 292,000 GB, which is about 292 TB.
- Five years: about 1,460 TB, which is about 1.5 PB.
- Three copies: about 4.4 PB.
Bandwidth.
- Views: 40,000,000 × 200 KB = 8,000,000,000 KB = 8 TB a day.
- Per second: 8 TB ÷ 86,400 is about 93 MB a second. At peak, about 280 MB a second, which is about 2.2 gigabits a second.
Decision. The request rate is small, so a handful of servers handle the logic. Storage is huge, about 4.4 PB, so photos need a special store built for big files (Level 2). Bandwidth is large, so a content delivery network is essential (Level 1). The estimate told which of the three problems matters most: storage and bandwidth, not request count.
Read it as
An estimate ends with a sentence that starts "so the design needs...". If it does not, the numbers were not used.
Check yourself:
- Which single number made the design choice for photos obvious?
- What would happen to storage if copies were reduced from 3 to 2?
Words you will meet
| Word | Plain meaning |
|---|---|
| Back-of-the-envelope estimation | A quick, rough calculation with stated assumptions |
| Round numbers | Simplified values that keep arithmetic easy |
| QPS | Requests that arrive each second |
| Peak QPS | The highest request rate to plan for |
| Bandwidth | Data moved each second |
| Latency | Time one operation takes |
| Availability | Share of time the system works as promised |
| SLA | A written promise about service quality |