Scale from zero to millions · The twelve levels
9 min readThe twelve levels
The path is generic industry knowledge, written here in our own words and numbers. Background reading that shaped the ordering: the scale-from-zero chapter outline (paid course, read for the topic list only, nothing is copied), the System Design Handbook, systemdesign.io, and the provider guidance: the AWS Well-Architected Framework, the Azure Architecture Center and the Google Cloud Architecture Center. Provider names per component are on the cloud component mapping module.
L01 One server
Everything runs on one machine: web process, application code, database and file storage. It is the right first design, because it has one deploy, one log and no network between parts. It runs out of the first of CPU, memory, disk or connections, and it has a single point of failure: one reboot is a full outage. Rule of thumb for this level: measure which resource saturates first before buying anything, because the answer decides the next level.
Play it: Throughput level 1
A: It minimises moving parts, so it is cheapest to build and debug. Its limits are that capacity is capped by one machine and that availability equals that machine's availability, with no redundancy.
L02 Split database
Move the database to its own machine. The web tier and the data tier now scale and fail independently, can be sized differently (data wants memory and fast disk, web wants CPU), and the database can be locked down to accept connections only from the application. Cost: every query now crosses a network, so latency rises by a round trip and a new failure appears, the link between the tiers. Pick a relational store by default when data has relationships and needs transactions; a key-value or document store when access is by key at very high volume and the schema varies.
Play it: Throughput level 2
A: You gain independent scaling, sizing and security of the two tiers. You pay a network round trip per query and a new failure mode, the connection between them.
L03 Load balancer
Put a load balancer in front of two or more identical application servers. Users hit one address; the balancer spreads requests and stops sending to an instance that fails its health check, which removes the web tier as a single point of failure. Common algorithms: round robin (simple), least connections (better when requests vary in duration), and hash on a key (when you need affinity). The balancer itself must not become the new single point of failure, so providers run it as a redundant managed service. Cost: servers must now be interchangeable, which exposes any state they kept locally (level 7).
Play it: Throughput level 3
A: Itself. A lone balancer is a single point of failure, so it must be redundant, which managed cloud balancers are by design.
L04 Read replicas
Most applications read far more than they write, often ten to one or more. Keep one primary that takes all writes and add replicas that copy its changes and serve reads. Read capacity grows with the replica count and a failed primary can be replaced by promoting a replica. Cost: replication is usually asynchronous, so a replica can lag the primary and a user may fail to see their own just-written data. Fixes: read your own writes from the primary for a short window, or route that user's reads to the primary. Writes are still limited to one machine; that limit returns at level 11.
Play it: Throughput level 4
A: Replication lag: a replica may not yet show a write the user just made. Route that user's reads to the primary for a short window after a write, or wait for the replica to reach the write's position.
L05 Cache
A cache keeps hot results in fast memory so repeated reads skip the database. The usual pattern is cache-aside: the application checks the cache, on a miss reads the database and stores the result with a time to live (TTL). The TTL bounds how stale a value can be, so choosing it is a product decision. Cost: stale reads, and the stampede, where a popular key expires and many requests hit the database at once; counter it with request coalescing, TTL jitter and serving stale while refreshing. More depth on strategies is in the caching module.
Play it: Throughput level 5
A: The app reads the cache first, on a miss loads from the database and writes the result to the cache. The TTL caps how long a value can be stale after the source changes.
L06 CDN
A content delivery network keeps copies of static files (images, scripts, video segments) on servers close to users. Requests are answered at the edge, which cuts latency for distant users and removes a large share of traffic from your origin. You control freshness with cache headers and by putting a content hash in file names so a changed file has a new URL. Cost: invalidation is slow or paid for, and a file cached too long cannot be recalled from browsers. Dynamic personalised responses usually should not be cached at the edge.
Play it: Throughput level 6
A: Static, widely shared, versioned files belong there. Personalised or fast-changing responses do not, because the edge would serve the wrong or stale content.
L07 Stateless tier
Before adding many servers, make each web server hold no user session in its own memory. Store session data in a shared store (a cache or database) or in a signed token the client carries, so any server can handle any request. Then servers can be added, removed or replaced at will, and an autoscaler can do it by rule on CPU or queue depth. Cost: a shared session store is one more dependency to keep available, and tokens cannot be revoked until they expire unless you keep a deny list.
Play it: Throughput level 7
A: If a server keeps session data locally, removing or replacing it logs users out and forces sticky routing. With state in a shared store or token, any instance can serve any request, so instances become disposable.
L08 Multi-region
Run the stack in more than one region and let DNS answer with the region nearest the user, or the nearest healthy one (geographic DNS routing). Benefits: lower latency worldwide and survival of a whole-region outage. Cost is the hardest in this list: data must live in several places. Options are one writable region with replicas elsewhere (simple, cross-region writes are slow) or several writable regions (fast, but concurrent writes conflict and need a resolution rule). Also plan failover tests, because an untested failover is a hope, and DNS caching means switching takes minutes, not seconds.
Play it: Throughput level 8
A: Keeping data consistent across regions. Either one region takes writes and the others replicate it, or several regions take writes and you must resolve conflicting updates.
L09 Queue and workers
Work that does not need to finish before the user gets a reply (sending email, resizing an image, building a report) goes onto a queue and is processed by separate worker servers. The web tier stays fast, a spike is absorbed as queue depth instead of dropped requests, and workers scale on that depth. Cost: the work is now asynchronous, delivery is normally at least once, so handlers must be idempotent, and you need a dead-letter queue for messages that keep failing. See the queues and messaging module.
Play it: Throughput level 9
A: Most queues deliver at least once, so the same message can arrive twice after a retry or timeout. An idempotent handler gives the same result when repeated.
L10 Observability
Once there are many parts, you cannot find a fault by logging in to a server. Collect logs centrally, metrics as time series, and traces across requests. Alert on user-facing symptoms (error rate, latency percentile, queue age) and keep cause-level data for the investigation after the page. Define a service level objective so alerts have a threshold agreed in advance. Cost: telemetry volume and its bill, and noisy alerts that train people to ignore the pager. See the observability and SLOs module.
Play it: Throughput level 10
A: Page on symptoms users feel (errors, slow responses, queue age). CPU and similar causes are for dashboards and diagnosis, since high CPU is often harmless.
L11 Sharding
When one primary can no longer take the write volume or hold the data, split the data across several databases by a shard key, so each holds a slice. Pick a key with many distinct values that spreads load evenly and that your common queries include. Cost: queries across shards are expensive, joins and transactions across shards are hard, resharding moves data, and one hot key (a celebrity account, a viral item) can overload a single shard however many you add. Mitigate hot keys by splitting that key, caching it, or giving it its own shard. See the sharding and partitioning module.
Play it: Throughput level 11
A: Many distinct values, even spread of traffic, and presence in the common queries. The remaining risk is a hot key that overloads one shard.
L12 Capstone
Combine the levels in one design: a URL shortener. Requirements: turn a long URL into a short code and redirect, with far more reads than writes, for example a hundred redirects per created link. Sketch: a stateless API behind a load balancer; a code generator (a counter encoded in base 62, or random codes with a uniqueness check); a key-value store holding code to URL; a cache in front because redirects are hot and rarely change; replicas or shards by code; a CDN or edge cache for the most popular redirects; a queue for click analytics so counting never slows a redirect. State the numbers first: seven characters of base 62 give 62^7, about 3.5 trillion codes, which comfortably covers billions of links.
Play it: Throughput level 12
A: Each link is created once but followed many times, so the redirect path gets the cache, replicas and edge caching, while click counting is moved to a queue so it never slows a redirect.