System Design

Learn System Design

How to Learn System Design?

Scalability

Availability

Latency and Performance

Concurrency and Coordination

Monitoring and Observability

Resilience and Error Handling

Fault Tolerance vs. High Availability

Flashcards Review

Chapter Assessment

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

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

Introduction to DNS

DNS Resolution Process

DNS Load Balancing and High Availability

Flashcards Review

Chapter Assessment

What is a Proxy Server?

Uses of Proxies

VPN vs. Proxy Server

Flashcards Review

Chapter Assessment

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

Introduction to API Gateway

Usage of API gateway

Advantages and disadvantages of using API gateway

Flashcards Review

Chapter Assessment

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

What Is Rate Limiting

Rate Limiting Algorithms

Distributed Rate Limiting

Rate Limiting in Practice

Flashcards Review

Chapter Assessment

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

What is CDN?

Origin Server vs. Edge Server

CDN Architecture

Push CDN vs. Pull CDN

Flashcards Review

Chapter Assessment

Introduction to Data Partitioning

Partitioning Methods

Data Sharding Techniques

Benefits of Data Partitioning

Common Problems Associated with Data Partitioning

Flashcards Review

Chapter Assessment

What is Redundancy?

What is Replication?

Replication Methods

Data Backup vs. Disaster Recovery

Flashcards Review

Chapter Assessment

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

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

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

Introduction to Bloom Filters

Benefits & Limitations of Bloom Filters

Variants and Extensions of Bloom Filters

Applications of Bloom Filters

Flashcards Review

Chapter Assessment

Why Quorum?

What is Quorum?

Flashcards Review

Chapter Assessment

What is Leader and Follower Pattern?

Flashcards Review

Chapter Assessment

What is Heartbeat?

Flashcards Review

Chapter Assessment

What is Checksum?

Uses of Checksum

Flashcards Review

Chapter Assessment

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

What is a Distributed File System?

Architecture of a Distributed File System

Key Components of a DFS

Flashcards Review

Chapter Assessment

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

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 Trade-offs

Importance of Discussing Trade-offs

Strong vs Eventual Consistency

Latency vs Throughput

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

Primary-Replica vs Peer-to-Peer Replication

Data Compression vs Data Deduplication

Server-Side Caching vs Client-Side Caching

REST vs RPC

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

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

Quiz

Designing a URL Shortening Service like TinyURL

Quiz - Designing URL Shortner

Designing Pastebin

Quiz - Designing Pastebin

Designing Instagram

Quiz - Designing Instagram

Designing Dropbox

Quiz - Designing Dropbox

Designing Facebook Messenger

Quiz - Designing Facebook Messenger

Designing Twitter

Quiz - Designing Twitter

Designing Youtube or Netflix

Quiz - Designing Youtube

Designing Typeahead Suggestion

Quiz - Designing Typeahead Suggestion

Designing an API Rate Limiter

Quiz - Designing an API Rate Limiter

Designing Twitter Search

Quiz - Designing Twitter Search

Designing a Web Crawler

Quiz - Designing a Web Crawler

Designing Facebook’s Newsfeed

Quiz - Designing Facebook’s Newsfeed

Designing Yelp or Nearby Friends

Quiz - Designing Yelp or Nearby Friends

Designing Uber backend

Quiz - Designing Uber backend

Designing Ticketmaster

Quiz - Designing Ticketmaster

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

YouTube Likes Counter

Quiz

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

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: 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

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

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: 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

Design Reddit

Quiz

Designing a Notification System

Quiz

Design Google calendar (Medium)

Quiz

Design a Recommendation System for Netflix

Quiz

Design Gmail

Quiz

Design Google News, a Global News Aggregator System (Medium)

Quiz

Design Unique ID Generator (Easy)

Quiz

Design Code Judging System like LeetCode (Medium)

Quiz

Design Payment System

Quiz

Design a Flash Sale for an E-commerce Site (Hard)

Quiz

Design a Reminder Alert System

Quiz

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

Importance of Discussing Trade-offs

Importance of Discussing Trade-offs

caching

consistency models

availability

databases

+1

hard
·
8 min
·Updated Aug 2026·Credit: Grokking the System Design Interview

Two candidates reach the same point in a design and say almost the same thing.

The first says: "I'll put a cache in front of the database."

The second says: "I'll put a cache in front of the database. That takes most reads off the database and cuts read latency. It costs us a window where a user can see stale data. I'm accepting that because the requirement says the feed can be a few seconds behind. If this were account balances, I would not."

Both named the same component. Only one of them made a decision. That difference is what this chapter is about.

What a Trade-off Is

A trade-off is what you give up in order to get something else.

It is not a drawback you failed to avoid, and it is not a mistake to apologize for. If one option were better in every way, there would be no decision to make. Nobody would ask you about it. A design question is interesting exactly because every answer costs something.

So when an interviewer asks you to justify a choice, they are not looking for the perfect component. They are checking two things. Do you know what your choice costs? And did you pick it on purpose?

A Sentence You Can Reuse

Most candidates know the trade-offs. What they lack is a habit for saying them out loud during the interview. This pattern gives you one:

