Lessons

Choose one. Each lesson is a short read with live diagrams inside the text.

What is system design?

  1. 01What system design isFrom one sentence in a meeting to a design that survives failure, built one fix at a time. 14 min
  2. 02Back of the envelope estimationTurn "lots of users" into writes per second, terabytes, bandwidth and cache size. 15 min
  3. 03The interview frameworkSeven steps that turn an open question into a complete, defensible design. 12 min

Building blocks

  1. 04Scalability, reliability and availabilityHow systems grow, how they survive faults, and what the nines really mean. 14 min
  2. 05Load balancers and proxiesHow requests are shared across servers, and the proxies that sit in the middle. 13 min
  3. 06CachingKeep copies of expensive answers close, and decide when those copies are allowed to be wrong. 15 min
  4. 07Databases and indexesChoose between SQL and NoSQL from the shape of your data, and learn what an index buys and costs. 15 min
  5. 08Sharding and consistent hashingSplit data across machines, choose a shard key, and avoid reshuffling everything when machines change. 20 min
  6. 09CAP and PACELCWhat a distributed store must give up when the network breaks, and what it trades even when it does not. 18 min
  7. 10Talking to clientsPolling, long polling, WebSockets and server sent events, and how to scale each. 17 min

Classic designs

  1. 11URL shortener and PastebinTwo read heavy storage services built with the same ideas: unique keys, caching and expiry. 24 min
  2. 12Instagram and DropboxPhoto sharing and file sync: separating metadata from blobs, building feeds, and syncing only what changed. 26 min
  3. 13Messenger and TwitterReal-time messaging with delivery guarantees, and a social timeline built on fan-out. 26 min
  4. 14YouTube, Netflix and TypeaheadVideo upload, transcoding and streaming, plus fast autocomplete with a trie. 26 min
  5. 15Rate limiter and Twitter searchSaying no fairly at scale, and finding tweets by word with an inverted index. 26 min
  6. 16Web crawler and newsfeedVisiting billions of pages politely, and ranking a feed from thousands of candidates. 26 min
  7. 17Yelp and UberFinding things near a point on Earth, for places that rarely move and drivers that never stop. 26 min
  8. 18TicketmasterSelling each seat exactly once, even when a million people want the same twenty thousand. 24 min

Systems under the hood

  1. 19DynamoA key value store designed to always accept writes, built from rings, quorums, vector clocks and gossip. 28 min
  2. 20CassandraA wide column database that combines Dynamo's distribution with an append-only storage engine. 28 min
  3. 21KafkaA distributed commit log: partitions, replication, consumer groups and delivery guarantees. 28 min
  4. 22ChubbyA small, highly available lock service that lets large systems elect leaders and agree on facts. 26 min
  5. 23GFS and HDFSDistributed file systems built for huge files on cheap machines that fail constantly. 28 min
  6. 24BigTableA sorted, sparse, distributed table that stores petabytes by building on GFS and Chubby. 28 min

Patterns

  1. 25Bloom filters and checksumsAnswer 'have I seen this?' in a few bits, and detect silent data corruption. 18 min
  2. 26Quorum and leader electionHow a group of machines agrees on a value, and on who is in charge. 18 min
  3. 27Logs: write-ahead, segmented and high-water markThe append-only log pattern, and how systems store, replicate and trim it safely. 18 min
  4. 28Heartbeat, gossip and failure detectionHow a cluster learns who is alive, without a central watcher and without guessing wrongly. 18 min
  5. 29Leases, fencing and split brainSafe ownership when clocks drift, processes pause and networks split. 18 min
  6. 30Vector clocks and repairDetect concurrent updates, then bring diverged replicas back together. 18 min

Programming foundations

  1. 31Data, functions and stateThe three ingredients of every program, and why most bugs live in the third. 14 min
  2. 32Mutability and pure functionsWhy changing data in place causes surprises, and how to keep decisions separate from effects. 14 min
  3. 33Modules, interfaces and APIsHide detail behind a small, stable surface so each part can change without breaking the rest. 13 min
  4. 34The limits of procedural codeWhere functions and shared data start to hurt, and what structure we need next. 12 min

Design principles

  1. 35SOLIDFive principles that keep classes easy to change, shown on one growing parking lot. 15 min
  2. 36GRASPNine questions for deciding which object should own which responsibility. 13 min
  3. 37DRY, KISS and YAGNIThree simplicity rules, and what to do when they point in different directions. 11 min
  4. 38Composition, Demeter and contractsBuild behavior by combining parts, limit what objects know, and state the promises in code. 14 min

Modeling with UML

  1. 39Requirements and use casesTurn a vague idea into actors, goals and nouns and verbs you can design from. 13 min
  2. 40Class diagrams and relationshipsRead and draw the boxes and arrows that describe a system's structure. 14 min
  3. 41Sequence, state and activity diagramsShow behavior over time, the life of one object, and the flow of a whole process. 13 min

Design patterns

  1. 42Creational patternsControl how objects are made so that callers do not depend on concrete classes. 14 min
  2. 43Structural patternsWrap, combine and simplify objects so incompatible or complex parts fit together. 14 min
  3. 44Behavioral patternsPatterns for how objects share work, react to change and swap behavior. 15 min

Advanced LLD

  1. 45Concurrency and error handlingKeep shared data correct when things overlap, and fail in ways you can recover from. 15 min
  2. 46Caching, rate limiting and persistenceBuild three common infrastructure pieces inside a codebase, behind clean interfaces. 15 min
  3. 47Events, extensibility and testabilityDecouple parts with events, leave safe places to grow, and shape code so it can be tested cheaply. 20 min

LLD problems

  1. 48Tic-tac-toeA complete first design, from requirements to entities to code to extensions. 20 min
  2. 49Parking lotEntities, slot allocation, pricing and concurrency for the classic multi-floor design. 22 min
  3. 50Vending machineA state machine in practice, with inventory, money handling and exact change. 20 min
  4. 51Airport gate assignmentScheduling under constraints, from the interval idea to a working, adjustable assigner. 22 min