Course outline · 0% complete

0/29 lessons0%

Course overview →

Back-of-envelope numbers

lesson 9-1 · ~12 min · 25/29

Quiz

Warm-up from lesson 1-1: what is the formula that turns daily traffic into the load number designers use?

The numbers to memorize

Back-of-envelope estimation runs on a handful of memorized constants. One more term joins them, because interviewers use it in the first sentence of nearly every prompt: DAU, daily active users, the number of distinct users who open the product on a typical day. "Design this for 10 million DAU" hands you the seed number every other estimate grows from. These are the constants that pay rent:

FactValue
Seconds in a day86,400 ≈ 10⁵
Seconds in a year≈ 3.15 × 10⁷
1 KB / 1 MB / 1 GB / 1 TB10³ / 10⁶ / 10⁹ / 10¹² bytes
A tweet-sized record100 to 300 bytes
An image100 KB to 1 MB
Cache or memory readunder 1 ms
Database read10 to 50 ms
Same-region network hop1 to 2 ms
Cross-ocean round trip≈ 100 ms

And the method, unchanged since lesson 1-1: daily volume → per-second average → peak (× 5 or 10), plus record size → storage per day → storage per year. Round hard at every step. The goal is the right power of ten, because that is what picks the architecture.

Code exercise · python

Run this full estimation for a social app: 10 million DAU (daily active users), each posting twice a day, 300 bytes per post, peak factor 5. This is the write side of an interview estimate.

Code exercise · python

Your turn: estimate the read side. Same app, but reads outnumber writes 100 to 1. Compute reads per day (writes_per_day x read_ratio), the average reads per second (rounded), and the peak at 5x (rounded). Print the three lines exactly as shown.

Code exercise · python

Your turn: finish the storage estimate. The write side produced 6.0 GB of new posts per day. Compute a year of growth: print the GB per year (365 days) and the TB per year rounded to 2 decimals, exactly as shown.

Problem

Your estimate says peak reads are 115,741 per second and one read replica handles 15,000 reads per second. Before caching, how many replicas does the read tier need? (Round up.)