System Design
Learn System Design
Introduction to System Design
System Design Roadmap: How to Learn System Design from Scratch
Key Characteristics of Distributed Systems
Scalability
Availability
Latency and Performance
Concurrency and Coordination
Monitoring and Observability
Resilience and Error Handling
Fault Tolerance vs. High Availability
Flashcards Review
Chapter Assessment
Network Essentials
HTTP vs. HTTPS
TCP vs. UDP
HTTP: 1.0 vs. 1.1 vs 2.0 vs. 3.0
URL vs. URI vs. URN
What Happens When You Type a URL into the Browser
Flashcards Review
Chapter Assessment
Long-Polling vs. WebSockets vs. Server-Sent Events
Introduction to Real-Time Communication
What is Long-Polling?
What is WebSocket?
What are Server-Sent Events?
Difference Between Long-Polling, WebSockets, and Server-Sent Events
Flashcards Review
Chapter Assessment
Domain Name System (DNS)
Introduction to DNS
DNS Resolution Process
DNS Load Balancing and High Availability
Flashcards Review
Chapter Assessment
Proxies
What is a Proxy Server?
Uses of Proxies
VPN vs. Proxy Server
Flashcards Review
Chapter Assessment
Load Balancing
Introduction to Load Balancing
Load Balancing Algorithms
Uses of Load Balancing
Load Balancer Types
Stateless vs. Stateful Load Balancing
High Availability and Fault Tolerance
Scalability and Performance
Challenges of Load Balancers
Flashcards Review
Chapter Assessment
API Gateway
Introduction to API Gateway
Usage of API gateway
Advantages and disadvantages of using API gateway
Flashcards Review
Chapter Assessment
API Design
What Is an API?
What Are REST APIs?
Resources, Not Actions
HTTP Methods and Their Semantics
URL Design
Request and Response Shapes
Status Codes and Error Design
Pagination from the Consumer's View
Idempotency Keys
Versioning and Backward Compatibility
Concurrency and Conditional Requests
REST vs gRPC vs GraphQL
Flashcards Review
Chapter Assessment
Rate Limiting and Throttling
What Is Rate Limiting
Rate Limiting Algorithms
Distributed Rate Limiting
Rate Limiting in Practice
Flashcards Review
Chapter Assessment
Caching
Introduction to Caching
Why is Caching Important?
Types of Caching
Cache Replacement Policies
Cache Invalidation
Cache Read Strategies
Cache Coherence and Consistency Models
Caching Challenges
Cache Performance Metrics
Flashcards Review
Chapter Assessment
CDN
What is CDN?
Origin Server vs. Edge Server
CDN Architecture
Push CDN vs. Pull CDN
Flashcards Review
Chapter Assessment
Data Partitioning
Introduction to Data Partitioning
Partitioning Methods
Data Sharding Techniques
Benefits of Data Partitioning
Common Problems Associated with Data Partitioning
Flashcards Review
Chapter Assessment
Redundancy and Replication
What is Redundancy?
What is Replication?
Replication Methods
Data Backup vs. Disaster Recovery
Flashcards Review
Chapter Assessment
CAP & PACELC Theorems
Introduction to CAP Theorem
Components of CAP Theorem
Trade-offs in CAP Theorem
Examples of CAP Theorem in Practice
Beyond CAP Theorem
System Design Trade-offs in Interviews
Flashcards Review
Chapter Assessment
Databases (SQL vs. NoSQL)
Introduction to Databases
SQL Databases
NoSQL Databases
SQL vs. NoSQL
ACID vs BASE Properties
Real-World Examples and Case Studies
SQL Normalization and Denormalization
In-Memory Database vs. On-Disk Database
Data Replication vs. Data Mirroring
Database Federation
Flashcards Review
Chapter Assessment
Indexes
What are Indexes?
How a B-Tree Index Works
Types of Indexes
B-Tree vs. LSM Tree
Indexes in Distributed Systems
Flashcards Review
Chapter Assessment
Bloom Filters
Introduction to Bloom Filters
Benefits & Limitations of Bloom Filters
Variants and Extensions of Bloom Filters
Applications of Bloom Filters
Flashcards Review
Chapter Assessment
Quorum
Why Quorum?
What is Quorum?
Flashcards Review
Chapter Assessment
Leader and Follower
What is Leader and Follower Pattern?
Flashcards Review
Chapter Assessment
Heartbeat
What is Heartbeat?
Flashcards Review
Chapter Assessment
Checksum
What is Checksum?
Uses of Checksum
Flashcards Review
Chapter Assessment
Distributed Messaging System
Introduction to Messaging System
Introduction to Kafka
Messaging patterns
Popular Messaging Queue Systems
RabbitMQ vs. Kafka vs. ActiveMQ
Scalability and Performance
Flashcards Review
Chapter Assessment
Distributed File Systems
What is a Distributed File System?
Architecture of a Distributed File System
Key Components of a DFS
Flashcards Review
Chapter Assessment
Security
What is Security and Privacy?
What is Authentication?
What is Authorization?
Authentication vs. Authorization
OAuth vs. JWT for Authentication
What is Encryption?
What are DDoS Attacks?
Flashcards Review
Chapter Assessment
Misc Concepts
Batch Processing vs. Stream Processing
XML vs. JSON
Synchronous vs. Asynchronous Communication
Push vs. Pull Notification Systems
Microservices vs. Serverless Architecture
Message Queues vs. Service Bus
Stateful vs. Stateless Architecture
Event-Driven vs. Polling Architecture
Flashcards Review
Chapter Assessment
Quiz - System Design Fundamentals
Quiz
System Design Trade-offs
Importance of Discussing Trade-offs
Strong vs Eventual Consistency
Latency vs Throughput
Horizontal vs Vertical Scaling
ACID vs BASE Properties in Databases
Read-Through vs Write-Through Cache
Batch Processing vs Stream Processing
Load Balancer vs. API Gateway
API Gateway vs Direct Service Exposure
Proxy vs. Reverse Proxy
API Gateway vs. Reverse Proxy
SQL vs. NoSQL
Normalization vs Denormalization
Primary-Replica vs Peer-to-Peer Replication
Data Compression vs Data Deduplication
Server-Side Caching vs Client-Side Caching
REST vs RPC
Synchronous vs Asynchronous Communication
Push vs Pull Architecture
Polling vs. Long-Polling vs. WebSockets vs. Webhooks
CDN Usage vs Direct Server Serving
Serverless Architecture vs Traditional Server-based
Stateful vs Stateless Architecture
Hybrid Cloud Storage vs All-Cloud Storage
Token Bucket vs Leaky Bucket
Read Heavy vs Write Heavy System
Quiz
How to Approach a System Design Interview
What is a System Design Interview?
System Design Interviews - A step by step guide
Functional vs. Non-functional Requirements
What are Back-of-the-Envelope Estimations?
Things to Avoid During System Design Interview
System Design Master Template
System Design Master Template
Quiz
Designing a URL Shortening Service like TinyURL
Designing a URL Shortening Service like TinyURL
Quiz - Designing URL Shortner
Designing Pastebin
Designing Pastebin
Quiz - Designing Pastebin
Designing Instagram
Designing Instagram
Quiz - Designing Instagram
Designing Dropbox
Designing Dropbox
Quiz - Designing Dropbox
Designing Facebook Messenger
Designing Facebook Messenger
Quiz - Designing Facebook Messenger
Designing Twitter
Designing Twitter
Quiz - Designing Twitter
Designing Youtube or Netflix
Designing Youtube or Netflix
Quiz - Designing Youtube
Designing Typeahead Suggestion
Designing Typeahead Suggestion
Quiz - Designing Typeahead Suggestion
Designing an API Rate Limiter
Designing an API Rate Limiter
Quiz - Designing an API Rate Limiter
Designing Twitter Search
Designing Twitter Search
Quiz - Designing Twitter Search
Designing a Web Crawler
Designing a Web Crawler
Quiz - Designing a Web Crawler
Designing Facebook’s Newsfeed
Designing Facebook’s Newsfeed
Quiz - Designing Facebook’s Newsfeed
Designing Yelp or Nearby Friends
Designing Yelp or Nearby Friends
Quiz - Designing Yelp or Nearby Friends
Designing Uber backend
Designing Uber backend
Quiz - Designing Uber backend
Designing Ticketmaster
Designing Ticketmaster
Quiz - Designing Ticketmaster
Dynamo: How to design a key value store?
Dynamo: Introduction
High-Level Architecture
Data Partitioning
Replication
Vector Clocks and Conflicting Data
The Life of Dynamo’s put() & get() Operations
Anti-entropy Through Merkle Trees
Gossip Protocol
Dynamo Characteristics and Criticism
Summary: Dynamo
Quiz: Dynamo
Mock Interview: Dynamo
Designing YouTube Likes Counter (medium)
YouTube Likes Counter
Step 2: Requirements
Step 3: Capacity Estimation
Step 4: API Design
Step 5: High-Level Design
Step 6: Database Schema
Step 7: Detailed Component Design
Step 8: Toggles and Idempotency
Step 9: Scalability and Performance
Step 10: Failure Modes and Operations
Quiz
Cassandra: How to Design a Wide-column NoSQL Database?
Cassandra: Introduction
High-level Architecture
Replication
Cassandra Consistency Levels
Gossiper
Anatomy of Cassandra's Write Operation
Anatomy of Cassandra's Read Operation
Compaction
Tombstones
Summary: Cassandra
Quiz: Cassandra
Mock Interview: Cassandra
Kafka: How to Design a Distributed Messaging System?
Messaging Systems: Introduction
Kafka: Introduction
High-level Architecture
Kafka: Deep Dive
Consumer Groups
Kafka Workflow
Role of ZooKeeper
Controller Broker
Kafka Delivery Semantics
Kafka Characteristics
Summary: Kafka
Quiz: Kafka
Mock Interview: Kafka
Chubby: How to Design a Distributed Locking Service?
Chubby: Introduction
High-level Architecture
Design Rationale
How Chubby Works
File, Directories, and Handles
Locks, Sequencers, and Lock-delays
Sessions and Events
Master Election and Chubby Events
Caching
Database
Scaling Chubby
Summary: Chubby
Quiz: Chubby
Mock Interview: Chubby
HDFS: How to Design File Storage System?
Hadoop Distributed File System: Introduction
High-level Architecture
Deep Dive
Anatomy of a Read Operation
Anatomy of a Write Operation
Data Integrity & Caching
Fault Tolerance
HDFS High Availability (HA)
HDFS Characteristics
Summary: HDFS
Quiz: HDFS
Mock Interview: HDFS
GFS: How to Design a Distributed File System Storage?
Google File System: Introduction
High-level Architecture
Single Master and Large Chunk Size
Metadata
Master Operations
Anatomy of a Read Operation
Anatomy of a Write Operation
Anatomy of an Append Operation
GFS Consistency Model and Snapshotting
Fault Tolerance, High Availability, and Data Integrity
Garbage Collection
Criticism on GFS
Summary: GFS
Quiz: GFS
Mock Interview: GFS
BigTable: How to Design a Wide Column Storage System?
BigTable: Introduction
BigTable Data Model
System APIs
Partitioning and High-level Architecture
SSTable
GFS and Chubby
Bigtable Components
Working with Tablets
The Life of BigTable's Read & Write Operations
Fault Tolerance and Compaction
BigTable Refinements
BigTable Characteristics
Summary: BigTable
Quiz: BigTable
Mock Interview: BigTable
Designing Reddit (medium)
Design Reddit
Step 2: Requirements
Step 3: Capacity Estimation
Step 4: API Design
Step 5: High-Level Design
Step 6: Detailed Component Design
Step 7: Scalability and Performance
Quiz
Designing Notification Service (medium)
Designing a Notification System
Step 2: Requirements
Step 3: Capacity Estimation
Step 4: API Design
Step 5: High-Level Design
Step 6: Data Storage and Schema
Step 7: Detailed Component Design
Step 8: Scalability and Performance
Step 9: Failure Modes and Operations
Quiz
Design Google Calendar (medium)
Design Google calendar (Medium)
Step 2: Requirements
Step 3: Capacity Estimation
Step 4: API Design
Step 5: High-Level Design
Step 6: Database Schema
Step 7: Detailed Component Design
Step 8: Scalability and Performance
Quiz
Design a Recommendation System (medium)
Design a Recommendation System for Netflix
Step 2: Requirements
Step 3: Capacity Estimation
Step 4: API Design
Step 5: High-Level Design
Step 6: Database Schema
Step 7: Detailed Component Design
Quiz
Designing Gmail (medium)
Design Gmail
Step 2: Requirements
Step 3: Capacity Estimation
Step 4: RESTful APIs
Step 5: High-Level Design
Step 6: Database Design
Step 7: Detailed Component Design
Step 8: Scalability and Performance
Step 9: Reliability and Availability
Step 10: Evolution and Future Optimizations
Quiz
Designing Google News (medium)
Design Google News, a Global News Aggregator System (Medium)
Step 2: Requirements
Step 3: Capacity Estimation
Step 4: High-Level Architecture
Step 5: Data Model and Storage
Step 6: Detailed Component Design
Step 7: Scalability and Performance
Step 8: Failure Modes and Operations
Quiz
Designing Unique ID Generator (medium)
Design Unique ID Generator (Easy)
Step 2: Requirements
Step 3: Capacity Estimation
Step 4: API Design
Step 5: High-Level Design
Step 6: ID Generation Strategies
Step 7: Scalability and Performance
Step 8: Failure Modes and Operations
Quiz
Designing Code Judging System (medium)
Design Code Judging System like LeetCode (Medium)
Step 2: Requirements
Step 3: Capacity Estimation
Step 4: High-Level Architecture
Step 5: Data Storage and Indexing
Step 6: Detailed Component Design
Quiz
Designing Payment System (hard)
Design Payment System
Step 2: Requirements
Step 3: Capacity Estimation
Step 4: High-Level Design
Step 5: Database Schema
Step 6: Detailed Component Design
Step 7: Scalability and Performance
Step 8: Failure Modes and Operations
Quiz
Designing Flash Sale System (hard)
Design a Flash Sale for an E-commerce Site (Hard)
Step 2: Requirements
Step 3: Capacity Estimation
Step 4: High-Level Architecture
Step 5: Database Schema
Step 6: Detailed Component Design
Step 7: Failure Modes and Operations
Quiz
Designing Reminder Alert System (hard)
Design a Reminder Alert System
Step 2: Requirements
Step 3: Capacity Estimation
Step 4: High-Level Design
Step 5: Data Model and Storage
Step 6: Detailed Component Design
Step 7: Scalability and Performance
Quiz
System Design Patterns
Introduction: System Design Patterns
1. Bloom Filters
2. Consistent Hashing
3. Quorum
4. Leader and Follower
5. Write-ahead Log
6. Segmented Log
7. High-Water Mark
8. Lease
9. Heartbeat
10. Gossip Protocol
11. Phi Accrual Failure Detection
12. Split Brain
13. Fencing
14. Checksum
15. Vector Clocks
16. CAP Theorem
17. PACELC Theorem
18. Hinted Handoff
19. Read Repair
20. Merkle Trees
Quiz
System Design Roadmap: How to Learn System Design from Scratch
availability
scalability
consistency
load balancing
+3
To learn system design, study seven topics in order: how systems are measured, how requests travel, how services talk, how data is stored, how data is scaled, the consistency trade-offs, and how machines coordinate during failures. Then practice by designing real systems, such as a URL shortener or a news feed, against a 45 minute timer. This roadmap puts those steps into ten chapters, and each chapter links to the free lessons, the blog post, and the course chapter that teach it.
Most engineers can learn the fundamentals in four to six weeks at about an hour a day, and reach interview level in eight to twelve weeks. The study plans below show what to do with two weeks, six weeks, or three months.
This roadmap is written by Arslan Ahmad, the creator of Grokking the System Design Interview, and published on Design Gurus.
Taking this as a course? This roadmap is its first lesson. The lessons after it teach every chapter below: the fundamentals, the trade-offs, the interview method, and complete design problems. Read this page once for the plan, then start with Scalability.
Table of Contents
- Prerequisites: Does System Design Require Coding?
- The Roadmap in One Table
- 1. What System Design Is
- 2. How Systems Are Measured
- 3. How a Request Reaches the Server
- 4. How Services Talk to Each Other
- 5. How Data Is Stored
- 6. How Data Is Scaled
- 7. Consistency, Availability, and Trade-offs
- 8. Queues, Coordination, and Failure
- 9. Design Real Systems
- 10. Prepare for the System Design Interview
- Study Plan by Time Budget
- What Each Level Needs
- Free Resources Outside This Roadmap
- Frequently Asked Questions
Prerequisites: Does System Design Require Coding?
System design does not require you to write code, but it does require you to have written some. In a typical system design interview, you draw boxes and arrows on a whiteboard and explain your choices; nobody asks you to compile anything. However, the reasoning depends on knowing what code does at runtime: why a database query is slow, what happens when two requests change the same row, and why a server runs out of memory. Engineers who have built and shipped even one small web application learn system design much faster than those who have not.
One exception is the low-level design round (also called object-oriented design), which asks you to design classes and their methods for something like a parking lot. That round does involve code or pseudocode. The rest of this roadmap covers high-level design, which is what most companies mean by "system design".
Before chapter 1, check that these four things are true:
- You can program at a working level in at least one language, and you can read code written by others.
- You know what happens when you type a URL into a browser: the name lookup, the request, the server's work, and the response. The lesson on what happens when you type a URL explains it end to end.
- You have used a database and know what a query and an index are, even if you have never tuned one.
- You have a rough feel for how slow each operation is. Reading from memory takes about 100 nanoseconds. Reading from a fast SSD takes about 100 microseconds, which is about a thousand times slower. A network round trip inside one data center takes about half a millisecond, and a round trip between continents takes 100 milliseconds or more. Caches, CDNs, and replicas all exist because some operations are thousands of times slower than others.
You do not need a computer science degree, consensus algorithms, or formal proofs of the CAP theorem before you start. Those topics are easier to learn once the basics in chapters 2 to 6 are in place.
The Roadmap in One Table
The ten chapters fall into three phases. Chapters 1 to 8 build the vocabulary: the parts every system is made from (the primitives). Chapter 9 shows how those parts combine into real designs. Chapter 10 turns that knowledge into a 45 minute interview performance.
| Chapter | What you learn | Phase |
|---|---|---|
| 1. What system design is | The problem, the two kinds of design, the main architecture styles | Foundations |
| 2. How systems are measured | Scalability, availability, latency, throughput, estimation | Foundations |
| 3. How a request reaches the server | Networking, DNS, proxies, load balancers, API gateways, rate limiting | Foundations |
| 4. How services talk | APIs, REST and gRPC, real-time connections | Foundations |
| 5. How data is stored | SQL and NoSQL databases, indexes, transactions | Foundations |
| 6. How data is scaled | Caching, CDNs, partitioning, replication | Foundations |
| 7. Consistency and trade-offs | CAP, PACELC, strong and eventual consistency | Foundations |
| 8. Queues, coordination, failure | Message queues, leaders, quorums, heartbeats | Foundations |
| 9. Design real systems | URL shortener, Instagram, Twitter, Uber, and more | Patterns |
| 10. The interview | The four step framework, timing, mock interviews | Practice |
Do not move to the next phase until you pass the readiness check at the end of each chapter in the current one.
1. What System Design Is
System design is the work of deciding which parts a software system needs, how those parts connect, and how the whole system behaves as traffic grows and machines fail. Writing code answers "how does this function work?". System design answers "where does the data live, what happens when a million people use this at once, and what breaks first?".
There are two kinds of design. High-level design (HLD) covers services, databases, caches, and queues, and it is what most interviews call "system design". Low-level design (LLD) covers the classes and methods inside one service. Most systems also follow one of a few architecture styles: one deployable program (a monolith), many small services that call each other over a network (microservices), or services that react to events published by others (event-driven). Each style trades simplicity for independence, and the chapters below explain when each one fits.
- Course chapter: this roadmap is the course's first lesson, and the lessons begin with Scalability
- Blog: Types of System Design Interviews and System Design Building Blocks
- Ready when: you can explain the difference between high-level and low-level design in two sentences.
2. How Systems Are Measured
Every design is judged by a small set of properties: scalability, availability, latency, throughput, and fault tolerance. Scalability is the ability to handle more load, either with a bigger machine (vertical scaling) or with more machines (horizontal scaling). Availability is the share of time the system answers requests: 99.9 percent allows about 8.8 hours of downtime a year, while 99.99 percent allows about 53 minutes. Latency is how long one request takes, and throughput is how many requests the system completes per second.
The same chapter teaches estimation, which turns these properties into numbers. If 100 million users each make 10 requests a day, the system serves one billion requests a day, which is about 11,600 requests per second on average and two to three times that at peak. A number like that tells you whether one database is enough or whether you need twenty.
- Lessons: Scalability, Availability, Latency and Performance, Fault Tolerance vs. High Availability, Back-of-the-Envelope Estimations
- Course chapter: Key Characteristics of Distributed Systems
- Blog: 4 Basic Pillars of System Design, Throughput vs Latency, and Back-of-the-Envelope Estimation
- Ready when: you can estimate the requests per second and the storage per year for an app with a given number of users.
3. How a Request Reaches the Server
Before a server does any work, a request passes through name lookup, the network, and several machines that decide where it goes. DNS turns a name like designgurus.io into an IP address. TCP gives the request a reliable, ordered connection, and HTTPS encrypts it. A load balancer then spreads requests across many servers, using rules such as round robin or least connections, which only works cleanly when any server can handle any request (stateless servers). An API gateway sits in front of many services and handles authentication, routing, and rate limiting, which caps how many requests one client can send per second.
- Lessons: HTTP vs. HTTPS, TCP vs. UDP, Introduction to DNS, What Is a Proxy Server, Introduction to Load Balancing, Load Balancing Algorithms, Introduction to API Gateway, What Is Rate Limiting
- Course chapter: Network Essentials and Load Balancing
- Blog: What Happens When You Type a URL?, Load Balancer vs. Reverse Proxy vs. API Gateway, and How to Design a Rate Limiter
- Ready when: you can trace one request from the browser to the database and name every machine it passes through.
4. How Services Talk to Each Other
Services communicate through APIs, and the choice of API style decides how fast and how reliable that communication is. REST over HTTP is the usual choice for public APIs because every client understands it. gRPC is common between internal services because its messages are smaller and faster to parse. When the server must push data to the client, such as a chat message or a live score, the options are long polling, WebSockets, and server-sent events, and each one holds a connection open in a different way. Two terms come up in every API question: an idempotent request is one that is safe to retry, and pagination splits a large result into pages.
- Lessons: What Is an API, What Are REST APIs, Idempotency Keys, REST vs. gRPC vs. GraphQL, Introduction to Real-time Communication, Synchronous vs. Asynchronous Communication
- Course chapter: Long-Polling vs. WebSockets vs. Server-Sent Events and API Design
- Blog: The API Design Checklist and How to Design a RESTful API
- Ready when: you can say which of REST, gRPC, and WebSockets you would use for a mobile app, an internal service, and a chat client, and why.
5. How Data Is Stored
The database is the hardest part of most systems to change later, so the choice deserves the most care. SQL databases store data in tables with a fixed schema and support transactions, which group several changes so that either all of them happen or none do. NoSQL databases relax some of those rules to scale across many machines more easily, and they come in four common types: key-value stores, document stores, wide-column stores, and graph databases. An index is a separate structure that lets the database find rows without reading the whole table, at the cost of slower writes and extra storage.
- Lessons: Introduction to Databases, SQL vs. NoSQL, ACID vs. BASE Properties, What Are Indexes, B-Tree vs. LSM-Tree
- Course chapter: Databases (SQL vs. NoSQL) and Indexes
- Blog: NoSQL Databases in System Design, PostgreSQL vs. MongoDB vs. DynamoDB, and Database Indexing Explained
- Ready when: you can choose a database for a given workload and name the alternative you rejected.
6. How Data Is Scaled
Once one database cannot keep up, there are four standard tools: caching, CDNs, partitioning, and replication. A cache keeps frequently read data in memory, so a lookup takes well under a millisecond instead of several. A CDN keeps copies of static files, such as images and videos, on servers close to users around the world. Partitioning (also called sharding) splits the data across machines so that each one holds only part of it, which spreads the writes. Replication keeps copies of the same data on several machines, which spreads the reads and keeps the data safe when one machine fails.
Each tool creates a new problem. A cache can serve stale data after the source changes, a bad partition key sends most traffic to one machine (a hot key), and replicas can briefly disagree with each other. Chapter 7 covers that last problem.
- Lessons: Introduction to Caching, Cache Invalidation, What Is a CDN, Introduction to Data Partitioning, Data Sharding Techniques, What Is Replication
- Course chapter: Caching, Data Partitioning, and Redundancy and Replication
- Blog: Caching in System Design Interviews, CDN Architecture in System Design, and Database Replication
- Ready when: you can explain cache-aside, write-through, and write-behind caching, and sketch how a sharded database handles one very popular key.
7. Consistency, Availability, and Trade-offs
Every design decision gives up something to gain something else, and the most common trade-off is between consistency and availability. Strong consistency means every read returns the latest write. Eventual consistency means copies agree over time but can briefly differ. The CAP theorem states that when the network splits machines into groups that cannot reach each other (a partition), a system must choose between answering every request and answering only with the latest data. PACELC adds that even without a partition, the system still trades lower latency against stronger consistency.
This chapter matters more than any other in an interview, because interviewers do not score the design itself. They score whether you can explain what each choice costs. A useful habit while studying: for every concept you learn, ask "what do I gain, and what do I give up?".
- Lessons: Introduction to CAP Theorem, Beyond CAP Theorem, Importance of Discussing Trade-offs, Strong vs. Eventual Consistency, Read-Through vs. Write-Through Cache, Read-Heavy vs. Write-Heavy System
- Course chapter: CAP and PACELC Theorems and System Design Trade-offs
- Blog: CAP Theorem vs PACELC, Eventual vs Strong Consistency, and System Design Trade-Offs
- Ready when: you can name a product feature that needs strong consistency and one that is fine with eventual consistency, and defend both.
8. Queues, Coordination, and Failure
In a system with many machines, some machine is almost always slow or down, so the design must keep working when parts of it fail. A message queue lets one service hand work to another without waiting for it, which absorbs traffic spikes and keeps a slow consumer from blocking a fast producer. To agree on anything, machines need coordination: one leader accepts the writes and followers copy them, heartbeats (small regular "I am alive" messages) detect a dead machine, and a quorum (a majority vote) decides which copy of the data wins. A checksum detects data that was corrupted on disk or on the network.
These topics also explain partial failure, where a request reaches one machine but not another, and clock problems, where two machines disagree about the time. Both cause bugs that never appear on a single machine.
- Lessons: Introduction to Messaging System, Introduction to Kafka, Batch Processing vs. Stream Processing, What Is Leader and Follower Pattern, What Is Heartbeat, What Is Quorum, What Is Checksum
- Course chapter: Distributed Messaging System and Quorum
- Blog: Messaging Patterns: Queues, Pub/Sub, and Event Streams and RabbitMQ vs Kafka vs ActiveMQ
- Ready when: you can explain at-least-once delivery, why the consumer must handle duplicates, and what happens to writes when the leader dies.
9. Design Real Systems
Most "design X" questions are variations on about ten patterns, and studying one system per pattern prepares you for the rest. Start with a URL shortener, which uses almost every primitive from chapters 2 to 6 at a small scale. Then move to a photo feed, a chat app, and a ride-sharing service. For each one, try the design yourself under a timer before you read the walkthrough, then compare the two and write down every decision you missed.
| Pattern | Study this design first | Main problem it teaches |
|---|---|---|
| Key generation and redirects | URL shortener | Unique IDs, read-heavy caching |
| Social feed | Twitter and Instagram | Push vs. pull fan-out, very popular accounts |
| Chat | Facebook Messenger | Open connections, message ordering |
| Location matching | Uber backend and Yelp | Geospatial indexes, frequent updates |
| Video | YouTube or Netflix | CDNs, encoding pipelines |
| Search | Typeahead suggestion and Twitter search | Inverted indexes, ranking |
| File storage | Dropbox | Chunking, sync conflicts |
| Booking | Ticketmaster | Seat locking, concurrent buyers |
| API platform | API rate limiter | Distributed counters |
| Storage engine | Dynamo key-value store | Partitioning, replication, and quorums together |
- Lessons: System Design Master Template, plus every design in the table above
- Course chapter: System Design Problems
- Blog: Easy System Design Interview Questions, How to Design Instagram, and the System Design Interview Questions Library
- Ready when: given a one-sentence product description, you can name its closest pattern and the two hardest problems in it.
10. Prepare for the System Design Interview
A system design interview is a 45 to 60 minute conversation, and it rewards a fixed structure more than a clever design. Use four steps. First, clarify the requirements for about 10 minutes: what the system must do (functional requirements), and how fast, how large, and how reliable it must be (non-functional requirements). Second, draw a high-level design with five to eight parts. Third, spend most of the remaining time on the one or two hardest problems. Fourth, explain what would fail under load and how you would detect it.
Practice the way the interview runs. Design on a whiteboard or paper, not in a text editor, and keep the timer running. Explain each design to another person who asks "why?" after every choice, then compare your design with the engineering blog of the real company. Do at least three mock interviews with someone who has run real interviews before your first real one.
Four habits slow most learners down:
- Memorizing designs. Interviewers change one requirement to see whether you understand the design or remember it.
- Skipping the requirements step. "Design Twitter" can mean ten different systems, and scoping it is part of the score.
- Using one tool for everything. If the only reason for a choice is "I know this one", name the alternative and compare them.
- Reading instead of designing. Watching a walkthrough before you try the problem yourself teaches you the presenter's reasoning, not your own.
The material for this chapter:
- Lessons: System Design Interviews: A Step-by-Step Guide, Functional vs. Non-functional Requirements, Things to Avoid During a System Design Interview
- Course chapter: How to Approach a System Design Interview
- Blog: System Design Interview Guide: 7 Steps, How to Gather Requirements, and Mock Interview Practice for Engineers
- Ready when: you can finish a full 45 minute mock interview on an unfamiliar question and answer a follow-up with a reason rather than a memorized fact.
Study Plan by Time Budget
Pick the plan that matches the time you have before your interview. All three follow the chapter order above. The shorter plans cut the number of designs you practice, not the order of the chapters.
2 weeks: a focused refresher
This plan assumes about two hours a day and some prior exposure to backend work. It is enough for a junior or mid-level interview, but not for a senior one.
| Days | Work |
|---|---|
| 1 to 3 | Chapters 2 and 3: scalability, availability, estimation, load balancing |
| 4 to 6 | Chapters 5 and 6: databases, indexes, caching, sharding, replication |
| 7 | Chapter 7: CAP and the main trade-offs |
| 8 | Chapter 10: the four step framework |
| 9 to 12 | Four timed designs: URL shortener, Instagram, Twitter, Messenger |
| 13 to 14 | Two mock interviews, then review the questions you could not answer |
6 weeks: the standard plan
This plan assumes about one hour on weekdays and three hours on weekends, or about eight hours a week. It suits most mid-level candidates and a well-prepared junior.
| Week | Work |
|---|---|
| 1 | Chapters 1 to 3, with flashcards at the end of each chapter |
| 2 | Chapters 4 and 5 |
| 3 | Chapters 6 and 7 |
| 4 | Chapter 8, then chapter 10's framework and your first timed design |
| 5 | Three timed designs from chapter 9, one per pattern |
| 6 | Three more designs and two or three mock interviews |
3 months: from beginner to senior level
This plan assumes five to eight hours a week, and it is the right length for a first senior interview or for someone new to backend systems.
- Month 1, foundations. Chapters 1 to 6. In weeks 1 and 2, cover scaling and data: horizontal scaling, load balancers, SQL and NoSQL, sharding, and replication. In weeks 3 and 4, cover caching, CDNs, and APIs. Finish every chapter assessment before moving on.
- Month 2, applied design. Chapters 7 to 9. Study the trade-offs, then queues and coordination, then design one system per pattern from the table in chapter 9, about eight in total. Write a one-page summary of each design from memory.
- Month 3, interview practice. Chapter 10. Do eight to ten more timed designs, at least three to five mock interviews, and redesign two earlier systems with a different constraint, such as ten times the traffic or strict consistency.
Thirty minutes every day teaches more than four hours once a week, because recall improves when you return to a topic often.
What Each Level Needs
The bar changes with the level you are interviewing for, so the same roadmap needs a different depth at each one.
| Level | Typical experience | Prep time | Typical questions | What the interviewer looks for |
|---|---|---|---|---|
| Junior (L3) | 0 to 2 years | 4 to 6 weeks | URL shortener, simple chat, parking lot | Basic reasoning about clients, servers, and databases; no over-engineering |
| Mid-level (L4) | 2 to 5 years | 8 to 12 weeks | Instagram, rate limiter, notifications | Correct use of caching, sharding, and replication, with reasons |
| Senior (L5) | 5 to 10 years | 12 to 16 weeks | Twitter with very popular accounts, Uber, YouTube | Depth on the hardest one or two problems; failure modes named early |
| Staff (L6+) | 10+ years | Ongoing | Open product questions, multi-region systems | Clear technical direction, second-order effects, migration plans |
Junior candidates can stop after the first three or four designs in chapter 9. Senior and staff candidates should work through all ten patterns and add at least five mock interviews.
Free Resources Outside This Roadmap
This roadmap is one path, and a few outside resources are worth adding to it. Designing Data-Intensive Applications by Martin Kleppmann is the best book on how databases and distributed systems work, and it suits chapters 5 to 8. Alex Xu's System Design Interview books cover many worked interview questions. The open-source System Design Primer on GitHub is a free overview of most of the topics above. Engineering blogs from companies such as Netflix, Uber, Discord, and Stripe show how real systems made the trade-offs in chapter 7.
For comparisons of these and other options, see 10 Best Free Resources to Learn System Design, 9 Best System Design GitHub Repos and Resources, and the one-page System Design Cheat Sheet.
Frequently Asked Questions
How long does it take to learn system design?
Most engineers learn the fundamentals in four to six weeks at 30 to 60 minutes a day, and reach interview level in eight to twelve weeks. Senior candidates usually need 12 to 16 weeks, because the senior bar asks for depth on several patterns.
Does system design require coding?
Most system design interviews do not ask you to write code; you draw and explain a design. You still need working programming experience, because the reasoning depends on knowing why queries are slow and how servers fail. Low-level design rounds are the exception, since they ask for classes and methods.
Can I learn system design without a computer science degree?
Yes. System design depends on a small set of concepts and trade-offs, not on academic theory. If you can program and have used a database, you can follow this roadmap in order from chapter 1.
Is low-level design the same as system design?
No. High-level design covers services, databases, caches, and how they connect, and it is what most interviews mean by system design. Low-level design covers the classes and methods inside one service, and many companies run it as a separate round.
Should I start with design problems or with concepts?
Start with concepts. A design walkthrough uses caching, sharding, and replication without explaining them, so reading one first gives you conclusions without the reasons. Finish chapters 2 to 6, then begin the designs in chapter 9.
What is the best free way to learn system design?
Read the free lessons linked in chapters 1 to 9 of this roadmap in order, then practice the designs in chapter 9 under a timer. Add Designing Data-Intensive Applications for depth, and the System Design Primer on GitHub for a second explanation of each topic.
Is system design only useful for interviews?
No. The same skills decide which database a team uses, how an API is shaped, and how a service behaves when traffic doubles. Interviews compress that work into 45 minutes, while real projects add budgets, deadlines, and existing systems.
How do I know I am ready for a system design interview?
You are ready when you can pass the readiness check at the end of every chapter, and complete three to five mock interviews at your target level with positive feedback. If you cannot explain a choice without your notes, you are not ready yet.
Start Here
Open the next chapter and study Scalability for 30 minutes. Then close the page and explain the difference between vertical and horizontal scaling out loud, without looking. That one exercise is the method this whole roadmap uses: read one concept, explain it from memory, and move on only when the explanation is complete.
Next lesson: Scalability. The lessons after it cover chapters 1 to 10 of this roadmap, so you can keep pressing Next.
Prefer separate courses? Chapters 1 to 8 are also taught in Grokking System Design Fundamentals, and chapters 9 and 10 in Grokking the System Design Interview.
Discussion
On This Page