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

API Gateway

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

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

Usage of API gateway

Usage of API gateway

api design

microservices

load balancing

security

+3

hard
·
7 min
·Updated Jul 2026·Credit: System Design Fundamentals

A microservices architecture has many small independent services, and managing the communication between all of them and every client gets complicated fast. A gateway is where that complexity goes.

There are twenty things people use one for. They fall into four groups.

Image
The twenty uses of an API gateway grouped into deciding where a request goes, reshaping it, protecting the backend, and running the business

Deciding Where the Request Goes

Request routing. Directing each incoming request to the appropriate backend service. In an e-commerce application with separate services for user management, product catalog and order processing, a request for product details is routed to the product catalog service, and a request to place an order goes to order processing.

Content-based routing. Routing based on the content of the request rather than only the path: headers, body, or query parameters. An API handling image, video and document uploads can have the gateway inspect the Content-Type header and route each upload to a service specialized for that media type.

Service discovery integration. In an environment where services scale up and down, such as Kubernetes, the gateway integrates with a discovery tool like Consul or Eureka so it always routes to instances that currently exist and are healthy, with no manual reconfiguration.

A/B testing and canary releases. Directing a subset of traffic to a different backend version. Deploying a new recommendation service, the gateway can send a small percentage of requests to it while the majority stay on the stable version, which lets you monitor the new version's behavior before rolling it out to everyone.

Reshaping the Request

Aggregation of multiple services. Combining responses from several backends into one response. A mobile app needing profile information, recent orders and recommendations on one screen does not have to call three services. The gateway fetches from the user service, the order service and the recommendation service, then returns a single unified response.

Image
Without aggregation the client makes three calls and stitches the results together, and with it the gateway makes them and returns one response

Protocol translation. Converting between the protocols the client and the backends speak. A client may send HTTP or HTTPS while some backends use WebSockets or gRPC, and the gateway performs the conversion so both sides work unchanged.

Transformation of requests and responses. Changing the data format or structure. If a client expects JSON but a backend returns XML, the gateway converts the XML response into JSON before sending it on, so the backend does not have to change.

Localization and internationalization. Adapting responses to the client's locale, detected from request headers or parameters, so dates, numbers and currencies match regional expectations, or so content comes from a region-specific service.

Reducing client complexity. Moving multi-step work to the server side. A registration flow that must create an account, send a welcome email and log the event can be one gateway endpoint that orchestrates all three behind the scenes, instead of three client calls.

Protecting the Backend

Security enforcement. Before a request reaches any backend service, the gateway can verify the user's authentication token, check that they have permission for the data they are asking for, and limit how many requests they are making. Who are you, what may you access, and how often are you asking.

Rate limiting and throttling. Controlling how many requests a client may make in a given time frame, which protects the backends from being overwhelmed. A public API might allow a maximum of 100 requests per minute per user and temporarily block further requests beyond that.

Circuit breaker pattern. Detecting that a backend is failing and stopping requests to it. If the order processing service becomes unresponsive, the gateway trips a circuit breaker: it stops sending new requests there for a period, giving the service time to recover, and can return fallback responses in the meantime.

Image
While the circuit is open the gateway stops calling the failing service and answers with a fallback, then tries again after a delay

SSL termination. Handling SSL/TLS encryption and decryption at the gateway instead of in every service. Clients connect to the gateway over HTTPS, the gateway forwards over HTTP or a secure internal network, and certificate management stops being a per-service problem.

Policy enforcement. Applying organizational rules to all traffic consistently. If every request must carry certain headers or have specific fields validated, the gateway validates each request before it reaches a backend and rejects any that do not comply.

Running It as a Business

Load balancing. Distributing requests across multiple instances of a backend service so no single instance becomes a bottleneck.

Caching responses. Storing frequently requested data so the gateway can answer without querying the backend every time. Product catalog data that changes rarely is the classic case, and serving it from cache cuts both latency and backend load.

Monitoring and logging. Recording request paths, response times and error rates, which is what you use to find performance problems, understand usage patterns and troubleshoot.

API versioning. Managing multiple versions so older clients keep working. The gateway routes requests to different backend versions based on the API version in the request, which is what lets you ship changes without breaking an app that has not been updated.

API monetization. Selling access by tier. A company offering a weather API in free, basic and premium tiers can have the gateway handle authentication, track usage per subscription plan, and integrate with billing systems.

Multi-tenancy support. Serving many customers from one infrastructure. A SaaS platform's gateway distinguishes tenants by headers or authentication tokens and applies tenant-specific routing, rate limits, logging and security policies, keeping each one isolated.

A Real Example

Netflix runs a large number of microservices covering everything from user profiles to streaming content. Its API Gateway manages the interactions between clients like smart TVs and mobile apps and that whole set of backend services, which is how it stays scalable and reliable under very heavy traffic.

💡 Do not list gateway features in an interview. Pick the one the question needs. "The mobile client is making six calls to render one screen, so I would aggregate at the gateway" answers a real problem. Reciting twenty capabilities answers nothing.

Key takeaway: A gateway decides where requests go through routing, content-based routing, service discovery and canary traffic splits. It reshapes them through aggregation, protocol translation, format transformation, localization and orchestration that reduces client complexity. It protects the backend through security enforcement, rate limiting, circuit breaking, SSL termination and policy enforcement. And it runs the operational and commercial side through load balancing, caching, monitoring, versioning, monetization and multi-tenancy.

The next lesson, Advantages and Disadvantages of Using API Gateway, weighs all of that against what it costs.

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

On This Page