๐ขKey Takeaways
- 1Estimation is about getting the right order of magnitude, not exact numbers
- 2Key numbers: 1 day โ 100K seconds, 1 million requests/day โ 12 QPS
- 3Always estimate: QPS, storage, bandwidth, and number of machines needed
- 4Round aggressively โ 86,400 seconds becomes 100,000 for mental math
Why Estimation Matters
In system design interviews and real-world architecture, you need to quickly estimate whether a single database can handle the load or if you need sharding, whether data fits in memory or needs disk storage, and how many servers you need.
The goal isn't precision โ it's getting within the right power of 10. If you calculate 50K QPS and the real answer is 70K, that's fine. If you calculate 500 QPS when it's really 50K, that's a critical miscalculation.
Numbers Every Engineer Should Know
| Operation | Time | Notes |
|---|---|---|
| L1 cache reference | ~1 ns | On-chip, fastest memory |
| L2 cache reference | ~4 ns | On-chip |
| Main memory reference | ~100 ns | RAM access |
| SSD random read | ~16 ยตs | NVMe SSD |
| HDD seek | ~2 ms | Mechanical disk |
| Same-datacenter roundtrip | ~0.5 ms | Network within DC |
| Cross-datacenter roundtrip | ~50-150 ms | Depends on distance |
| Send 1 MB over network | ~10 ms | 1 Gbps network |
| Read 1 MB from SSD | ~1 ms | Sequential read |
| Read 1 MB from HDD | ~20 ms | Sequential read |
Common Estimation Patterns
Formula: DAU ร actions per user / seconds per day
Shortcut: 1 million requests/day โ 12 QPS (since 86,400 โ 100K seconds โ 1M/100K โ 10-12 QPS)
Peak QPS = Average QPS ร 2-3x (for most social/content apps)
Example: Twitter โ 300M DAU ร 10 reads/day = 3B reads/day โ 35K QPS avg, ~100K peak
Identify the data objects (posts, users, messages) and estimate size per object.
Example: Each tweet = 280 chars + metadata โ 500 bytes. 500M tweets/day ร 500 bytes = 250 GB/day โ 90 TB/year.
For images: 200KB average. For videos: 5-50MB depending on quality.
Bandwidth = QPS ร average response size
Example: 35K QPS ร 2KB response = 70 MB/s = 560 Mbps (manageable for a cluster)
A typical web server handles 500-1000 concurrent connections and ~10K-50K requests/second depending on complexity.
For CPU-bound: servers = peak QPS / QPS per server
For memory-bound: servers = total memory needed / memory per server
Always add 30-50% overhead for fault tolerance.
Powers of 2:
2^10 = 1 KB (thousand)
2^20 = 1 MB (million)
2^30 = 1 GB (billion)
2^40 = 1 TB (trillion)
2^50 = 1 PB (quadrillion)
Time conversions:
1 day = 86,400 sec โ 100K sec
1 month = 2.6M sec โ 2.5M sec
1 year = 31.5M sec โ 30M sec
Quick QPS:
1M req/day โ 12 QPS
10M req/day โ 120 QPS
100M req/day โ 1,200 QPS
1B req/day โ 12,000 QPS
Typical server capacity:
Web server: 1K-10K QPS (simple endpoints)
DB (SQL): 5K-30K QPS (indexed reads)
Redis: 100K-500K QPS (get/set)
Kafka: 100K-1M messages/sec (per partition)Advantages
- โขLets you make data-driven design decisions in seconds
- โขImpresses interviewers and shows engineering maturity
- โขPrevents over-engineering or under-engineering solutions
Disadvantages
- โขNumbers can vary wildly depending on context
- โขEasy to get the wrong order of magnitude if assumptions are off
- โขRequires memorizing key reference numbers
๐งช Test Your Understanding
Approximately how many QPS is 1 billion requests per day?