Everything from the map above, on one page. Dashed topics are optional. The hours are rough estimates for reading plus practice.
Stage 1 · Beginner Foundations
Before boxes and arrows: how requests travel across a network, how to estimate load, how services talk to each other, and how data is stored. Every design later in this roadmap is built from these pieces.
What system design is
System design is choosing the parts of a software system and how they fit together so it meets its requirements: how many users, how fast, how reliable, how cheap. There is rarely one right answer. Good design means understanding the trade-offs (consistency against availability, latency against cost, simplicity against flexibility) and choosing deliberately.
Interviews follow a predictable shape, and so does real design work: clarify requirements, estimate scale, define the API and data model, sketch a high-level design, then go deep on the hardest parts and the bottlenecks. Practising that structure is half the battle.
What to learn
- Functional requirements (what it does) vs non-functional requirements (scale, latency, availability, durability, cost)
- The interview framework: requirements → estimates → API → data model → high-level design → deep dives → bottlenecks
- Thinking in trade-offs and saying them out loud
- Latency vs throughput, and availability vs durability
- Drawing clear diagrams: clients, services, data stores, queues, caches
Free resources
Practice
Pick an app you use every day. Write down five functional and five non-functional requirements for it, and guess which non-functional one its engineers worry about most.
Networking: DNS, TCP and HTTP
Every request starts with DNS turning a name into an IP address, then a TCP (or, for HTTP/3, QUIC over UDP) connection, a TLS handshake and finally the HTTP request. Each step adds round trips, which is why latency depends so much on distance and why connection reuse, CDNs and HTTP/2 and HTTP/3 matter.
You don't need to be a network engineer, but you should be able to explain what happens when someone types a URL and presses Enter, and where each part of the delay comes from.
What to learn
- DNS resolution, record types (A, AAAA, CNAME) and TTLs
- TCP vs UDP; the TCP and TLS handshakes and their round trips
- HTTP methods, status codes, headers; keep-alive, HTTP/2 multiplexing and HTTP/3 over QUIC
- IP addresses, ports, private networks and NAT
- What happens when you type a URL into a browser
Free resources
Practice
Run curl -w "dns %{time_namelookup} connect %{time_connect} tls %{time_appconnect} first byte %{time_starttransfer}\n" -o /dev/null -s https://example.org against a nearby and a far-away site and explain the differences.
Back-of-the-envelope estimates
Rough numbers decide designs: whether data fits on one machine, whether you need a cache, how many servers you need. Interviewers expect quick estimates of requests per second, storage and bandwidth, rounded freely. A day has 86,400 seconds, roughly 105, so 1 million requests a day is only about 12 per second on average (plan for peaks of several times that).
Know the rough cost of common operations: reading from memory takes about 100 nanoseconds, a random SSD read tens to hundreds of microseconds, a round trip inside a data centre about half a millisecond, and a round trip across an ocean 100–150 milliseconds. These gaps, many orders of magnitude, explain why caches and keeping data close to users matter.
What to learn
- Powers of two: 210 ≈ a thousand (KB), 220 ≈ a million (MB), 230 ≈ a billion (GB), 240 ≈ a trillion (TB)
- Latency numbers every programmer should know (memory, SSD, disk, network)
- Requests per second from daily active users; average vs peak
- Storage per year from object size × objects per day × 365, plus replicas
- Availability "nines": 99.9% ≈ 8.8 hours of downtime a year, 99.99% ≈ 53 minutes
Free resources
Practice
A photo app has 50 million daily users who each upload 2 photos of 2 MB and view 50. Estimate uploads per second (average and peak), storage per year with 3 copies, and read bandwidth.
API design
The API is the contract between your system and its clients, and it is the hardest part to change later. REST over HTTP is the default for public APIs; gRPC (binary, typed, HTTP/2) is common between internal services; GraphQL lets clients ask for exactly the fields they need.
Good APIs are predictable, paginate large lists, use the right status codes, and are idempotent where retries can happen: sending the same "create payment" request twice, for example after a timeout, must not charge twice. An idempotency key in a header is the usual fix.
What to learn
- REST resources, HTTP methods and which are safe or idempotent
- Status codes: 2xx, 4xx vs 5xx, 409, 429
- Pagination: offset vs cursor-based, and why cursors scale better
- Idempotency keys for retries; versioning and backwards compatibility
- When to use gRPC or GraphQL instead of REST
- Authentication on APIs: API keys, bearer tokens
Free resources
Practice
Design the REST API for a to-do app with lists, items, sharing and comments: endpoints, request and response bodies, status codes, cursor pagination and an idempotency key on "create item". Try the calls with the API tester against a mock. To build one yourself end to end, follow the Backend roadmap.
Databases: SQL, NoSQL and indexes
Relational databases (PostgreSQL, MySQL) store tables with a schema, join them, and give you ACID transactions. They are the right default for most systems. NoSQL stores trade some of that for other strengths: key-value stores (Redis, DynamoDB) for simple fast lookups, document stores (MongoDB) for flexible records, wide-column stores (Cassandra) for huge write volumes, and graph databases for relationships.
Most performance problems are missing indexes. An index is a sorted structure (usually a B-tree) that turns a full table scan into a quick lookup, at the cost of slower writes and extra storage. Choose a store by its access patterns: what you read, how often, by which key.
What to learn
- Tables, keys, joins and normalisation (and when to denormalise)
- ACID and isolation levels: read committed, repeatable read, serializable
- B-tree indexes, composite indexes and covering indexes; reading a query plan
- Key-value, document, wide-column and graph stores and their typical uses
- Choosing a database from access patterns rather than popularity
Free resources
Practice
Load a million rows into PostgreSQL in Docker, time a query that filters on an unindexed column, add an index, run EXPLAIN ANALYZE again and compare. To go deeper into queries, indexes and transactions, follow the SQL & Databases roadmap.
Scaling basics
Vertical scaling means a bigger machine: simple, but it has a ceiling and is a single point of failure. Horizontal scaling means more machines behind a load balancer, which only works if the application servers are stateless: sessions, uploads and caches live in shared stores, not in one server's memory.
The usual path for a growing system: one server → separate database → several stateless app servers behind a load balancer → caches and a CDN → read replicas → queues for slow work → splitting the data (sharding) or the services. Don't jump ahead: each step adds operational cost.
What to learn
- Vertical vs horizontal scaling and their limits
- Stateless services; where session state goes
- Single points of failure and redundancy
- Autoscaling on load and why it needs stateless servers
- The step-by-step evolution from one server to millions of users
Free resources
Practice
Run two copies of a small web app with Docker Compose behind nginx. Store a login session in memory and watch it break when requests alternate between servers, then move sessions to Redis and fix it.
Am I ready? Stage 1 quiz
A service gets 10 million requests a day, evenly spread. Roughly how many requests per second is that on average?
- About 10
- About 115
- About 1,000
- About 10,000
10,000,000 ÷ 86,400 seconds ≈ 116. Peaks are usually several times the average.
Which HTTP method should be safe to retry because repeating it has the same effect as doing it once?
- POST
- PATCH (always)
- PUT
- CONNECT
PUT replaces a resource with the given state, so sending it twice leaves the same result. POST usually creates something new each time, which is why APIs add idempotency keys to it.
Why must application servers be stateless before you can scale them horizontally?
- Any server may receive any request, so per-user state must live in a shared store
- Stateless servers use less CPU
- Load balancers can't connect to stateful servers
- Databases require it
With several servers behind a load balancer, a user's next request may go to a different server. State kept in one server's memory would be lost.
A query filters a 50-million-row table on email and is slow. What is the first thing to check?
- Switch to a NoSQL database
- Add more RAM
- Shard the table
- Whether there is an index on
email
Without an index the database scans every row. An index on the filtered column usually turns seconds into milliseconds.
Roughly how long is a network round trip within one data centre, compared with reading from main memory?
- About the same
- About half a millisecond, thousands of times slower than memory
- About 100 milliseconds
- About 1 second
Memory reads take about 100 nanoseconds; a round trip inside a data centre about 500 microseconds, roughly 5,000 times longer.
Stage 2 · Intermediate Building blocks
The components almost every large system is made of: load balancers, caches, CDNs, replicas, shards, queues and object storage. For each one, learn what problem it solves, what it costs, and how it fails.
Load balancing
A load balancer spreads requests across healthy servers and takes failed ones out of rotation using health checks. Layer 4 balancers route TCP connections by IP and port; layer 7 balancers understand HTTP, so they can route by path or header, terminate TLS and retry.
The algorithm matters less than people think: round robin and least-connections cover most cases, and consistent hashing is used when the same key should reach the same server. The load balancer itself must be redundant, and DNS or anycast spreads traffic across regions.
What to learn
- Layer 4 vs layer 7 load balancing; TLS termination
- Round robin, least connections, weighted and hash-based routing
- Health checks, connection draining and graceful shutdown
- Sticky sessions and why stateless servers make them unnecessary
- Global load balancing with DNS and anycast
Free resources
Practice
Put nginx in front of three containers. Kill one while the load tester runs and watch errors spike until the health check removes it. Then add retries to another upstream and compare.
Caching
A cache keeps the results of expensive work (database queries, rendered pages, API calls) in fast memory, usually Redis or Memcached, so most requests never reach the slow layer. The common pattern is cache-aside: read from the cache, and on a miss load from the database and store the result with a time to live (TTL).
"There are only two hard things in computer science: cache invalidation and naming things." Plan how entries get updated or expire, what happens when a popular key expires and thousands of requests hit the database at once (a stampede), and what the system does when the cache itself is down.
What to learn
- Where caches live: browser, CDN, application, database
- Cache-aside, read-through, write-through and write-behind
- TTLs, eviction policies (LRU, LFU) and hit ratio
- Invalidation on writes, and the stampede (thundering herd) problem
- Hot keys, and what happens when the cache fails or restarts cold
Free resources
Practice
Add a Redis cache-aside layer to a slow endpoint (add a 200 ms sleep to simulate the database). Measure latency and database calls before and after with the load tester, then make the key expire while under load and observe the stampede.
Content delivery networks
A CDN caches content in data centres close to users, so a visitor in Mumbai gets your images from a nearby edge instead of a server in Virginia. It cuts latency, offloads your servers and absorbs traffic spikes and some attacks. Static files are the obvious fit, but CDNs can also cache API responses and run code at the edge.
What to learn
- Edge locations, origin servers and cache hits vs misses
- Cache-Control headers, cache keys and versioned file names
- Invalidation and why versioned URLs beat purging
- Push vs pull CDNs; signed URLs for private content
Free resources
Practice
Open your browser's network tab on a big site. Find the CDN response headers (cache status, age), and explain why its CSS and JavaScript files have hashes in their names.
Replication
Replication keeps copies of the same data on several machines, for availability (a copy survives a failure) and for read scaling (reads spread over replicas). With leader–follower replication, all writes go to one leader and stream to followers. Multi-leader and leaderless (Dynamo-style quorum) designs accept writes in several places, at the cost of handling conflicts.
Asynchronous replicas lag behind, so a user may write something and not see it on their next read. Know the fixes: read your own writes from the leader, or wait for replicas. With quorums, if writes reach W of N copies and reads ask R copies, R + W > N guarantees a read overlaps the latest write.
What to learn
- Leader–follower, multi-leader and leaderless replication
- Synchronous vs asynchronous replication and replication lag
- Read-your-writes and monotonic reads
- Failover, split brain and fencing
- Quorums: N, W, R and R + W > N; conflict resolution (last-write-wins, CRDTs)
Free resources
Practice
Set up PostgreSQL with one streaming replica in Docker. Write to the leader and read from the replica in a tight loop to see lag, then stop the leader and promote the replica.
Partitioning and sharding
When data or writes outgrow one machine, you split it into shards, each holding part of the keys. The partition key decides everything: a good one spreads load evenly and keeps related data together; a bad one creates hot shards or forces queries to ask every shard.
Consistent hashing places keys and servers on a ring so that adding or removing a server only moves a small share of keys, which is how many caches and Dynamo-style databases rebalance. Sharding is a one-way door: cross-shard joins and transactions get hard, so try indexes, caching and replicas first.
What to learn
- Range vs hash partitioning, and choosing a partition key
- Consistent hashing and virtual nodes
- Hot keys and hot shards (the celebrity problem)
- Rebalancing and resharding without downtime
- The costs: cross-shard queries, joins and transactions
Free resources
Practice
Write a small consistent-hash ring with 100 virtual nodes per server. Map a million keys onto 4 servers, add a fifth, and measure what fraction of keys moved (it should be about one fifth).
Message queues and event streams
Queues let one part of a system hand work to another without waiting: the web server puts "resize this image" on a queue and answers the user straight away, and workers process jobs at their own pace. That absorbs spikes, isolates failures and lets each side scale on its own.
Two families: message queues (RabbitMQ, SQS) deliver each job to one worker and delete it; event logs (Kafka, Kinesis) keep an ordered, replayable stream that many consumers read independently. Most systems deliver at least once, so consumers must be idempotent, and messages that keep failing go to a dead-letter queue.
What to learn
- Point-to-point queues vs publish–subscribe
- Kafka's model: topics, partitions, ordering within a partition, consumer groups, offsets
- At-most-once, at-least-once and "exactly once"; idempotent consumers
- Retries, visibility timeouts and dead-letter queues
- Backpressure and queue backlogs
Free resources
Practice
Build a sign-up flow that queues a "send welcome email" job in RabbitMQ or Redis. Make the worker crash halfway through a job and show that the email is still sent exactly once to the user (hint: an idempotency record).
Object, block and file storage
Large files (images, videos, backups) don't belong in a database. Object storage such as Amazon S3 stores them as immutable objects behind an HTTP API, practically without limits and very durably. The standard pattern is to keep the file in object storage and its metadata (owner, size, path) in a database. Block storage is a virtual disk for one machine; file storage is a shared file system.
What to learn
- Object vs block vs file storage and their use cases
- Blob in object storage, metadata in the database
- Pre-signed URLs so clients upload and download directly
- Multipart uploads, storage classes and lifecycle rules
Free resources
Practice
Write an endpoint that returns a pre-signed upload URL, upload a file straight from the browser to S3 (or MinIO locally), then record its metadata in a table.
Rate limiting
Rate limits protect a service from abuse and from overload by capping how many requests a client can make, answering 429 Too Many Requests beyond that. The token bucket is the most common algorithm: tokens refill at a steady rate up to a maximum, and each request takes one, which allows short bursts. Across many servers, counters usually live in Redis.
What to learn
- Token bucket, leaky bucket, fixed window and sliding window
- Limiting per user, per API key, per IP and globally
- Distributed counters in Redis and their race conditions
- Telling clients: 429,
Retry-After and rate-limit headers
- Load shedding: dropping work early when overloaded
Free resources
Practice
Implement a token bucket rate limiter middleware backed by Redis (an atomic Lua script or INCR + EXPIRE). Hit it with the load tester and check that the 429s match your limit.
Search
Full-text search needs an inverted index: a map from each word to the documents containing it, plus ranking. Databases have basic full-text search; Elasticsearch and OpenSearch scale it out with shards and replicas. The usual design keeps the database as the source of truth and streams changes into the search index.
What to learn
- Inverted indexes, tokenising and stemming
- Relevance ranking (TF-IDF, BM25) in one sentence each
- Keeping the index in sync with the database (change data capture)
Free resources
Practice
Index a few thousand product descriptions in OpenSearch running in Docker and compare its results with a LIKE '%word%' query in SQL.
Am I ready? Stage 2 quiz
With cache-aside, what happens on a cache miss?
- The request fails
- The cache asks the database by itself
- The application reads from the database and stores the result in the cache
- The database writes to the cache on every update
In cache-aside the application owns the logic: check the cache, fall back to the database, then populate the cache, usually with a TTL.
A leaderless store has N = 3 copies. Which settings guarantee that a read sees the latest successful write?
- W = 2, R = 2
- W = 1, R = 1
- W = 1, R = 2
- W = 2, R = 1
Reads and writes must overlap: R + W > N. With 2 + 2 = 4 > 3, at least one copy read has the latest write.
Why use consistent hashing instead of hash(key) % N to pick a server?
- It is faster to compute
- It encrypts the keys
- It guarantees equal load
- Adding or removing a server moves only a small fraction of keys
With modulo, changing N remaps almost every key. On a hash ring, only the keys next to the added or removed server move.
Most queues deliver messages at least once. What must consumers do?
- Nothing, duplicates never happen
- Be idempotent, so processing a message twice has the same effect as once
- Delete the queue after each message
- Use a bigger queue
Redeliveries happen after timeouts and crashes, so a consumer must detect or tolerate duplicates, for example with a processed-message ID.
Where should a 200 MB video upload be stored?
- In a BLOB column in the main database
- On the web server's local disk
- In object storage, with its metadata in the database
- In the cache
Object storage is cheap, durable and scales without limits; the database keeps the small, queryable metadata. Local disks disappear with the server.
Stage 3 · Advanced Distributed systems and reliability
Once a system spans many machines, networks drop messages, clocks disagree and parts fail independently. This stage covers the theory that explains what is possible, and the patterns that keep real systems working anyway.
Consistency, CAP and PACELC
The CAP theorem says that during a network partition, a replicated system must choose between consistency (every read sees the latest write) and availability (every request gets an answer). Partitions are not optional, so the real choice is what to do when one happens. PACELC adds the everyday case: even without a partition, you trade latency against consistency.
Consistency is a spectrum: linearizable (strongest), sequential, causal, read-your-writes, and eventual (replicas converge if writes stop). Pick per feature: a bank balance needs strong consistency; a like counter can be eventually consistent.
What to learn
- CAP stated correctly, and why "CA" is not a real option for distributed systems
- PACELC: latency vs consistency when there is no partition
- Consistency models: linearizable, sequential, causal, read-your-writes, eventual
- Choosing consistency per feature, not per system
Free resources
Practice
For a shopping site, list ten features (cart, stock count, reviews, order status, recommendations…) and decide for each whether it needs strong or can live with eventual consistency, with one sentence of reasoning.
Consensus and leader election
Consensus lets a group of machines agree on a value, such as who the leader is or the order of log entries, even if some crash. Raft is the algorithm to learn: a leader replicates a log, and an entry is committed once a majority has it. A cluster of 5 nodes survives 2 failures; you almost never implement this yourself, you use etcd, ZooKeeper or a database built on it.
Distributed systems also can't rely on clocks: wall clocks drift and jump. Logical clocks (Lamport timestamps) order events by cause, and leases and fencing tokens stop an old leader that wakes up late from doing damage.
What to learn
- Why consensus needs a majority (quorum), and how many failures a cluster survives
- Raft: terms, leader election, log replication, commit
- Leader election with leases; fencing tokens
- Clock problems; Lamport timestamps and vector clocks at a high level
- Where etcd and ZooKeeper are used (Kubernetes, Kafka's older versions)
Free resources
Practice
Run a 3-node etcd cluster in Docker, write a key, stop the leader and watch a new one get elected. Stop a second node and see that writes now fail: no majority.
Transactions across services
Inside one database, a transaction makes several changes all-or-nothing. Across services or databases that is much harder. Two-phase commit works but blocks if the coordinator fails, so most systems use sagas: a sequence of local transactions, each with a compensating action (refund the payment if the hotel booking fails).
A classic bug is "save to the database, then publish an event": if the process dies in between, the two disagree. The transactional outbox fixes it by writing the event to an outbox table in the same transaction, and a relay publishes it afterwards.
What to learn
- Two-phase commit and its blocking problem
- Sagas: choreography vs orchestration, compensating actions
- The dual-write problem and the transactional outbox
- Idempotency keys and deduplication as the basis of "exactly once"
Free resources
Practice
Design a trip booking saga (flight, hotel, car) with orchestration: draw the happy path and what happens when the car booking fails after the other two succeeded.
Monoliths, microservices and API gateways
Microservices split a system into small services that teams can deploy independently, each owning its data. They buy team autonomy and independent scaling, and cost you network calls, distributed failures and harder debugging. Many successful systems are well-structured monoliths; "monolith first" is sound advice.
In a microservice system, an API gateway is the single entry point that handles routing, authentication and rate limits; services find each other through service discovery and talk synchronously (HTTP, gRPC) or asynchronously (events).
What to learn
- Monolith vs modular monolith vs microservices, and when each fits
- Service boundaries around business capabilities; database per service
- API gateway and backend-for-frontend
- Synchronous vs asynchronous communication; service discovery
- Deploying safely: blue–green and canary releases
Free resources
Practice
Take an e-commerce monolith (users, catalogue, cart, orders, payments, emails). Draw how you would split it, which data each service owns, and which calls become events. Then list what got harder.
Timeouts, retries and circuit breakers
In a distributed system, every call can be slow or fail. Every call needs a timeout. Retries fix brief glitches but, without limits, exponential backoff and jitter, they multiply load on a struggling service and turn a blip into an outage. A circuit breaker stops calling a dependency that keeps failing and gives it time to recover.
Design for graceful degradation: if recommendations are down, show the page without them. Bulkheads isolate resources so one slow dependency can't use up every thread.
What to learn
- Timeouts on every network call, and timeout budgets across a chain
- Retries with exponential backoff, jitter and retry budgets
- Circuit breakers: closed, open and half-open
- Bulkheads, load shedding and graceful degradation
- Cascading failures and how they spread
Free resources
Practice
Make a fake dependency that fails 50% of the time and sometimes hangs. Call it with no timeout, then with a timeout, then add retries with backoff and jitter, then a circuit breaker, and chart the error rate and latency at each step.
Generating unique IDs
An auto-increment ID needs one database to hand out numbers, which becomes a bottleneck once you shard. Alternatives: random UUIDv4 (no coordination, but scatter inserts across a B-tree index), time-ordered UUIDv7 (RFC 9562, sortable by creation time), and Snowflake-style 64-bit IDs (a millisecond timestamp, a machine ID and a sequence number, so each machine can make up to 4,096 IDs per millisecond).
What to learn
- Why auto-increment breaks down with sharding
- UUIDv4 vs UUIDv7 and the effect on index performance
- Snowflake IDs: bit layout, clock skew and machine IDs
- Short public IDs (base62) vs internal IDs
Free resources
Practice
Generate some v4 and v7 UUIDs and sort them: notice which ones come out in creation order. Then write a Snowflake ID generator and test it with two "machines" for duplicates.
Authentication, authorisation and security
Authentication proves who someone is; authorisation decides what they may do. Modern systems use OAuth 2.0 for delegated access and OpenID Connect for login, issuing tokens (often JWTs) that services verify without calling the login server every time. Keep tokens short-lived, store secrets in a secrets manager, encrypt in transit and at rest, and give every service the least privilege it needs.
What to learn
- Sessions vs tokens; JWTs, their signatures and expiry
- OAuth 2.0 flows and OpenID Connect at a high level
- Role- and attribute-based access control
- TLS everywhere, encryption at rest, secrets management
- The OWASP Top 10 risks for web apps and APIs
Free resources
Practice
Sketch the login and token flow for a web app plus a mobile app sharing one API: where tokens are issued, stored and checked, how they are refreshed, and how you log a user out everywhere. For the application-level attacks and defences, see the Web Security roadmap.
Observability and SLOs
You can't run what you can't see. Metrics show trends (the four golden signals: latency, traffic, errors, saturation), logs show individual events, and traces follow one request across services. SLOs turn "reliable enough" into a number, and the error budget tells you when to slow down and fix things.
What to learn
- Metrics, logs and traces, and what each answers
- The golden signals; percentiles (p50, p99) instead of averages
- SLIs, SLOs and error budgets
- Designing for debuggability: request IDs and structured logs
Free resources
Practice
For a URL shortener, write three SLOs (for example, 99.9% of redirects under 100 ms), the metrics that measure them, and the alert that should wake someone up.
Real-time: polling, WebSockets and SSE
Chat, live scores and collaborative editing need the server to push updates. Short polling asks every few seconds (simple, wasteful); long polling holds the request until there is news; server-sent events stream updates one way over HTTP; WebSockets keep a two-way connection open. Long-lived connections change scaling: each server holds many open connections, and a message for a user must reach whichever server holds theirs, usually through a pub/sub layer.
What to learn
- Short polling, long polling, SSE and WebSockets: trade-offs
- Connection servers and routing messages to the right one (pub/sub)
- Presence (online/offline), heartbeats and reconnects
- Load balancing long-lived connections
Free resources
Practice
Build a tiny chat with WebSockets on two server instances. Messages sent to one instance won't reach users on the other: fix it with Redis pub/sub.
Batch and stream processing
Analytics, recommendations and reports process data in bulk. Batch jobs (MapReduce, Spark) process a fixed dataset, for example every night. Stream processing (Flink, Kafka Streams) handles events continuously as they arrive, with windows over time. Many systems combine both, or use a single streaming pipeline that can also replay history.
What to learn
- MapReduce in one diagram; Spark at a high level
- Event time vs processing time; windows and late events
- Lambda vs Kappa architectures
Free resources
Practice
Design "trending hashtags in the last hour": a streaming job counting tags in sliding windows, and a nightly batch job correcting the counts.
Am I ready? Stage 3 quiz
During a network partition, what does the CAP theorem say a replicated system must choose between?
- Speed and cost
- Consistency and availability
- Latency and throughput
- SQL and NoSQL
When nodes can't talk to each other, the system either refuses some requests (staying consistent) or answers with possibly stale data (staying available).
A Raft cluster has 5 nodes. How many can fail while it keeps accepting writes?
- 0
- 1
- 4
- 2
Writes need a majority (3 of 5), so the cluster survives 2 failures. That is why clusters have odd sizes like 3 or 5.
An order service saves an order and then publishes an "order created" event. The process can crash between the two. What fixes this?
- A transactional outbox: write the event to a table in the same database transaction, publish it afterwards
- Publishing the event first
- Retrying the database write
- A bigger message queue
The outbox makes the state change and the event one atomic write; a relay then publishes events reliably, at least once.
Why add random jitter to retry delays?
- To make debugging harder
- To use less memory
- So that many clients don't retry at the same moment and overload the recovering service
- Because timers are inaccurate
Without jitter, clients that failed together retry together in synchronised waves. Jitter spreads the retries out.
Why are UUIDv7 primary keys usually faster to insert than UUIDv4?
- They are shorter
- They start with a timestamp, so new rows go to the end of the index instead of random places
- They don't need an index
- They are generated by the database
Random v4 IDs scatter inserts across the B-tree, causing page splits and cache misses; time-ordered v7 IDs append like auto-increment numbers.
Stage 4 · Case studies Classic designs
The designs interviewers ask most, each combining the building blocks above. For every one: clarify requirements, estimate, define the API and data model, draw the high-level design, then go deep on the part that makes it hard. Try each design yourself before reading a solution.
Design a URL shortener
The classic first design (bit.ly, TinyURL). It is read-heavy (often around 100 redirects per new link), so the core is a fast key lookup with heavy caching. The interesting parts: generating short codes (a counter encoded in base62, or a hash with collision checks: 7 base62 characters give about 3.5 trillion codes), choosing 301 vs 302 redirects (302 lets you count clicks), and collecting click analytics without slowing redirects down.
What to learn
- Requirements: custom aliases, expiry, analytics; read/write ratio
- Short code generation: counter + base62, hashing, pre-generated key ranges
- Data model and a key-value store; caching popular links
- 301 vs 302 redirects; analytics through a queue
- Abuse: spam links, rate limits
Free resources
Practice
Design it for 100 million new links a month, then build a minimal version: one endpoint to shorten, one to redirect, Redis in front of the database. Load-test the redirect path.
Design a notification system
Send push notifications, emails and SMS for many products: order shipped, new message, password reset. It is a lesson in queues: an API accepts notification requests, checks user preferences and rate limits, and puts jobs on per-channel queues; workers call providers (Firebase Cloud Messaging, Apple Push, an email or SMS service) with retries, deduplication and delivery tracking.
What to learn
- Channels and providers; device tokens
- User preferences, quiet hours and per-user rate limits
- Per-channel queues, retries with backoff, dead-letter queues
- Templates and localisation; deduplication so users don't get two copies
- Delivery and open tracking
Free resources
Practice
Design it for 10 million notifications a day with a 1-minute delivery target for "urgent" ones. Show how urgent messages avoid getting stuck behind a marketing blast.
Design a chat app
WhatsApp, Messenger or Slack. Users keep a WebSocket connection to a connection server; messages are stored (a wide-column store partitioned by conversation is a common choice) and routed to the recipient's connection server, or to a push notification if they're offline. The hard parts are ordering within a conversation, delivery and read receipts, group fan-out, presence and syncing several devices.
What to learn
- Connection servers and routing messages to online users
- Message storage partitioned by conversation; message IDs that sort by time
- Sent, delivered and read receipts; offline delivery with push
- Group chats: fan-out and size limits
- Presence, multiple devices, end-to-end encryption at a high level
Free resources
Practice
Design 1-to-1 and group chat for 50 million daily users, including what happens when a user's phone is offline for a day and comes back.
Design a news feed
Twitter/X, Instagram or LinkedIn timelines. The core decision is fan-out on write (push each new post into followers' precomputed feeds: fast reads, expensive for accounts with millions of followers) versus fan-out on read (build the feed when it's opened: cheap writes, slow reads). Real systems use a hybrid: push for most users, pull for celebrities, then rank and cache.
What to learn
- Fan-out on write vs on read, and the hybrid for celebrities
- Feed storage in a cache (lists of post IDs) and hydrating posts
- The social graph: who follows whom
- Ranking at a high level; pagination with cursors
- Media in object storage behind a CDN
Free resources
Practice
Estimate the write load of fan-out on write when an account with 50 million followers posts, and design how your system avoids that spike.
Design file storage and sync
Dropbox or Google Drive. Files are split into chunks (a few MB each) identified by their hash, so unchanged chunks are never uploaded twice and identical files are stored once. Chunks go to object storage; a metadata database tracks files, versions and which chunks make them up. Clients sync by comparing chunk lists and get notified of changes by other devices.
What to learn
- Chunking, content hashes and deduplication
- Metadata service: files, folders, versions, sharing
- Uploads straight to object storage with pre-signed URLs; resumable uploads
- Sync and change notifications; conflict handling
Free resources
Practice
Design what happens, chunk by chunk, when a user edits one paragraph in a 200 MB file on a laptop while their phone has the same file open.
Design video streaming
YouTube or Netflix. Uploads go to object storage, then a pipeline of workers transcodes each video into several resolutions and bitrates, cut into short segments with a playlist (HLS or DASH). Players use adaptive bitrate streaming, switching quality as bandwidth changes. Almost all traffic is served by CDNs; the design challenge is the upload and transcoding pipeline and keeping popular videos close to viewers.
What to learn
- Upload flow with resumable uploads; the transcoding pipeline as a queue of jobs
- Codecs, resolutions and bitrate ladders
- HLS and DASH: segments, playlists, adaptive bitrate
- CDN strategy for popular vs long-tail videos
- View counts and metadata at scale
Free resources
Practice
Estimate storage for 500 hours of video uploaded per minute, each kept in five qualities, and design the pipeline from "upload finished" to "playable in all qualities".
Design ride sharing
Uber or Ola. Drivers send their location every few seconds, a firehose of writes. Finding nearby drivers needs a geospatial index: geohashes, quadtrees or hexagonal grids like H3 turn "drivers within 2 km" into a lookup of a few cells. Matching must not give one driver two rides, trips move through a state machine, and pricing reacts to supply and demand.
What to learn
- Location updates at scale; keeping only the latest position in memory
- Geohash, quadtrees and H3 for nearby search
- Matching without double-booking a driver (locks or leases)
- Trip state machine, ETAs and surge pricing at a high level
- Partitioning by city or region
Free resources
Practice
A city has 100,000 drivers updating every 4 seconds. Estimate the write rate, and design how a rider's request finds the 5 nearest free drivers in under a second.
Design search autocomplete
Suggest completions as the user types, within about 100 ms. A trie with the top suggestions stored at each prefix answers quickly; the counts come from search logs aggregated offline, and popular prefixes are cached at the edge. Filtering offensive suggestions and personalising them are good follow-ups.
What to learn
- Tries and storing the top-k completions per node
- Building the trie from logs with a batch job; updating it
- Caching per prefix; sharding the trie
Free resources
Practice
Build a trie from a list of 10,000 search phrases with counts, store the top 5 at each node, and measure lookup time for prefixes of one to five letters.
Design a payment system
Correctness beats speed. Every payment request carries an idempotency key so retries never charge twice; money movements are recorded in a double-entry ledger that always balances; calls to the payment provider are retried safely; and a daily reconciliation job compares your records with the provider's and the bank's.
What to learn
- Idempotency keys end to end
- Double-entry ledgers and immutable records
- Payment states and handling provider timeouts ("unknown" outcomes)
- Reconciliation and audit trails
Free resources
Practice
Design checkout payment for an online shop. Walk through what happens if the provider charges the card but your server times out before hearing back.
Practising for interviews
Knowing the building blocks is not enough: you need to drive a 45-minute conversation. Practise out loud, with a timer and a whiteboard or drawing tool, and ideally with another person. Junior and mid-level interviews focus on a clear, working design; senior interviews expect you to lead, quantify, spot bottlenecks before you're asked and discuss trade-offs and failure modes in depth.
What to learn
- Timing: about 5 minutes requirements, 5 estimates, 10 high-level design, 20 deep dives, 5 wrap-up
- Asking clarifying questions instead of assuming
- Stating trade-offs and alternatives, not only your choice
- Mock interviews with a peer, both as candidate and interviewer
- Writing a short design document for one of the systems above
Free resources
Practice
Do three timed mock interviews from this stage with a friend. Record them, then note where you went silent, skipped estimates or forgot failure cases.
Am I ready? Stage 4 quiz
Roughly how many different codes do 7 base62 characters give a URL shortener?
- About 62 million
- About 1 billion
- About 3.5 trillion
- About 7 thousand
627 ≈ 3.5 × 1012, enough for decades of links at billions per year.
In a news feed, why is pure fan-out on write a problem for celebrity accounts?
- One post must be written into tens of millions of feeds at once
- Celebrities post less often
- Their posts are larger
- It breaks pagination
Pushing to every follower's feed is cheap for normal users but explodes for huge accounts; hybrids pull celebrity posts at read time instead.
How does a file sync service avoid uploading a whole 1 GB file after a small edit?
- It compresses the file
- It uploads at night
- It uses a faster network
- It splits files into chunks identified by hashes and uploads only changed chunks
Content-addressed chunks mean unchanged chunks are already on the server; only the modified chunks travel.
Which structure helps find nearby drivers quickly?
- A linked list of all drivers
- A geospatial index such as geohash cells, a quadtree or H3
- A bigger relational table
- A message queue
Spatial indexes turn "within 2 km" into a lookup of a few neighbouring cells instead of scanning every driver.
A payment request timed out and the client retries. What prevents a double charge?
- A longer timeout
- Asking the user to check their bank
- An idempotency key: the server returns the original result for a repeated key
- Retrying without the amount
The server stores the result per idempotency key, so the retry is recognised as the same payment and not executed again.
How to use this roadmap
- Go in order the first time. Each stage builds on the previous one: you can't reason about sharding without databases, or about a chat app without queues and WebSockets.
- Choose your level with the filter. Junior & mid-level highlights what most interviews at those levels ask: the foundations, the building blocks and the more common designs. Senior & staff adds consensus, distributed transactions, observability and the harder case studies.
- Draw, then build. Many practice tasks run on your laptop with Docker. Building a tiny cache, rate limiter or chat teaches more than reading about ten of them.
- Track your progress. Tick sub-skills in each topic: ticking the first marks a topic as in progress, ticking them all marks it as done. Progress stays in this browser. Use Export to move it to another device, or Share progress to send a link.
How system design interviews are judged
Interviewers rarely look for one correct architecture. They look for a structured approach (requirements before boxes), sensible numbers, clear communication, awareness of trade-offs, and depth on at least one hard part. Saying "I'd start with a single PostgreSQL database and add read replicas when reads exceed what one machine handles" is better than drawing Kafka and five microservices for a system with 100 users.
What to learn before and after
Before: solid programming, the DSA roadmap (hashing, trees and heaps show up in designs), and basic networking. Alongside: the AWS roadmap turns these ideas into real services (load balancers, RDS, DynamoDB, SQS, S3, CloudFront), and the DevOps roadmap covers running them in production.