System design: the 8 steps0/59 done

System design: the 8 steps

A design round is graded on how you drive it. Say each step out loud before doing it, and keep an eye on the time.

1. RequirementsFunctional: what must it do? Non functional: scale, latency, consistency, availability. Ask, don't assume.
2. NumbersUsers, requests per second, read to write ratio, storage per year. Round hard; you only need the order of magnitude.
3. APIThree to five endpoints or messages. Names and fields make the scope concrete.
4. DataTables or keys, the primary key, the indexes your queries need. Where each piece of data lives.
5. High levelDraw the boxes: client, load balancer, services, database, cache, queue. Walk one request through it.
6. Deep divesPick the 2 or 3 hardest parts and go deep. Ask: "Which part would you like me to go into?"
7. FailuresWhat breaks at 10x? What if the cache, the queue or a region dies? Retries, idempotency, backpressure.
8. Trade-offsSay what you chose, what you gave up, and what you'd change at the next order of magnitude.

Numbers worth knowing

1 dayabout 100k seconds, so 1M a day is about 12 per second
Memory readabout 100 ns
Redis or Memcached call, same zoneabout 0.5 to 1 ms
Indexed Postgres or MySQL readabout 1 to 5 ms
Cross region round tripabout 50 to 150 ms
One Postgres primarythousands to tens of thousands of simple writes a second
One Redis instanceabout 100k simple operations a second
Availability99.9% is about 43 minutes down a month, 99.99% about 4

Phrases that help