Mini Map
Search
⌘ K
AI Features
Log In
Grokking the Modern System Design Interview*
1.
System Design Interviews
The Architect’s Mindset
The Three Pillars
Reliable
Effective
Maintainable
Reusable Building Blocks
Iterate Your Design
Coding vs. Designing
High-Level Thinking
Three-Step Interview Flow
Step 1: Clarify Needs
Step 2: Understand Data
Step 3: Pick Components
Design Is Trade-offs
How would you fix this?
The 10x Load Shock
What's Your First Move?
Interview Red Flags
Recap: System Design Interviews
2.
System Design Primer
Introduction
Abstraction in System Design
The Art of Ignoring Details
Abstraction in Databases
The Illusion of Local Calls
How RPC Travels
Step 1: Packing the Order
Step 2: The Journey
Step 3: Execution & Return
Who Uses RPC?
The Consistency Trade-off
Strict vs. Eventual
Causal Consistency
Scenario: The Facebook Comments
Failures in System Design
Distributed Systems Recap
3.
Non Functional Requirements
Non Functional Requirements
What is Availability?
The Cost of Nines
What is Reliability?
Availability vs. Reliability
Metrics for reliability
What is Scalability?
Scaling Strategies
Vertical Scaling (Scale Up)
Horizontal Scaling (Scale Out)
Scaling Decision
Fault Tolerance
The Safety Net: Replication
What is Maintainability?
MTTR: The Critical Link
System Design Pillars
4.
Back-of-the-envelope Calculations
Inside the Data Center
Web Servers: The Front Door
App Servers: The Brain
Storage Servers: The Vault
Estimate Before You Build
The Napkin Math Superpower
The Speed Hierarchy
CPU bound vs. IO-bound
Real World: Scaling Twitter
The Peak Traffic Trap
Calculating Storage
The Inputs
The Daily Math
The Yearly Reality
Estimator's Checklist
5.
Building Blocks
Don't Reinvent the Wheel
The Architect's Toolkit
Managing Traffic
Storing Data
Speed & Delivery
Health & Communication
Picking the Right Storage Block
Messaging, Routing & Compute Blocks
System Design First Steps
6.
Domain Name System
The Internet's Phonebook
Meet the DNS Team
The Resolver
Root Name Server
TLD Name Server
Authoritative Server
Trace the Lookup
Recursive vs Iterative DNS Lookups
Why is DNS Fast?
The DNS Dilemma
Stale DNS Risk
Recap: DNS Core
7.
Load Balancer
The Traffic Cop
Where Do They Sit?
Entry Point
Business Logic
Data Layer
More Than Routing
Global vs. Local
How LBs Choose
Round Robin
Weighted Round Robin
Least Connections
Layer 4 vs. Layer 7
Smart Routing
Recap: Load Balancer
8.
Databases
The File Cabinet Trap
Enter the Database
SQL vs. NoSQL
Pick the Right NoSQL
The ACID Guarantee
Atomicity
Consistency
Isolation
Durability
ACID Quiz
Data Replication
Sync vs. Async
Divide and Conquer
Vertical vs. Horizontal
Recap: Databases
9.
Key-value Store
Beyond the Database
Key-Value Store Use Cases
Distributed Key-Value Store
The Scalability Problem
The Solution: Consistent Hashing
Placing the Ring
Mapping the Keys
Adding a Node
Virtual Nodes for Balance
Replicating Around the Ring
When to Use Key-Value?
Availability vs Consistency
The Quorum Formula
The Overlap Rule
Vector Clocks Idea
Updating the Counters
Spotting Conflicting Versions
Quorum Consistency Check
Hinted Handoff Basics
Merkle Trees for Repair
Gossiping Nodes
Recap: Key-Value Store
10.
CDN
The Speed of Light Problem
Bottlenecks & Traffic Jams
Enter the CDN
Origin vs. The Edge
The Journey of a Request
Step 1: Routing
Step 2: The Proxy Check
Step 3: Origin Fetch
Strategy: Push vs. Pull
How Does it Find You?
The Stale Data Problem
Case Study: Netflix
What You Should Remember
11.
Sequencer
The Billion Event Problem
Why Not Auto-Increment?
The Lazy Fix: UUIDs
Strategy: The Range Handler
UUID vs. Range Handler
The Missing Piece: Time
Snowflake ID Basics
41 Bits: The Timestamp
10 Bits: Machine ID
12 Bits: The Sequence
The Hidden Villain: Clock Drift
What You Should Remember
12.
Distributed Monitoring
The Fragility of Scale
What is Distributed Monitoring?
The Domino Effect
Step 1: The Request
Step 2: The Crash
Step 3: The Outage
Server vs Client Errors
Key Monitoring Metrics
Monitoring Data Flow
Monitoring Architecture View
How Service Discoverer Helps
Hybrid Scaling Strategy
Monitoring at Huge Scale
Heat Maps for Health
Client-Side Blind Spot
Routing Leaks in Practice
Embedded Prober Agents
Privacy Check
What You Should Remember
13.
Distributed Cache
The Database Bottleneck
How Caching Works
Step 1: The Request
Step 2: Cache Hit
Step 3: Cache Miss
Why Distributed?
Writing Policies
Cleaning House: Eviction
Finding Data: Consistent Hashing
Inside the Cache Node
Internal Mechanics
The Brain: Configuration Service
Availability via Replication
The Cost of Missing
The Consistency Trade-off
Memcached vs. Redis
What You Should Remember
14.
Distributed Messaging Queue
The Synchronous Trap
Enter the Messaging Queue
Why Use a Queue?
Video Site Scenario
Limits of One Server
Key Design Pieces
Metadata Store & Cache
Ordering Is Hard
Best Effort vs Strict
Ordering vs Throughput
System at a Glance
Front-End Responsibilities
Backend Data Safety
How Replication Works
Primary Failure Behavior
Invisible Message Trick
What You Should Remember
15.
Pub-Sub
When One Event Fans Out
Why Systems Break Without It
The Minimum Vocabulary
Retention = Replay
Queue vs Broker
Broker Layout
Topics & Partitions
Offsets Are Bookmarks
Minimum Vocabulary
Crash Without Guessing
Resume After Crash
What You Should Remember
16.
Rate Limiter
The Digital Bouncer
Why Throttling Matters
Flow: The Request
Flow: The Check
Flow: The Block
Hard vs. Soft Throttling
The Best Vantage Point
Speed is Everything
HTTP 429: Too Many Requests
Anatomy of the Design
Handling Race Conditions
Token Bucket
Leaking Bucket
The Fixed Window Flaw
What You Should Remember
17.
Blob Store
What is a Blob Store?
Flat vs. Hierarchical
The WORM Rule
Structuring the Data
The Account
The Container
The Blob
YouTube Scale
Chunking Large Files
High-Level Architecture
Manager vs. Data Node
The Lifecycle of a Write
Request & Split
Storage & Map
Metadata: The Brain
Replication Strategy
The Deletion Trick
Partitioning Keys
Key Points to Remember
18.
Distributed Search
The Needle in the Digital Haystack
The Search Triad
1. The Crawler
2. The Indexer
3. The Searcher
Requirements Check
The Scale Challenge
The Magic of Inverted Index
Building an Inverted Index
Raw Documents
Tokenization
The Mapping
Centralized vs. Distributed
Offline vs. Online Flow
How to Split Data?
The Scatter-Gather Search
Design Mistake: Colocation
The Final Architecture
MapReduce Simplified
Map Phase
Reduce Phase
What You Should Remember
19.
Distributed Logging
The Software Detective
Why Not Just Print?
The Distributed Maze
Taming the Noise
Severity Levels
Smart Sampling
Security Trap
The Logging Pipeline
Accumulate & Buffer
Store & Search
Don't Block the User
What You Should Remember
20.
Distributed Task Scheduler
The Invisible Manager
OS vs. Distributed Scheduler
The Blueprint
Follow the Task Flow
Admission and Storage
The Waiting Room
Execution and Monitoring
Handling Dependencies
The FIFO Trap
Priority Lanes
Safe Retries (Idempotency)
Execution Timeouts
Recap: Distributed Task Scheduler
21.
Sharded Counters
Why Simple Counting Fails
The Celebrity Problem
Scenario: The Viral Spike
The Solution: Sharding
Visualizing Sharded Counters
The Setup
Writing (Distributed)
Reading (Aggregation)
The Great Trade-off
Predicting the Load
Real World: Trending Topics
Recap: Sharded Counters
22.
RESHADED FRAMEWORK
No Magic Formula
Phase 1: The Scope
Phase 2: The Skeleton
Phase 3: The Deep Dive
Phase 4: The Critique
Spot the Distinction
Recap: RESHADED
23.
Design YouTube
Designing YouTube
The Core Requirements
The Scale of Data
Read vs. Write Heavy?
Storage Architecture
HTTP Methods
The Life of a Video
Step 1: Ingestion
Step 2: Processing
Step 3: Storage
Why Bigtable Thumbnails
Consistency Trade-off
Detecting Duplicates
Adaptive Streaming Basics
Content Delivery Flow
Recap: Design YouTube
24.
Design Quora
Search Engines vs. Quora
The Core Value Proposition
Traffic Pattern Analysis
Polyglot Persistence
MySQL for Critical Data
NoSQL for Analytics
Blob Store for Media
Memcached vs. Redis
The Latency Bottleneck
Service Hosts to the Rescue
Vertical Sharding Basics
The Problem: Hot Tables
Vertical Partitioning
Handling Joins
Handling Not-So-Urgent Tasks
Switching to MyRocks
Disaster Recovery Strategy
System Design Check
Matching Data to Storage
Recap: Quora Design
25.
Design Google Maps
The Magic of Navigation
Core Building Blocks
The Hidden Data Structure
The Scale Challenge
Navigation Architecture
Step 1: Location & Routing
Step 2: The Search
Step 3: Handling Detours
Solving Scale: Segments
Inside a Segment
Stitching the World
Static vs. Dynamic
How Live Traffic Works
Recap: Google Maps Design
26.
Design Yelp
What is a Proximity Service?
The Scale Challenge
Read vs. Write Heavy
Core System Building Blocks
Speed via Map Grids
QuadTrees
The Root Node
When Grids Split
Recursive QuadTree Splits
Where QuadTrees Live
Ordering a Nearby Search
Fixing Manhattan Hotspots
Recap: Design Yelp
27.
Design Uber
More Than a Map
The Core Loop
The Moving Target Problem
Prioritizing Requirements
High-Level Architecture
How APIs Talk
Solving the Search Problem
Visualizing QuadTrees
The Basic Grid
The Split
Recursive Depth
QuadTree Update Overkill
Choosing the Right Database
Secure Payments
Fighting Fraud with RADAR
Recap: Design Uber
28.
Design Twitter
Designing the Firehose
Where is the Traffic?
The 1:1000 Rule
Availability vs. Consistency
High-Level Architecture
Entry Point
Speed & Storage
Custom Card
Polyglot Persistence
The Celebrity Problem
How Search Works
Custom Card
Power of Two Choices
Recap: Design Twitter
29.
Design Newsfeed
The Infinite Scroll Engine
Custom Card
Where Does Data Live?
Storage Math
Feed Generation Lifecycle
Step 1: Retrieval
Step 2: Aggregation
Step 3: Ranking
Step 4: Caching
The Graph Model
The Ranking Brain
High-Level Architecture
Speed vs. Scale
Recap: Newsfeed System
30.
Design Instagram
The Billion User Challenge
Visualizing Global Scale
Custom Card
Choosing Consistency Tradeoffs
Placing Instagram Data
How Data Ties Together
Users: The Identity Hub
Followers: Who Follows Whom
Photos and Blob Storage
Feed Generation: Pull
Custom Card
Handling Celebrity Traffic
Custom Card
End-to-End Architecture View
Recap: Instagram System Design
31.
Design TinyURL
What is TinyURL?
Custom Card
Estimating the Scale
Traffic & Bandwidth
Server Count
Security: The Prediction Problem
The High-Level Architecture
The Shortening Flow
Choosing the Database
Handling Unique IDs
Custom Card
The Encoding Math
Recap: Design TinyURL
32.
Design Web Crawler
Meet the Web Crawler
More Than Just Search
Custom Card
Crawler Politeness Rules
Anatomy of a Crawler
The Brain: Scheduler & Frontier
The Worker: Fetch & Extract
The Memory: Blob Store & Dedup
Assemble the Workflow
How Checksums Catch Dupes
Custom Card
Calendar Crawler Trap
Escaping Crawler Traps
Recap: Design a Web Crawler
33.
Design Whatsapp
The 100 Billion Message Challenge
Custom Card
The Offline Dilemma
The 200-Server Miracle
High-Level Architecture
The Lifecycle of a Message
Custom Card
Finding the User
How Media is Sent
Step 1: Upload & Encrypt
Step 2: Blob Storage
Step 3: Forwarding the ID
Handling Group Chats
Consistency vs. Availability
Custom Card
Reliable Message Delivery at Scale
34.
Design TypeAhead
What is Typeahead?
Custom Card
The 200ms Rule
Why 200ms Matters
High-Level Architecture
Custom Card
The Magic Data Structure: Trie
What is a Trie?
Optimizing the Tree
Ranking with Frequency
Live Updates or Not?
Custom Card
Debouncing Requests
Fast Suggestions are a Read Problem First
35.
Design Google Docs
The Old Way: Collaboration Chaos
Architecture: P2P or Centralized?
Custom Card
Custom Card
Journey of a Keystroke
Entry: API Gateway
Transport: WebSockets
Storage: Polyglot Persistence
Custom Card
The Concurrency Problem
Logic: Commutativity
Custom Card
Custom Card
Real-time Collaboration
Claim your Certificate
Home
Courses
Grokking the Modern System Design Interview*
Round Robin
We'll cover the following...
This component is not supported in the current context
...