The learning path
Learn system design, one idea at a time
88 short lessons in 7 modules. Each one has an analogy, a live demo to play with, and a one-question check.
Module 1 · Must know
Fundamentals
How a request gets from a phone to a server and back, and what can slow it down.
- 01Start here
Clients and servers
Every app is a conversation. A client asks for something, a server answers.
Live demoA request and its response
- 02
What happens when you open a website
Before a single byte of the page arrives, your browser finds the server, connects, and agrees on encryption.
Live demoEverything that happens before a page loads
- 03
HTTP and HTTPS
HTTP is the language browsers and servers speak. HTTPS is the same language, sealed in an envelope.
Live demoHTTP requests, status codes and encryption
- 04
Designing REST APIs
A REST API treats your data as things with addresses, and uses HTTP methods to act on them.
Live demoA REST API for users
- 05
DNS, the internet's phone book
DNS turns names people can remember into addresses computers can connect to.
Live demoLooking up shop.com
- 06
TCP vs UDP
TCP guarantees every byte arrives in order. UDP just sends and hopes, which makes it faster.
Live demoTCP vs UDP when a packet gets lost
- 07
WebSockets and real-time updates
Normal HTTP only answers questions. A WebSocket keeps a line open so the server can speak first.
Live demoPolling vs a WebSocket for chat messages
- 08
The OSI model in plain words
Networking is built in layers. Each one solves one problem and trusts the layers below it.
Live demoA message travelling down and up the 7 layers
- 09
Latency and throughput
Latency is how long one request takes. Throughput is how many you can finish per second. Push one too far and the other suffers.
Live demoOne server, more and more traffic
- 10
Serialization, JSON and Protobuf
To send data over a network you turn it into bytes. The format you pick affects size, speed and how easy it is to change later.
Live demoSending the same order as JSON and as Protobuf
Module 2 · Core
Backend architecture
How to arrange servers, queues and gateways so an app keeps working as it grows.
- 11
Monolith vs microservices
One big program is simple until it isn't. Many small services scale teams, at the price of more moving parts.
Live demoOne bug in payments: monolith vs microservices
- 12
API gateways
An API gateway is the single front door for all your services. It handles the shared chores so each service doesn't have to.
Live demoAn API gateway in front of three services
- 13
Reverse proxies
A reverse proxy stands in front of your servers and answers on their behalf. Clients never talk to your servers directly.
Live demoA reverse proxy in front of app servers
- 14
Load balancers
A load balancer spreads requests across many servers so no single one gets overwhelmed, and routes around servers that fail.
Live demoA load balancer and three servers
- 15
Scaling up vs scaling out
You can buy a bigger machine or add more machines. Bigger is simpler; more is what lets you grow without limit.
Live demoScaling up or scaling out
- 16
Service discovery
Servers come and go all the time. Service discovery keeps an up-to-date list so services can find each other.
Live demoFinding healthy payment servers
- 17
Message queues
A queue lets one part of a system hand off work and move on, while workers finish it at their own pace.
Live demoAn order queue with workers
- 18
Event-driven architecture
Instead of calling every service that cares, a service announces what happened and lets others react.
Live demoOne event, many reactions
- 19
Rate limiting
A rate limiter caps how many requests a client can make, so one noisy client can't take the service down for everyone.
Live demoA token bucket rate limiter
- 20
Circuit breakers
When a dependency keeps failing, stop calling it for a while. Failing fast protects both you and it.
Live demoA circuit breaker around a failing service
- 21
Retries and timeouts
Networks fail briefly all the time. Timeouts stop you waiting forever, and careful retries fix most blips without making things worse.
Live demoTimeouts, retries and retry storms
Module 3 · Very important
Database design
Storing data so it stays correct, fast to find, and safe when machines fail.
- 22
SQL vs NoSQL
SQL databases store tidy tables and answer any question. NoSQL databases store data shaped for specific questions and spread out easily.
Live demoThe same app on a SQL and a document database
- 23
Database indexes
An index is a sorted shortcut to your rows. It turns "check every row" into "follow three or four signposts".
Live demoFinding one user with and without an index
- 24
Normalization
Store each fact in exactly one place. Then a change is one write, and the data can't disagree with itself.
Live demoChanging an address: copied vs normalized data
- 25
Database replication
Keep live copies of your database on other machines, to share the reading and to survive a crash.
Live demoA primary database and two read replicas
- 26
Sharding
When one database can't hold all the data or take all the writes, split the data across several databases by a key.
Live demoSplitting users across database shards
- 27
Partitioning large tables
Split one huge table into smaller pieces inside the database, so queries only touch the pieces they need.
Live demoPartitioning an orders table by date or by hash
- 28
Transactions and ACID
A transaction groups several changes so they all happen or none do, even if the server crashes halfway.
Live demoMoving $100 from Alice to Bob
- 29
Isolation levels
Isolation levels decide how much transactions running at the same time can see of each other's changes.
Live demoTwo transactions touching the same balance
- 30
Deadlocks
A deadlock is two transactions each waiting for a lock the other holds. Neither can move until one is cancelled.
Live demoTwo transactions waiting for each other
- 31
Connection pooling
Opening a database connection is slow and each one costs the database memory. A pool opens a few once and shares them.
Live demoOpening connections vs reusing a pool
- 32
The CAP theorem
When the network splits a distributed database, it must choose between giving correct answers and giving any answer at all.
Live demoA network split between three database nodes
Module 4 · Core
Caching and performance
Keeping answers close by so you don't do the same slow work twice.
- 33
What is caching?
A cache keeps a copy of answers you'll need again somewhere much faster, so you don't redo slow work.
Live demoAn app with and without a cache
- 34
How Redis works
Redis is an in-memory data store that runs commands one at a time, very fast, with optional saving to disk and replicas.
Live demoInside Redis: one fast loop, memory, and a log
- 35
The cache-aside pattern
The app checks the cache first, fills it on a miss, and clears it on a write. The database stays the source of truth.
Live demoCache-aside: check the cache, then the database
- 36
Write-through vs write-back
Write-through saves to the cache and the database together. Write-back saves to the cache now and the database later, which is faster but riskier.
Live demoWrite-through vs write-back
- 37
Cache invalidation
When data changes, cached copies become wrong. Invalidation is how you get rid of them, and it's famously hard.
Live demoKeeping cached data fresh when it changes
- 38
Time to live (TTL)
A TTL is an expiry time on a cached value. It's the dial between fresher data and fewer trips to the database.
Live demoChoosing a TTL
- 39
Content delivery networks (CDNs)
A CDN keeps copies of your files on servers all over the world, so every user downloads from somewhere close.
Live demoA user in Sydney loading an image from a US server
- 40
Browser caching
The fastest request is the one never sent. HTTP headers tell browsers what they can reuse and for how long.
Live demoBrowser caching with Cache-Control and ETags
- 41
Database query optimization
Before adding caches or servers, make the queries themselves cheap. Most slow apps are slow because of a few bad queries.
Live demoLoading 10 posts with their authors
- 42
Hot keys
When one key gets a huge share of traffic, the single node holding it becomes the bottleneck, however many nodes you have.
Live demoOne viral key on a cache cluster
- 43
Cache stampedes
When a very popular cache entry expires, every request misses at once and they all rush the database together.
Live demoA popular cache entry expires
- 44
Distributed caching
When one cache server isn't enough, spread keys across a cluster, and choose a scheme that doesn't reshuffle everything when nodes change.
Live demoSpreading a cache over several nodes
Module 5 · Advanced
Distributed systems
Getting many machines to agree, even when messages get lost and machines crash.
- 45
Distributed systems fundamentals
Once your system runs on many machines, messages get lost, machines pause, and clocks disagree. Good designs assume all three.
Live demoTwo computers that can't be sure of anything
- 46
Consistency models
A consistency model is a promise about what reads can return when data has several copies.
Live demoWhat you see depends on which copy you read
- 47
Strong vs eventual consistency
Strong consistency makes every read up to date by waiting. Eventual consistency answers immediately and catches up later.
Live demoStrong vs eventual consistency
- 48
Consensus algorithms
Consensus lets a group of machines agree on a value, or an order of events, even when some of them crash.
Live demoFive nodes agreeing on every write
- 49
Leader election
Many systems let one node lead. When it dies, the others must notice and pick exactly one new leader.
Live demoChoosing a new leader
- 50
Distributed locking
A distributed lock makes sure only one machine does something at a time. It needs an expiry, and an expiry needs a fencing token.
Live demoA lock with a lease, and why it needs a fencing token
- 51
Race conditions
A race condition is when the result depends on the timing of things running at once. "Check, then act" is the classic trap.
Live demoTwo buyers, one ticket left
- 52
Idempotency
An idempotent operation has the same effect whether it runs once or many times. It's what makes retries safe.
Live demoRetrying a payment safely
- 53
At-most-once, at-least-once, exactly-once
Messaging systems can promise to never duplicate, or to never lose. True "exactly once" comes from never losing plus making duplicates harmless.
Live demoAt-most-once, at-least-once, exactly-once
- 54
Distributed transactions
When one action changes data in several services or databases, there's no single transaction to keep them in step.
Live demoOne order, three services, three databases
- 55
Two-phase commit
Two-phase commit makes several databases commit or abort together, by asking everyone to promise first.
Live demoTwo-phase commit
- 56
The saga pattern
A saga splits a long action into local steps, and if one step fails, it runs undo steps for the ones before it.
Live demoA saga with compensating steps
- 57
Fault tolerance
A fault-tolerant system keeps working when parts of it fail, because no single part is irreplaceable.
Live demoSurviving a server crash
- 58
High availability and the nines
Availability is the share of time a system works. Parts in a chain multiply their downtime; spare copies divide it.
Live demoHow many nines?
- 59
Data partitioning and rebalancing
Distributed databases split data into partitions spread over nodes, and move them as nodes come and go, ideally moving as little as possible.
Live demoRebalancing data when nodes join
- 60
Eventual consistency in practice
Eventually consistent systems let copies disagree for a while, spread updates in the background, and need a rule for resolving conflicts.
Live demoGossip until everyone agrees
Module 6 · Production
Reliability and infrastructure
Seeing what your system is doing, recovering from disasters, and shipping safely.
- 61
Observability: logs, metrics, traces
Observability is being able to answer "what is my system doing and why?" from the outside, using logs, metrics and traces.
Live demoFinding out why checkout is slow
- 62
Prometheus and Grafana
Prometheus collects numbers from your services on a schedule, Grafana charts them, and alert rules page someone when they go wrong.
Live demoPrometheus scraping three apps
- 63
OpenTelemetry
OpenTelemetry is a vendor-neutral standard for producing traces, metrics and logs, so you instrument your code once and send the data anywhere.
Live demoOne request, instrumented with OpenTelemetry
- 64
Health checks
Health checks let load balancers and orchestrators find broken or not-yet-ready instances and route around them automatically.
Live demoLiveness, readiness and deep health checks
- 65
Failover strategies
Failover moves work from a failed component to a standby. Doing it automatically is easy; doing it without ending up with two primaries is the hard part.
Live demoDatabase failover, and split brain
- 66
Disaster recovery
Disaster recovery is the plan for losing a whole data centre or region. Two numbers define it, how long you're down (RTO) and how much data you lose (RPO).
Live demoLosing a whole region
- 67
Backups
Replicas protect you from machines failing. Backups protect you from people, bugs and attackers, by letting you go back in time.
Live demoBackups: replicas aren't enough
- 68
SLIs, SLOs and SLAs
An SLI measures reliability, an SLO sets the target, and an SLA is a promise with penalties. The gap below perfect is your error budget.
Live demoAn error budget over 30 days
- 69
Docker and containers
A container packages an app with everything it needs, and runs it isolated on a shared operating system kernel. It's lighter and faster than a virtual machine.
Live demoVirtual machines vs containers on one server
- 70
Kubernetes fundamentals
Kubernetes runs containers across a fleet of machines. You declare what you want running, and it keeps working to make that true.
Live demoKubernetes keeping pods running
- 71
CI/CD
CI/CD automatically builds, tests and releases every change, in small steps, so shipping is routine instead of risky.
Live demoFrom commit to production
- 72
Horizontal autoscaling
An autoscaler adds servers when load is high and removes them when it's low, so you pay for what you need without falling over at peak.
Live demoAn autoscaler following the traffic
Module 7 · Advanced
AI infrastructure
How large language models are served: GPUs, batching, caching and retrieval.
- 73
GPU architecture and memory
GPUs have thousands of simple cores and very fast memory. For language models, how much memory and how fast it can be read matter more than raw compute.
Live demoWill this model fit on this GPU?
- 74
Model serving
Serving a model means running it behind an API for many users at once: the classic scaling problems, but with expensive GPUs.
Live demoServing a model on a few GPU servers
- 75
Inference optimization
Make models cheaper and faster to run by storing weights in fewer bits, doing less repeated work, and using hardware better.
Live demoMaking a 70B model fit with quantization
- 76
Batching
A GPU can generate the next token for many requests in the same pass for almost the same cost as one. Batching shares that pass.
Live demoGenerating answers one at a time vs in a batch
- 77
Continuous batching
Instead of waiting for a whole batch to finish, swap finished sequences out and new ones in at every step.
Live demoStatic vs continuous batching
- 78
The KV cache
When a model generates text, each new token looks back at all earlier ones. The KV cache saves that earlier work so it isn't redone for every token.
Live demoGenerating text with and without a KV cache
- 79
Tokenization
Models don't read characters or words. They read tokens, chunks of text mapped to numbers, and everything from cost to context limits is counted in them.
Live demoHow text becomes tokens
- 80
Embeddings
An embedding turns text (or an image) into a list of numbers, a point in space, so that similar meanings end up close together.
Live demoWords as points in a space of meaning
- 81
Vector databases
A vector database stores embeddings and finds the nearest ones to a query fast, using approximate indexes instead of comparing against everything.
Live demoSearching vectors: every point vs an index
- 82
RAG (retrieval-augmented generation)
RAG looks up relevant passages from your own data and puts them in the prompt, so the model answers from real, current facts instead of guessing.
Live demoAnswering from your own documents (RAG)
- 83
Semantic caching
A semantic cache reuses an LLM's answer when a new question means the same thing as an old one, even if the words differ.
Live demoA semantic cache in front of an LLM
- 84
Model routing
Not every prompt needs the biggest model. A router sends each request to the cheapest model that can handle it well.
Live demoSending each prompt to the right model
- 85
Streaming inference
Send each token to the user the moment it's generated. The total time is the same, but the wait feels far shorter.
Live demoWaiting for the whole answer vs streaming tokens
- 86
GPU scheduling
GPUs are scarce and expensive, so deciding which job runs where, and when, has a big effect on cost and waiting times.
Live demoPlacing GPU jobs on machines
- 87
Distributed model inference
When a model is too big or too slow for one GPU, split it across several, either by slicing every layer or by giving each GPU a group of layers.
Live demoSplitting a model across four GPUs
- 88
How vLLM works
vLLM is a popular LLM serving engine. Its PagedAttention manages KV cache memory like an OS manages RAM, so far more requests fit per GPU.
Live demoPaged KV cache, the idea behind vLLM