I'll use X. That gives us A. It costs us B. I'm accepting B because of requirement R. If R changed, I'd use Y instead.

Five parts: the choice, the gain, the cost, the reason, and the alternative.

The last two matter most. Anyone can list a pro and a con. Tying the decision to a requirement shows you are designing this system, not reciting a comparison table. Naming the alternative shows you considered one.

Image
The five parts of a stated trade-off, and the same five parts applied to a real caching decision

Three Worked Examples

Choosing a database. "I'll use a key-value store for the session data. All lookups are by session id, so reads take single-digit milliseconds, and the data splits across machines easily. It costs us the ability to query sessions by anything except the id. I'm accepting that because no requirement asks for other queries. If we later need 'all active sessions in this region', I'd add a relational store or a separate index."

Choosing how services communicate. "The order service will publish an event, and the email service will consume it, instead of a direct call. A slow or failed email service then cannot fail an order. It costs us a short window where the order exists and the email has not been sent. I'm accepting that because a late email is fine and a lost order is not. If the caller needed the result before answering the user, I'd make it a direct call."

Choosing a replication setup. "Writes go to a primary and reads go to replicas. That scales reads, and this workload is about ninety percent reads. It costs us replication lag, so a user can write something and not see it on the next read. I'm accepting that in general. But I'd send a user's own reads to the primary right after they write, so everyone sees their own changes."

None of these takes longer than a few sentences, and none needs unusual knowledge. They are ordinary decisions stated completely.

Four Ways to Lose Points

Image
The four common ways candidates lose points on a trade-off they understand, what each sounds like, and what to say instead

Naming a technology without its cost. "I'll use Kafka" is not a decision. The interviewer cannot tell whether you chose it or only recognized it. Say what it gives you and what it costs.

Comparing without deciding. A balanced comparison that ends without a choice looks like avoiding the decision. Interviewers grade judgment, and you cannot show judgment without committing. Pick one, say why, and move on.

Re-deciding a settled question. If the requirements already say the system must stay available during a regional outage, the consistency question is answered. Do not spend three minutes weighing it again. Say that the requirement settles it, and continue. Time spent on settled questions is taken from the open ones.

Conceding a cost nobody challenged. Some candidates repeat every weakness of their design until they abandon a reasonable choice. State the cost once, calmly, then keep the decision. Raising a concern once shows confidence. Repeating it shows doubt.

When the Interviewer Asks "Why Not the Other One?"

The most common mistake here is to assume you were wrong and switch.

Usually the interviewer is testing whether you know why you chose. Sometimes they are adding new information. You can tell the difference by checking one thing: did a requirement change?

If no requirement changed, keep your choice. Explain the reasoning again, starting from the requirement that drove it. If a requirement did change, say so and update the design: "This now has to work across regions, so the trade-off changes. I'd accept eventual consistency here." Changing your mind for a stated reason is a strength. Changing it only because you were questioned is not.

How This Chapter Is Organized

The rest of the chapter covers the trade-offs that appear most often. They are grouped by where in a system the decision is made, the same way the System Design Master Template is grouped. Read the chapter in order to prepare generally, or go straight to the group you need.

Image
The trade-offs chapter grouped by where in a system the decision is made

Foundations. The two measurements every design is judged against, and the basic scaling choice: Latency vs Throughput and Horizontal vs Vertical Scaling.

How the request reaches you. Decisions made at the edge, before your code runs: Proxy vs Reverse Proxy, CDN Usage vs Direct Server Serving, and Load Balancer vs API Gateway. Then API Gateway vs Direct Service Exposure and Token Bucket vs Leaky Bucket.

Where the work happens. How the services are shaped: Stateful vs Stateless Architecture and Serverless vs Traditional Server-based. And how they communicate: REST vs RPC, Synchronous vs Asynchronous Communication, and Push vs Pull Architecture. Finally, Polling vs Long-Polling vs WebSockets vs Webhooks and Batch Processing vs Stream Processing.

Where the data is stored. The group that usually decides whether a design works at the stated scale: SQL vs NoSQL, Normalization vs Denormalization, and ACID vs BASE. Then Strong vs Eventual Consistency, Primary-Replica vs Peer-to-Peer Replication, and Read Heavy vs Write Heavy System.

How you make it fast. Where a cache sits, and how it behaves once it is there: Server-Side Caching vs Client-Side Caching and Cache-Aside vs Read-Through, Write-Through vs Write-Back.

Start with Latency vs Throughput, because it gives you the vocabulary the rest of the chapter is written in.

💡 In the interview: you do not need to discuss every trade-off, and trying to do so will cost time you need elsewhere. Give the most detail to the two or three decisions that shape the architecture. Those are usually the data store, the consistency model, and how services communicate. For everything else, one clause is enough: "load balancer here, standard round robin, nothing interesting about it."

Key takeaway: a trade-off is what you give up to get something else, and every real design decision has one. State it in a fixed shape: choice, gain, cost, the requirement that makes the cost acceptable, and the alternative if that requirement changed. Tie each decision to a requirement, commit to it, and do not re-open what the question already settled.

Discussion
Have a question or insight about this topic? Share it with the community.
Reading Progress
0%

On This Page