Lessons in this course (14)

1. Requirements and back-of-the-envelope estimation

Basic★ Must knowLesson 1 of 14

Functional requirements — features: "users post photos", "followers see a feed", "users like and comment". Non-functional requirements — qualities: availability (99.9 % = ~8.8 h downtime/year; 99.99 % = ~53 min), latency (p99 < 200 ms), throughput, durability, consistency, security, cost.

Useful numbers:

FactValue
Seconds per day~86,400 ≈ 10⁵
1 million requests/day≈ 12 requests/second average
Peak factor2–10× average
1 KB × 1 million1 GB
Memory read / SSD read / same-DC round trip / cross-continent100 ns / 100 µs / 0.5 ms / 150 ms

Example — photo sharing app: 50M daily active users, each views 20 photos and uploads 0.1 per day.

  • Reads: 50M × 20 / 86,400 ≈ 11,600 requests/s (peak ~50k/s) → heavy read caching + CDN.
  • Writes: 50M × 0.1 / 86,400 ≈ 58 uploads/s.
  • Storage: 5M photos/day × 500 KB ≈ 2.5 TB/day → ~900 TB/year → object storage, not a database.
  • Read:write ≈ 200:1 → optimise for reads.