System Lab
Live

Requests flow from Users through the balancer to three servers.

Users34 req/sLoad balancerchecking healthServer 10/4 busyServer 20/4 busyServer 30/4 busyCache18/18 itemsDatabase0/4 busyUsersLoad balancerServer 1Server 2Server 3Cache18/18 itemsDatabase
Response timetarget ≤ 400 ms
400 ms
Cache hits
80%
Failed
0%

The route

Lines are topics; zones are levels. Ride the recommended path from N1, or jump to any station. A dimmed one is best after another.

Zone 1Beginner15 lessonsZone 2Intermediate28 lessonsZone 3Advanced14 lessonsN2AcknowledgementsN3Latency vsbandwidthN4Handshakes andkeep-aliveN5DNS: findingthe serverN6Windows andflow controlN7Long polling, SSEand WebSocketsN8Timeouts anddeadline propagationN9CongestioncontrolN10Head-of-line blockingand multiplexingN11L4 vs L7: balancers,proxies, gatewaysN12Heartbeats andkeepalivesN13Pipeliningand batchingN14At-most-once,at-least-once, exactly-onceN15BackpressureN16Nearest regionand failoverF1Latency &throughputF2Scaling up vsscaling outF3Load balancingF4Health checks& failoverF5Stateless serversand sessionsF6Nines, SLOs anderror budgetsC1CachingC2Content deliverynetworksC3Expiry &stale dataC4Cache stampedeC5Misses thatnever hitC6Write-through,write-behind, cache-asideD1IndexesD2Read replicasD3ShardingD4ConsistenthashingD5Connection poolsD6Primary failoverD7Consistency vsavailabilityD8Quorum readsand writesD9Leader election(Raft)D10Locks anddouble bookingA1Message queuesA2Publish /subscribeA3Retries &backoffA4Idempotency keysA5Poison messages anddead-letter queuesA6The outboxpatternA7Partitions, orderingand consumer groupsA8Windows andaggregationA9Sagas: multi-step workthat fails halfwayR1Rate limitingR2Circuit breakersR3AutoscalingR4Load sheddingand priorityR5BulkheadsR6CascadingfailuresR7Cold caches andthundering herdsR8Hedged requests:beating tail latencyO1Canary rolloutsO2Graceful shutdownand drainingS0Keep a URL shortener aliveS1Crawl the webS2Serve a premiere to the worldS4Sell 1,000 seats to 100,000 peopleS7Charge exactly onceS3Keep a chat liveS6Build a news feedS5Match a rider to the nearest driverS8Count a billion clicks

  1. Networking0 of 16 visited
    1. N1A request and a responseBeginner · 4 min · start here
    2. N2AcknowledgementsBeginner · 4 min · after N1
    3. N3Latency vs bandwidthBeginner · 4 min · after N1
    4. N4Handshakes and keep-aliveBeginner · 4 min · after N1
    5. N5DNS: finding the serverBeginner · 4 min · after N1
    6. N6Windows and flow controlIntermediate · 7 min · after N2, N3
    7. N7Long polling, SSE and WebSocketsIntermediate · 7 min · after N4, A2
    8. N8Timeouts and deadline propagationIntermediate · 7 min · after N1, F1
    9. N9Congestion controlIntermediate · 7 min · after N6
    10. N10Head-of-line blocking and multiplexingIntermediate · 7 min · after N4, N2
    11. N11L4 vs L7: balancers, proxies, gatewaysIntermediate · 7 min · after F3, N4
    12. N12Heartbeats and keepalivesIntermediate · 7 min · after N7, F4
    13. N13Pipelining and batchingIntermediate · 7 min · after N1, N3
    14. N14At-most-once, at-least-once, exactly-onceAdvanced · 10 min · after N2, A1
    15. N15BackpressureAdvanced · 10 min · after N6, A1
    16. N16Nearest region and failoverAdvanced · 10 min · after N5, C2, F4
  2. Foundations0 of 6 visited
    1. F1Latency & throughputBeginner · 6 min · after N1
    2. F2Scaling up vs scaling outBeginner · 6 min · after F1
    3. F3Load balancingBeginner · 6 min · after F2
    4. F4Health checks & failoverBeginner · 6 min · after F3
    5. F5Stateless servers and sessionsBeginner · 4 min · after F2, F3
    6. F6Nines, SLOs and error budgetsBeginner · 4 min · after F2, F4
  3. Caching0 of 6 visited
    1. C1CachingBeginner · 6 min · after F1
    2. C2Content delivery networksBeginner · 6 min · after C1
    3. C3Expiry & stale dataIntermediate · 6 min · after C1
    4. C4Cache stampedeIntermediate · 6 min · after C3
    5. C5Misses that never hitIntermediate · 7 min · after C1, C4
    6. C6Write-through, write-behind, cache-asideIntermediate · 7 min · after C1, C3
  4. Data0 of 10 visited
    1. D1IndexesBeginner · 4 min · after F1
    2. D2Read replicasIntermediate · 6 min · after D1, C1
    3. D3ShardingIntermediate · 6 min · after D2
    4. D4Consistent hashingIntermediate · 7 min · after D3
    5. D5Connection poolsIntermediate · 7 min · after N4, F1
    6. D6Primary failoverIntermediate · 7 min · after D2, F4
    7. D7Consistency vs availabilityAdvanced · 8 min · after D2, N2
    8. D8Quorum reads and writesAdvanced · 10 min · after D2, D7
    9. D9Leader election (Raft)Advanced · 10 min · after D7, D6, N12
    10. D10Locks and double bookingAdvanced · 10 min · after F1, D3
  5. Async0 of 9 visited
    1. A1Message queuesBeginner · 6 min · after F1
    2. A2Publish / subscribeIntermediate · 6 min · after A1
    3. A3Retries & backoffIntermediate · 7 min · after F1, N2
    4. A4Idempotency keysIntermediate · 7 min · after A3, N2
    5. A5Poison messages and dead-letter queuesIntermediate · 7 min · after A1, N14
    6. A6The outbox patternAdvanced · 10 min · after A2, A4
    7. A7Partitions, ordering and consumer groupsAdvanced · 10 min · after A1, D3
    8. A8Windows and aggregationAdvanced · 10 min · after A7
    9. A9Sagas: multi-step work that fails halfwayAdvanced · 10 min · after A6, D10
  6. Resilience0 of 8 visited
    1. R1Rate limitingIntermediate · 6 min · after F1
    2. R2Circuit breakersIntermediate · 7 min · after N8
    3. R3AutoscalingIntermediate · 7 min · after F3, F4
    4. R4Load shedding and priorityIntermediate · 7 min · after F1, N8
    5. R5BulkheadsIntermediate · 7 min · after R2
    6. R6Cascading failuresAdvanced · 10 min · after R4, F2, R3
    7. R7Cold caches and thundering herdsAdvanced · 10 min · after C1, C4, F4
    8. R8Hedged requests: beating tail latencyAdvanced · 10 min · after F3, N8
  7. Operating0 of 2 visited
    1. O1Canary rolloutsIntermediate · 7 min · after F3, F4
    2. O2Graceful shutdown and drainingIntermediate · 7 min · after F4
  8. Journeys0 of 9 visited
    1. S0Keep a URL shortener aliveIntermediate · 20 min · after C1, F3, F4, D2, R1
    2. S1Crawl the webAdvanced · 20 min · after A1, N14, A5
    3. S2Serve a premiere to the worldAdvanced · 20 min · after C2, C4, N16
    4. S3Keep a chat liveAdvanced · 20 min · after N7, N11, N12
    5. S4Sell 1,000 seats to 100,000 peopleAdvanced · 20 min · after C1, D10, R1
    6. S5Match a rider to the nearest driverAdvanced · 20 min · after N13, D10, N16
    7. S6Build a news feedAdvanced · 20 min · after D3, R8, A2
    8. S7Charge exactly onceAdvanced · 20 min · after A4, A9, D10
    9. S8Count a billion clicksAdvanced · 20 min · after D3, A8, N14

Journeys

Real systems, built up stage by stage under growing traffic and failures. Each one rides several lines.

How to read a scene

Every scene draws a request the same seven ways. Shape and colour both carry the state, so a scene reads without colour too.

  1. Request. On its way, or waiting its turn.

  2. Running late. Past the latency target and still going.

  3. Answered. Heading back to the user with a good result.

  4. Stale answer. Answered, but with out-of-date data.

  5. Turned away. Refused fast on purpose: rate-limited or a fallback.

  6. Failed. An error. Dropped requests fall off the stage.

  7. Gave up. The user timed out. The work may still be running.