System Design

One lesson a day, in order

A course in system design, written as a handbook: it starts from a single server and a single database and builds, one idea at a time, to designing whole systems at scale. Read it in order. Every lesson names the ones it stands on.

All lessons

Your progress

Loading your progress

67 of 90 lessons published. One more usually arrives every morning. Progress is saved in this browser only.

Add this feed to any podcast app.

Podcast feed

Phase 1

Foundations

Why one machine stops being enough, and the handful of ideas every distributed system is built from.

Done0 / 30

  1. Lesson 011: Read Replicas: Reading From a Copy

    What streaming replication actually copies, why every replica does all of your writing, which reads are allowed to move, and the error that only happens on a copy.

    20 min read

  2. Lesson 019: Idempotency: Safe to Retry

    Seventeen card charges in December with no order behind them, and the difference between an operation that is atomic and one that is genuinely safe to run twice.

    20 min read

  3. Lesson 021: Rate Limiting: Saying No Gracefully

    A bookshop's rate limit sat idle for six months, then refused twelve hundred customers on its busiest morning and never once refused the robot it was written for.

    20 min read

  4. Lesson 025: Back-of-the-Envelope Estimation

    How to get a usable number in four minutes from figures you already have, why the useful output is which term dominates, and when to distrust the answer.

    20 min read

Phase 2

Mechanisms

How the building blocks actually work, where they break, and the trade-offs behind each choice.

Done0 / 30

  1. Lesson 045: Search: The Inverted Index

    A bookshop that could not find the book called It, and what an inverted index really costs to read, to rank and above all to keep up to date.

    22 min read

  2. Lesson 049: API Gateways and Service Meshes

    A gateway adds a hop to the request path and a sidecar adds a step to the startup path, and neither moves the state your policies actually need.

    21 min read

  3. Lesson 056: Cost as a Design Constraint

    Sort a bill into rent, meters and somebody's afternoon before you read the total, because a loop in a template can cost as much as the whole fleet underneath it.

    21 min read

  4. Lesson 059: Audit Logs and Immutable Records

    You cannot make a record unchangeable, only make a change detectable, so the question is never whether the rows can be edited but who would be able to tell.

    22 min read

Phase 3

Design at scale

Whole systems, end to end: capacity, cost, failure, and the judgment to defend a design out loud.

Done0 / 7

  1. Lesson 062: Design a URL Shortener

    A shortener is one sleepy database and two decisions you can never take back: the key space you spend as you grow, and the promise every link keeps forever.

    24 min read

  2. Lesson 063: Design a Distributed Rate Limiter

    A limiter split across copies gets a caller's rate wrong in both directions, and the burst you already sold is what fixes it and sizes the counter tier.

    24 min read

  3. Lesson 064: Design a Key-Value Store

    A key-value store's two irreversible decisions are both about conflicts: whether two nodes may accept one key's writes, and whether it can read the value to merge them.

    25 min read

  4. Lesson 065: Design a Chat System

    A chat system's two irreversible decisions are who assigns a message's position and who owns the record of what you have seen. Only one makes a missing message visible.

    25 min read

  5. Lesson 066: Design a News Feed

    A feed's irreversible decisions are what a copy of a post may hold and whether the list you served was a record. Neither is the fan-out question.

    24 min read

  6. Lesson 067: Design a Notification System

    The push is an optimisation and the list is the guarantee, because a person can detect three separate failures here and the last hop belongs to somebody else.

    23 min read

The examples

Three made-up systems, used in every lesson

None of these exist. They are invented for this course and reused from lesson to lesson on purpose, so their numbers become familiar and each new idea lands on ground you already know. When a lesson says Marlow Books, this is who it means.

  • Marlow Books

    A small online bookshop

    Four people, one server and one Postgres database. About 40 requests a second on a normal day and ten times that in the week before Christmas. The one box that the early lessons stress until it breaks.

  • Stagefront

    An event ticketing service

    Quiet most of the time, then a stadium show goes on sale at 10:00 and two hundred thousand people press the same button in the same minute. Oversold seats are a lawsuit, so correctness matters as much as speed.

  • Galewatch

    Telemetry for wind farms

    Nine hundred turbines, a reading every two seconds, over links that drop for hours in bad weather and come back with a backlog. Dashboards that lag by seconds, reports that scan a year.