A production service is one request path through a few layers (servers, data, slow work, failure handling, the model), and every building block on that path fixes one bottleneck at a price you can name; add it only when its bottleneck has arrived.
System design is the craft of keeping a product fast, correct and affordable as more people use it. The running example. A chat assistant powered by a large language model (LLM): people sign in, chat, upload documents and come back to their history. It starts on one machine with one user and grows to ten million registered users. Every child page of this topic uses the same product, so its numbers line up from page to page. Fig. 1 grows it one wall at a time, in the order the walls arrive: the part that breaks turns red, the building block that fixes it arrives green and names the child page that owns it, and the dots are requests on the paths they take.
Fig. 1 · The product grown wall by wall, each fix with its owner
202 Accepted at once. Owner: Queues, streams and async work.The walls' numbers are the illustrative ones of Steps 1 to 4 below, the derived ceilings of Step 5 and the estimate of Step 6, and the map below gives each fix its price; the layout (the request path in the middle, the model in front, slow work behind) is a drawing, not a deployment. A cache makes reads fast and data slightly stale; a queue makes requests fast and results late; a retry rescues one request and can sink the whole system: every green block is a fix with a price.
You need: nothing from other pages. The wire under Step 1 (DNS, TCP, TLS, HTTP) is Topic: protocols, the database under Step 2 is Topic: databases, and the engine under Step 5 is Topic: inference-and-serving; this page needs only their one-line definitions, given where they are used.
New terms (each defined where it first appears, and only these):
Three tools on this page span every child: the Scale simulator pushes traffic through the whole design and shows which part breaks first, Numbers to know holds the latency, throughput and price figures every page estimates with, and Case files tells real outages and redesigns, each tagged with the step it belongs to.
Fig. 1 adds these rows one at a time; the table puts them side by side. Read across a row: what breaks, the blocks that fix it, what those blocks give up, and the page that teaches them in depth. The price column is the part that only shows when the pages are side by side: every fix moves the problem somewhere else.
| Step | What breaks | Building blocks | What they cost | Owner |
|---|---|---|---|---|
| 1 One server | More requests arrive than one machine finishes | Bigger machine; more machines behind a load balancer; stateless servers | More machines; state moves to one shared database | Capacity planning and performance (balancing, queueing); Building a backend API (the service itself) |
| 2 Database | Every server waits on one database | Index, cache, read replicas, shards | Stale reads, replication lag, cross-shard queries; consistency | Topic: databases (indexes, caching, replicas, sharding); Distributed systems fundamentals (consistency, CAP) |
| 3 Slow work | Long jobs hold the slots quick requests need | Queue and background workers | Results arrive later; jobs run twice; backlogs hide overload | Queues, streams and async work |
| 4 Failure | Something is always failing; retries amplify it | Timeouts, retries with backoff and jitter, idempotency keys, breakers, shedding, SLOs, telemetry | Code that runs only when things are already wrong; extra load; storage for keys and signals | Reliability engineering; Observability |
| 5 GPU layer | A reply costs seconds of a GPU, not milliseconds of a CPU | Batching, prefix caching, model routing, token rate limits | Latency per user for throughput; wrong cached answers; GPUs slow to add | ML system design; Gateways and routing; Topic: inference-and-serving |
| 6 Method | A fix that takes months, or a design asked for before the system exists | Requirements, estimates, API, data model, boxes, deep dives | Time up front; estimates are only as good as their stated assumptions | System design case studies; Capacity planning and performance (capacity planning) |
| Every step | The code itself gets harder to change safely | Tests at the right layer; modules that hide their decisions | Time per change; a suite to keep fast and honest | Testing and quality; Code design |
Two splits that are easy to miss. Idempotency appears in three places: the HTTP key on one request is Service APIs (section 4), a consumer that ignores a second delivery is Queues, and why exactly-once can only be built end to end is Distributed systems fundamentals (section 9). Pools and the GIL: how many connections and cores a service needs is Capacity planning; how one Python service waits (async, threads, workers) and holds a connection inside a handler is Building a backend API; the pooler in front of Postgres is Running Postgres in production.
One message is a short chain: DNS turns chat.example.com into an address, TCP opens a connection (one round trip), TLS encrypts it (one more in TLS 1.3; reusing an open connection skips both), and an HTTP request such as POST /chats/42/messages reaches a server process, which checks who you are, reads and writes the database (which keeps data safe on disk: the server can crash and restart, the data must never be lost), calls the model and streams the reply. Each hop's typical time is in Numbers to know; the wire itself is Topic: protocols.
Two words measure it all. Latency is how long one request takes; throughput is how many finish per second. Latency is quoted as percentiles (p50 the typical request, p99 the slowest 1 in 100), because an average hides the slow tail.
Vertical scaling (a bigger machine) needs no code change and is the right first move, but it has a ceiling and stays a single point of failure. Horizontal scaling adds machines behind a load balancer, which hands each request to one of them and stops sending to any that fails its health checks. It has one precondition that changes how code is written: servers must be stateless, so the session moves into the database, a shared cache or a signed token, and any server can answer any request.
| Fix | What it does | What it costs | Owner |
|---|---|---|---|
| Index | A sorted structure from a column's values to its rows, so "messages of chat 42" skips the full scan | Every write updates every index; but many "the database is slow" incidents end with one missing index | Storage engines and indexes |
| Cache | Copies of answers in memory; cache-aside checks it first and fills it on a miss. At a 90% hit rate the database sees one read in ten | Stale reads, bounded by a TTL or fixed by invalidation; a cold cache sends the full load to a database sized for a tenth of it | Caching; hit-rate maths and stampedes in Capacity planning |
| Read replica | A full copy fed by the primary, which takes every write; reads spread over the copies | Replication lag: a user's own message can vanish on refresh unless recent writes are read from the primary | Scaling a database |
| Sharding | Each of several databases holds a slice, chosen by a shard key (shard by user) | Queries across users ask every shard; resharding moves data; one hot user stays on one shard. Usually the last resort | Scaling a database; partitioning in Distributed systems fundamentals |
What every copy gives up: consistency. Caches and replicas keep several copies, and copies disagree for a moment after every change. Strong consistency (linearisability) means every read sees the latest write, as if there were one copy; eventual consistency means copies converge once writes stop. CAP: while the network between copies is broken, a system either refuses some requests or answers with possibly stale data. PACELC adds the everyday half: when nothing is broken, it trades latency against consistency. In practice the choice is made per piece of data: a paid credit balance must be strongly consistent (never spend the same credit twice); the order of chats in the sidebar can be a second stale.
src/read/recompute.py).The user does not need the result now; they need to know it is being done. So the handler writes "process document 981" to a message queue and answers 202 Accepted at once, and separate workers do the work in the background: asynchronous processing.
Three consequences follow, and each has an owner. Jobs can run twice: so that nothing is lost, the queue deletes a job only when a worker confirms it (at-least-once delivery), so jobs must be idempotent, and a job that keeps failing goes to a dead-letter queue. A queue can hide overload: the backlog grows while nothing looks broken, so watch the age of the oldest job and apply backpressure (slow producers down, or refuse work with 429). Workers are sized by arithmetic: Little's law, L = λW, says 5 documents a second at 20 seconds each keeps 5 × 20 = 100 jobs in progress, so at least 100 worker slots (illustrative); the same law sizes the model layer in Steps 5 and 6.
The defences, each a fix with a price, in the order a request meets them:
| Defence | What it does | How it backfires |
|---|---|---|
| Timeout | A deadline on every call; give up and free the slot | Too long and slots pile up; too short and calls that would have succeeded are abandoned |
| Retry with exponential backoff and jitter | Tries again after a growing, randomised wait | Retries add load exactly when the system struggles: five layers that each try three times multiply the load on the bottom one 243 times (35), a retry storm. Jitter spreads retries out but removes no work; a retry budget or a bounded queue does |
| Idempotency key | A client-chosen ID per action, so a retried charge returns the stored result instead of charging twice | Needs storage, an expiry and an atomic claim |
| Circuit breaker, load shedding, graceful degradation | Stop calling what is broken; reject excess early; fall back to a smaller model or no search | The least-tested code you own: it runs only when something is already wrong |
A failure that sustains itself after its trigger is gone, usually because retries keep the overload going, is a metastable failure. Reliability engineering measured one on a laptop service: with backoff and full jitter, success stayed at 25%, the same as retrying at once; a retry budget reached 72% and a bounded queue that rejects the excess at once 87%.
How reliable is enough gets a number. An SLI measures the service (the share of messages answered within 10 seconds), an SLO is its target, an SLA the contract built on it, and the gap to perfection is the error budget, spent on shipping. An SLO of 99.9% at 10 million messages a day (Step 6's estimate) allows 10,000 failures a day, about 300,000 in a 30-day month. Seeing whether it holds is observability: logs (one line per event), metrics (numbers over time) and traces (one request followed across every service), joined by one trace ID.
Four properties break the web playbook of Steps 1 to 4:
The fixes all do less work per reply. Batching uses one read of the weights for many conversations: with 64 in a batch, the 4.8 ms read yields 64 tokens, a ceiling of about 13,000 tokens a second (derived); continuous batching refills a freed slot at every step instead of waiting for the longest reply. Prefix caching keeps the KV cache of a shared prompt beginning, so what never changes goes first in the prompt; a semantic cache returns a stored answer for a question that merely looks similar, cheap and wrong whenever the answer depends on who asks. A model router sends easy requests to a small model and doubles as Step 4's degradation path. A rate limit per customer, usually a token bucket, must count tokens as well as requests, because one 100,000-token document costs as much as a thousand short questions.
NVIDIA's published performance overview (v0.21 data) reports about 15,000 output tokens a second for Llama 3.1 8B in 8-bit on one H100, 1,000 input and 1,000 output tokens per request, at maximum load (vendor benchmark; see Numbers to know). Continuous batching was introduced by Orca (OSDI 2022); Anyscale's benchmark reported up to 23x the throughput of naive static batching when combined with vLLM's memory management (Anyscale, 2023; a single benchmark by an interested party, so read it as "large", not as a constant).
The method experienced engineers follow, in roughly this order, which is also what system design interviews expect (Alex Xu compresses it into four phases for 45 minutes: scope 3 to 10 minutes, high-level design 10 to 15, deep dive 10 to 25, wrap-up 3 to 5; ByteByteGo):
Fig. 2 · The estimate step by step, for the average and for the peak
Predict before you step: if the busy hour runs at twice the average, how many hours of the day does a fleet sized for the average fall short? Then switch to the peak-sized fleet and look at the night.
Every input is an assumption, labelled as such: 10% of users active each day, 10 messages each, 1,000 input and 400 output tokens per reply (the same request shape as the Scale simulator), a busy hour twice the daily average, 2,000 output tokens per second per GPU, replies streaming for 10 seconds, 2 KB of text per message. The daily traffic shape is invented to average exactly 1. Checked in src/read/recompute.py. The results the child pages reuse: 10 million messages a day, about 116 requests a second on average and 231.5 in the busy hour, 56 GPUs for the busy hour with 20% headroom, 2,315 streams open at once.
The busy hour at twice the daily average is a fair figure for a product used in one region: Capacity planning and performance measured Wikipedia's busy hour against its day's average for September 2026 at 1.92 for German, 1.63 for Japanese and 1.24 for the worldwide English site; per second, peaks are much sharper, as Twitter's busiest second in August 2013 ran at 25 times its average (see Case files). The 2,000 output tokens per second per GPU is a round planning number, a little below NVIDIA's maximum-load benchmark row for Llama 3.3 70B in FP8 on two H100s with 1,000 input and 1,000 output tokens per request: 2,209 output tokens/s per GPU (TensorRT-LLM perf overview, commit 8a9c66c, vendor figure, the same row the Scale simulator uses); a service holding latency targets gets less, so measure your own; more figures in Numbers to know. Changing any input changes the answer in proportion, which is the point: the method, not the numbers, is what carries over.
Two lessons fall out of the arithmetic. The model layer dominates: 116 requests a second is a small load for app servers and a database, while the same traffic needs tens of GPUs. And the peak sets the size, not the average: a fleet sized for the average is short of capacity for 14 hours of the day, and one sized for the peak sits more than half idle overnight, which is why autoscaling, night-time batch work and routing to smaller models matter so much.
Machine learning design interviews keep this method and swap part of the middle for the metrics that define success offline and online, the data, the model choice, then serving and monitoring (Chip Huyen's free Machine Learning Systems Design booklet uses this framing). In both, what is judged is whether you quantify and name trade-offs, not how many component names you know.
The habits that use all six steps; each is a question asked before adding anything, and each is taught in depth by the page named.
The code under every step (drawn as the floor of Fig. 1; Testing and quality, Fig. 1 puts every bug at the lowest net that caught it, Code design, Fig. 1 shows one real handler before and after). Each fix above is code someone must change safely later. Two child pages own that: Testing and quality (which layer of test catches which bug, contract tests for model output, flaky tests, CI gates, and static checks as gates) and Code design (cohesion and coupling, deep modules, dependency direction, refactoring in small tested steps, code review as a craft, and code an LLM agent can change safely). Where they meet: Code design owns static checks and review as craft; Testing and quality owns them as CI gates.
Ten pages on the same chat product; each uses only what the pages before it taught. Times are the reading time each page's header states (core, plus closed details).
Drag the number of users and watch which part of the chat product runs out of room first. Then ask for the fix, compare before and after, apply it, and watch the bottleneck move somewhere else.
Every box below is a queue: requests arrive, wait if every server is busy, get served, and leave. The bar under each box is its utilisation, how much of its capacity is in use. Under about 70% waits are short; past that they grow fast; at 100% requests arrive faster than they can be served and the queue grows until requests time out. The running example is the one the Reading follows: a chat assistant with accounts and history, backed by a self-hosted open model.
Each group is one tier. The presets and the fix button set these too.
Arrivals. Every daily active user sends 10 chat messages a day, and each message brings 4 other API calls (load the history, list chats, refresh the login). Traffic is not flat: the busiest hour runs at 2 times the daily average by default (the Traffic control changes it), and every tier except the queue is sized for that hour. So the message rate is users × 10 / 86,400 s × 2, written λ (lambda, arrivals per second). All three numbers are illustrative: your product's own logs replace them.
Little's law holds for any queue that is not growing, whatever the arrival pattern or service times (Little, 1961). The squares under each box are Lq = λ × Wq, the requests waiting; the GPU card uses it to find how many streams are being generated at once.
Which queue model, and why it is an approximation. Each component is treated as M/M/c: in Kendall's notation, arrivals are random and independent (Poisson, the first M), service times are random with an exponential distribution (the second M), and there are c servers taking requests first come, first served. Waits then follow a known distribution (zero with probability 1 − C, otherwise exponential with rate c/S − λ), which gives the p50 and p99 directly; p50 is the median request, p99 the one slower than 99 in 100, the number users notice. Real systems break every assumption: arrivals come in bursts (a launch, a retry storm), a GPU reply's length is fixed once the request is known rather than exponential, a load balancer sends each request to one server instead of a shared line (each app server here is its own M/M/4), and components influence each other. The point of the model is the shape: wait time grows like 1/(1 − ρ), so going from 80% to 90% busy doubles the queueing, and 90% to 95% doubles it again.
Checked against a simulation (src/sim/des_check.py: a discrete-event simulation of 380,000 requests per case, first come first served):
| Case | P(wait), formula | simulated | p99 time inside, formula | simulated |
|---|---|---|---|---|
| M/M/1 at 50%, S 10 ms | 0.500 | 0.498 | 92.1 ms | 92.6 ms |
| M/M/1 at 90%, S 10 ms | 0.900 | 0.900 | 461 ms | 488 ms |
| M/M/4 at 80%, S 5 ms (an app server) | 0.596 | 0.598 | 34.5 ms | 34.8 ms |
| M/M/64 at 90%, S 1 s | 0.311 | 0.301 | 4.66 s | 4.62 s |
| Two queues in a line (app, then database), end to end | 32.0 ms | 32.3 ms |
The formulas match within the simulation's own noise, which is largest at 90% and above. For a GPU replica pair with fixed reply length (M/D/c, 128 slots), M/M/c overstates the mean wait: 0.16 s against 0.10 s simulated at 90%, 2.07 s against 0.93 s at 97%. The simulator is therefore pessimistic about GPU waits close to saturation; the utilisation, and so where things break, is exact under its assumptions.
One chat message, end to end. 20,000 sampled messages each pass through an app server, 3 reads (the cache, then the database on a miss), one write (saving the message), the GPU queue and the prefill (the time to read the prompt, which ends at the first token: TTFT, time to first token), then the reply is generated token by token. Times are server-side only: the user's network adds its own round trips. The sampler uses a fixed seed, so the same settings always show the same numbers.
The GPU replica. One replica is two H100 GPUs serving Llama 3.3 70B in FP8, the configuration NVIDIA benchmarks. Generation runs in steps: each step reads all the weights once and produces one token for every stream in the batch, so a step takes t(n) = a + b × n for n streams. a = 36.3 GB of weights per GPU / 3.35 TB/s = 10.8 ms (derived); b = 0.092 ms per stream (fitted so that at 1,000 input and 1,000 output tokens, with the largest batch memory allows, a replica makes 2 × 2,209 = 4,418 output tokens per second, NVIDIA's published maximum-load figure; reproduced by construction). The fitted b is within 3% of the compute one token needs at 40% of the GPU's FP8 peak (0.089 ms), which is why the fit is believable. Reading the prompt (prefill) costs 2 × 70.55 B × input tokens / (2 × 1,979 TFLOPS × 40%), 89 ms for 1,000 tokens. Each stream holds a KV cache (the model's memory of the conversation so far): 2 × 80 layers × 8 KV heads × 128 × 1 byte = 163,840 bytes per token, and 90% of what the weights leave free (2 × 80 GB − 72.7 GB) is 78.6 GB, so the batch can never exceed 78.6 GB / (163,840 × tokens per stream). The concurrency actually in use comes from Little's law (n = arrivals per replica × time per request at n). Batch slots are the GPU's c.
The database costs (1 ms of CPU per indexed read, 3 ms per write) are illustrative round numbers for a database server; measured latencies for PostgreSQL, Redis and disks are on Numbers to know.
Cost. On-demand list prices for 730 hours a month, with the fleet sized for the busiest hour and left running (no autoscaling). Excluded: storage, network transfer, backups, standby copies in a second zone, monitoring, people. Real bills differ; the proportions are the lesson.
published read from a source; derived computed from published numbers; fitted set to reproduce one published figure; illustrative an assumption to replace with your own measurement. Fetched 4 October 2026.
Model, recompute and checks: src/sim/ (model.py and the page's JavaScript agree on 1,404 numbers to the last digit across the presets, the fix chains and 40 random settings).
The numbers a working engineer carries in their head, so that a design can be checked with arithmetic before anyone builds it. Each one is sourced and dated; old classics sit beside today's measurements, never mixed into one figure.
Units. A nanosecond (ns) is a billionth of a second; a microsecond (µs) is a thousand ns; a millisecond (ms) is a thousand µs. A screen refresh takes about 16 ms; a blink about 100 ms. The span from a CPU cache to a model loading onto a GPU is eleven powers of ten, which is why the ladder below uses a logarithmic scale: each step to the right is ten times longer than the last, so 1 ns and 1 µs are as far apart as 1 ms and 1 s.
Latency and throughput. Latency is how long one thing takes; throughput is how many things finish per second. They are linked by Little's law: things in flight = throughput × latency. One database connection that waits 0.067 ms per query can do at most 1 / 0.067 ms ≈ 15,000 queries a second; to do more you need more in flight at once (more connections, or batching).
Percentiles. "p50" is the median: half of the requests were faster. "p99" means 99% were faster and 1% slower. Users notice the slow tail, so systems are judged on p99, not on the average.
Where each number comes from, marked everywhere on this tab:
How long the basic operations take, from a CPU cache to a model cold start. Grey hollow diamonds are the classic numbers (Norvig 2001, Dean 2009); the filled marks are current. Click a rung to open what it is, every figure and its source, right under it; click again to close.
Human scale: every time is multiplied by a billion, so an L1 cache hit takes about a second. On that scale a main-memory read is about two minutes, an SSD read a day, and a transatlantic round trip two and a half years.
A request's latency is a sum of pieces. Laying the pieces out as bars shows which one to attack. Each scenario below follows one request of our chat product (user in London, servers in Virginia), draws its time budget, then draws it again after one change. Every bar comes from a rung of the ladder above; bars marked "illustrative" are round numbers for your own code.
The TechEmpower Framework Benchmarks (Round 23, published 2025-03-17, independent) run the same tiny endpoints in hundreds of web frameworks on one 56-core Intel Xeon Gold 6330 server with a 40 Gbps network. These are ceilings for trivial work: "JSON" returns a fixed object, "one query" reads one random row from a database, "fortunes" reads rows and renders an HTML page.
Two different numbers that are easy to confuse. Per-user speed is how fast one conversation's tokens arrive. GPU throughput is the total across every conversation the GPU serves at once: serving engines batch many requests together, so each weight read from memory produces a token for many users. Maximum-throughput figures run the GPU flat out, where each user's tokens arrive slowly; a chat product runs below that to keep replies quick.
Availability is the share of time (or of requests) a service works. It is quoted in "nines": 99.9% is three nines. Each extra nine divides the allowed downtime by ten.
If a request needs several components and each must work (in series), their availabilities multiply: five parts at 99.9% give 99.5%. If you run copies side by side and any one is enough (in parallel), the request fails only when all copies fail together: 1 − (1 − a)n. Both formulas assume failures are independent; copies in the same zone, on the same bad deploy, fail together, which is why the parallel number is an upper bound.
An SLO (service level objective) is the target you commit to, such as "99.9% of messages succeed over 30 days". The error budget is the rest: the failures you may spend on releases and experiments before you must stop and fix reliability.
A back-of-the-envelope estimate turns a product guess (how many users, how active) into the numbers that decide a design: requests per second at peak, servers, storage, bandwidth, GPUs and money. Pick a drill to load its inputs; each one shows the worked steps and checks the result against a real published figure.
The Reading tab builds an imaginary chat product from one server to ten million users. This tab is the evidence that the same problems hit real companies: 33 published architectures and outages, each read from the company's own write-up (engineering blog, official postmortem, regulator's order), each mapped to the building block it teaches. A postmortem is the report a team writes after an outage: what broke, why, and what it changed; good ones are blameless, about systems rather than people.
How to read a card: the system (what it was), what happened in plain words, what they changed, the lesson in one line, the numbers the source gives (each tied to a quote, or derived with its formula shown), and the source's own words under "Quotes from the source". Where a source prints an em-dash, this page shows "--". Sources read on 4 October 2026.
On 20 October 2025 EC2 could not start new virtual machines for hours after its database came back (the card). Three words first. A lease is a claim on a server that expires unless it is renewed. A queue is a waiting line of work. A timeout is how long work may take before it is abandoned. Below, every square in the top row is one physical server (AWS calls them droplets); each needs a lease before it can host new machines. Before replays the mechanism AWS describes; After replays the fix it shipped that morning.
Illustrative model, not AWS's numbers: 48 servers, a worker that finishes 4 lease attempts per tick, and a timeout of 3 ticks, so at most 12 attempts can be waiting and still finish in time. AWS publishes the mechanism and the times, not its internal sizes. What the model shares with the postmortem: attempts that wait too long time out, each timeout queues a new attempt, the line stops shrinking, and the fix is to let in only as much work as can finish (AWS's planned fix rate-limits incoming work "based on the size of the waiting queue"). Checked against src/cases/recompute.py.
Dates: the event date (outages) or the publication date (architectures). Every quote was checked word for word against the source text by src/cases/verify_extracts.py; every quoted number is matched to its quote by build_cases.py; derived numbers are recomputed in recompute.py.
Times for pages of this knowledge base are their headers (230 words a minute); times for outside resources are estimates for a careful first read. "When" says where in the path each one pays off. Outside links checked 2026-10-04; child times 2026-10-24.
Push traffic through the design and switch building blocks on and off: where one server, the database, a queue or the GPUs break first. About 15 min to explore. When: after Steps 1 to 3.
The latency, throughput and size figures every estimate starts from, each sourced and dated. About 10 min, then as a reference. When: alongside Step 6.
Real outages and redesigns, each mapped to one of the six steps. About 20 min. When: after Step 4.
What each covers is on the Reading tab's last section; times are each page's header (core, plus closed details): about 6 h 40 min of core reading in all.
32 min, plus 5 in closed details. When: first; Step 1.
46 min, plus 10 in closed details. When: after Step 2.
40 min, plus 17 in closed details. When: after Step 3.
40 min, plus 8 in closed details. When: after Step 4.
39 min, plus 8 in closed details. When: after Reliability engineering.
39 min, plus 18 in closed details. When: with Step 6's estimate.
28 min, plus 15 in closed details. When: after Step 5.
46 min, plus 18 in closed details. When: once you ship code others depend on.
42 min, plus 17 in closed details. When: after Testing and quality.
41 min, plus 28 in closed details. When: last, as practice.
A map from outside: Andrew Ng's five pillars. In August 2026 Andrew Ng published an AI Engineering Skills Map for software engineering fundamentals (Andrew Ng on X, 2026-08-28, about 10 min). His argument: even when a coding agent writes every line, you need the fundamentals to steer it, because without them the agent makes "bad tradeoffs in latency, availability, consistency, reliability, maintainability, simplicity, and/or cost", and "the developer didn't know such tradeoffs even existed and therefore did not steer the agent". He names five skills; here is where this knowledge base teaches each. Building full-stack applications: Building a backend API, Testing and quality and Topic: protocols. Managing data: Distributed systems fundamentals, Queues, streams and async work and Topic: databases. Designing system architectures: this page's method (Step 6), System design case studies and ML system design. Making systems secure and reliable: Reliability engineering and Testing and quality. Scaling and operating in production: Capacity planning and performance, Observability, Code design (code review) and Topic: ml-infra-and-orchestration. Two gaps remain: front-end work (UI components, page rendering, accessibility) and conventional application security (dependency and supply-chain scanning, cloud configuration review) have no page here yet.
The engine layer under Step 5: serving engines, KV cache management, batching and routing in depth. 34 min. When: after Step 5.
Database families compared, indexes, replication, sharding and caching at every layer: the depth behind Step 2. 29 min. When: after Step 2.
HTTP, gRPC, server-sent events, webhooks: the wire under Step 1 and the streaming in Step 5. 34 min. When: after Step 1.
Kubernetes, Terraform, monitoring: how these designs are deployed and operated. 29 min. When: when you deploy your first service.
Shipping model changes safely: eval gates, golden sets, shadow traffic, A/B tests. About 30 min. When: after Step 4.
How LLM systems are evaluated, the quality side of the SLOs in Step 4. About 17 min. When: any time.
The KV cache managed like operating-system memory pages, with a simulator; the source of Step 5's KV cache facts. About 27 min (estimated from length). When: after Step 5.
How a model is split across GPUs, and how smaller number formats shrink it: why a replica spans several GPUs. 27 and 27 min. When: optional, after Step 5.
Read in this order. Each stage assumes the one before; do not start with the big books.
Stage 1: the vocabulary and the shape (first two weeks)
Donne Martin's free GitHub guide (about 373k stars on 2026-10-04). Read the sections on performance against scalability, latency against throughput, availability against consistency, load balancers, caches, databases and asynchronism. About 2 h for those sections. When: right after this page.
Alex Xu, 2nd edition, 2020, 276 pages (Open Library). Its first chapter scales a system from zero to millions of users, the same journey as this page; then the four-step interview framework and a dozen worked designs (rate limiter, key-value store, chat system). About 8 h. When: weeks 1 to 2.
Jeff Hodges, 2013: the mindset of distributed systems in one essay. About 20 min. When: any time in stage 1.
Stage 2: failure and operations, from people who run large systems (months 1 to 3)
Timeouts, retries and backoff with jitter (Brooker), Making retries safe with idempotent APIs (Featonby), Caching challenges and strategies (Brinkley and Chhabra), Avoiding insurmountable queue backlogs and Using load shedding to avoid overload (Yanacek). About 25 min each, 2 h in all. When: after Steps 2 to 4.
Marc Brooker, AWS Architecture Blog, 2015: the simulation behind "full jitter". About 15 min. When: with Step 4.
Brandur Leach (2017) on idempotency keys; Paul Tarjan (2017) on token buckets and load shedders in a real API. About 15 min each. When: with Steps 4 and 5.
Free online. Chapter 3 (Embracing Risk: error budgets), 4 (Service Level Objectives), 6 (Monitoring Distributed Systems: the four golden signals), 21 (Handling Overload) and 22 (Addressing Cascading Failures). About 3 h for the five. When: months 1 to 3, before you are on call.
Chip Huyen's free booklet: the ML-specific design and interview framing. About 1 h 30 min. When: before an ML system design interview.
Stage 3: depth (months 3 to 9)
Martin Kleppmann and Chris Riccomini, O'Reilly, March 2026 (author's site). The anchor book: storage, replication, partitioning, transactions, consistency and stream processing, explained from first principles. Read it after stage 1 gave you the vocabulary. About 15 to 20 h. When: months 3 to 6, a chapter a week.
Chip Huyen, O'Reilly, 2025. For this topic, chapter 9 (Inference Optimization) and chapter 10 (AI Engineering Architecture and User Feedback) carry Step 5 into practice (table of contents). About 3 h for chapters 9 and 10; about 12 h for the book. When: after Step 5, alongside DDIA.
Alex Xu and Sahn Lam, March 2022, 434 pages: harder worked designs (proximity service, payment system, distributed message queue). About 12 h. When: when preparing for interviews, after DDIA's first half.
Jepsen's consistency models map (about 20 min); Abadi's PACELC paper (IEEE Computer 2012, about 30 min); Bronson et al., Metastable Failures in Distributed Systems (HotOS 2021, about 30 min). About 1 h 20 min. When: with DDIA's consistency chapters and after Step 4.
Stage 4: the layer underneath (as needed)
Arpaci-Dusseau and Arpaci-Dusseau, free online, organised around virtualization, concurrency and persistence: processes, memory, threads, disks and file systems. Its paging chapters are the idea PagedAttention borrowed for the KV cache. About 20 h for the book; read the parts you need. When: when a bug or bottleneck sits below your code.
The two papers behind continuous batching and paged KV caches (OSDI 2022, SOSP 2023). About 1 h each. When: after Topic: inference-and-serving.
Google's practical companion to the SRE book: implementing SLOs, alerting on them, managing load. About 2 h for the SLO chapters. When: when you own a service's SLO.