§ index · all chapters
497 concepts. One click each.
Every section and sub-section across all 28 chapters. Filter it, then jump straight to the paragraph that explains it.
497 shown
Scale from Zero to Millions of Users
- Introduction
- Section 1: Single Server Setup
- └Request Flow
- └Traffic Sources
- Section 2: Database Separation
- └Database Choices
- Section 3: Vertical vs Horizontal Scaling
- └Vertical Scaling
- └Horizontal Scaling
- Section 4: Load Balancer
- Section 5: Database Replication
- └Master-Slave Model
- └Benefits
- └Failure Handling
- Section 6: Caching
- └Caching considerations
- Section 7: Content Delivery Network (CDN)
- └Workflow
- └CDN considerations
- Section 8: Stateless Web Tier
- Section 9: Multi-Data Center Setup
- └Key considerations
- Section 10: Message Queue
- Section 11: Logging, Metrics, and Automation
- └Importance
- Section 12: Database Scaling
- └Vertical Scaling
- └Horizontal Scaling (Sharding)
- Conclusion
- └Key Takeaways
Back-of-the-Envelope Estimation
- Introduction
- Section 1: Key Concepts
- └Power of Two
- └Latency Numbers Every Programmer Should Know
- └Availability Numbers
- Section 2: Example Estimation - Twitter QPS and Storage Requirements
- └Assumptions
- └Estimations
- Section 3: Tips for Effective Estimation
- └1. Rounding and Approximation
- └2. Write Down Assumptions
- └3. Label Units
- └4. Common Estimation Scenarios
A Framework for System Design Interviews
- Introduction
- Step 1: Understand the Problem and Establish Design Scope
- └Key Objectives
- └Approach
- └Example
- Step 2: Propose High-Level Design and Get Buy-In
- └Key Objectives
- └Approach
- └Example
- Step 3: Design Deep Dive
- └Key Objectives
- └Approach
- └Example Topics
- Step 4: Wrap-Up
- └Key Objectives
- └Approach
- Best Practices
- └Dos
- └Don’ts
- Time Management
- └Suggested Time Allocation (for 45-Minute Interviews):
Design a Rate Limiter
- Introduction
- Benefits of Rate Limiting
- Step 1: Understanding the Problem
- └Key Features
- └Requirements
- Step 2: High-Level Design
- └Placement Options
- └Guidelines for Placement
- Step 3: Rate Limiting Algorithms
- └1. Token Bucket
- └2. Leaking Bucket
- └3. Fixed Window Counter
- └4. Sliding Window Log
- └5. Sliding Window Counter
- High-Level Architecture
- Advanced Considerations
- └Distributed Environments
- └Performance Optimizations
- └Monitoring
Design Consistent Hashing
Design a Key-Value Store
- Introduction
- └Characteristics of the Design
- Single Server Key-Value Store
- └Implementation
- └Limitation
- Distributed Key-Value Store
- └CAP Theorem
- System Components
- └1. Data Partitioning
- └2. Data Replication
- └3. Consistency
- └4. Inconsistency Resolution
- └5. Handling Failures
- └6. Handling Data Center Outages
- Write and Read Paths
- └1. Write Path (Based on Cassandra architecture)
- └2. Read Path
- Final Architecture
Design a Unique ID Generator in Distributed Systems
- Introduction
- Step 1: Understanding the Problem
- └Basic Requirements
- Step 2: High-Level Design Options
- └1. Multi-Master Replication
- └2. UUID (Universally Unique Identifier)
- └3. Ticket Server
- └4. Twitter Snowflake Approach
- Step 4: Additional Considerations
- └1. Clock Synchronization
- └2. Section Length Tuning
- └3. High Availability
Design a URL Shortener
Design a Web Crawler
- Introduction
- └Applications of Web Crawlers
- └Design Challenges
- Step 1: Understanding the Problem
- └Requirements
- Step 2: High-Level Design
- └Components
- └Workflow
- Step 3: Deep Dive into Key Components
- └DFS/BFS
- └URL Frontier
- └HTML Downloader
- └Robustness
- └Extensibility
- └Avoiding Problematic Content
- Step 4: Wrap Up
- └Key Takeaways
- └Additional Considerations
Design a Notification System
Design a News Feed System
Design a Chat System
Design a Search Autocomplete System
- Introduction
- └Key Features
- Step 1: Understanding the Problem
- └Requirements
- Step 2: High-Level Design
- └Data Gathering Service
- └Query Service
- Step 3: Design Deep Dive
- └Trie Data Structure
- └Query Processing Flow
- └Optimizations
- └Data Gathering Pipeline
- └Scalability
- Step 4: Advanced Features
- └Multi-Language Support
- └Trending Queries
Design YouTube
- Introduction
- └Key Statistics (2020)
- Step 1: Understand the Problem and Scope
- └Core Functionalities
- └Supported Platforms
- └Assumptions
- Step 2: High-Level Design
- └Components
- └Core Workflows
- Step 3: Design Deep Dive
- └Video Transcoding
- └Video Transcoding Architecture
- System Optimizations
- └Speed Optimizations
- └Safety Optimizations
- └Cost-Saving Optimizations
- Error Handling
- └Recoverable Errors
- └Non-Recoverable Errors
Design Google Drive
- Introduction
- Step 1: Understanding the Problem
- └Key Requirements
- └Constraints and Assumptions
- Step 2: High-Level Design
- └Single-Server Setup
- └Moving to Distributed Systems
- └Improved design
- Step 3: Design Deep Dive
- └Metadata Database
- └File Upload Flow
- └File Sync
- └File Download Flow
- └Notification Service
- └Storage Optimization
- └Failure Handling
Proximity Service
- Introduction
- Step 1: Understanding the Problem and Establishing Scope
- └Functional Requirements
- └Non-Functional Requirements
- └Back-of-the-Envelope Estimation
- Step 2: High-Level Design
- └API Design
- └Data Model
- └Data Schema
- └High-Level System Architecture
- Step 3: Algorithms for Fetching Nearby Businesses
- └Option 1: Two-Dimensional Search (Naive Approach)
- └Better Approach
- └Option 2: Evenly Divided Grid
- └Option 3: Geohash
- └Option 4: Quadtree
- └Option 5: Google S2
- Tradeoff Comparison
- Step 4: Scaling the Database and Caching Strategy
- └Scaling the Business Table
- └Scaling the Geospatial Index
- └Cache Strategy
- Step 5: Deployment Strategy and Final Architecture
- └Region and Availability Zones
- └Handling Real-Time Updates
- └Final System Architecture
- Steps to Retrieve Nearby Businesses
- Key Optimizations
- └Choosing the Best Indexing Method
- References
Nearby Friends
- Introduction
- Step 1: Understand the Problem and Establish Design Scope
- └Functional requirements
- └Non-functional requirements
- └Back-of-the-envelope
- Step 2: Propose High-Level Design and Get Buy-In
- └High-level design
- └Periodic location update
- └API Design
- └Data model
- Step 3: Design Deep Dive
- └How well does each component scale?
- └Scaling deep-dive on redis pub/sub component
- └Adding/removing friends
- └Users with many friends
- └Nearby random person
- └Alternative to Redis pub/sub
- Step 4: Wrap Up
Google Maps
Distributed Message Queue
- Introduction
- Step 1: Understand the Problem and Establish Design Scope
- └Functional requirements
- └Non-functional requirements
- Step 2: Propose High-Level Design and Get Buy-In
- └Messaging models
- └Topics, partitions and brokers
- └Consumer groups
- └High-level architecture
- Step 3: Design Deep Dive
- └Data storage
- └Message data structure
- └Batching
- └Producer flow
- └Consumer flow
- └Consumer rebalancing
- └State storage
- └Metadata storage
- └ZooKeeper
- └Replication
- └In-sync replicas
- └Scalability
- └Data delivery semantics
- └Advanced features
- Step 4: Wrap Up
Metrics Monitoring and Alerting System
- Introduction
- Step 1: Understand the Problem and Establish Design Scope
- └High-level requirements and assumptions
- └Non-functional requirements
- Step 2: Propose High-Level Design and Get Buy-In
- └Fundamentals
- └Data model
- └High-level Design
- Step 3: Design Deep Dive
- └Metrics collection
- └Scale the metrics transmission pipeline
- └Where aggregations can happen
- └Query Service
- └Storage layer
- └Alerting system
- └Visualization system
- Step 4: Wrap up
Ad Click Event Aggregation
- Introduction
- Step 1: Understand the Problem and Establish Design Scope
- └Functional requirements
- └Non-functional requirements
- └Back-of-the-envelope estimation
- Step 2: Propose High-Level Design and Get Buy-In
- └Query API Design
- └Data model
- └High-level design
- Step 3: Design Deep Dive
- └Streaming vs. Batching
- └Time
- └Aggregation window
- └Delivery guarantees
- └Data deduplication
- └Scale the system
- └Fault Tolerance
- └Data monitoring and correctness
- └Alternative design
- Step 4: Wrap up
Hotel Reservation System
- Introduction
- Step 1: Understand the Problem and Establish Design Scope
- └Non-functional requirements
- └Back-of-the-envelope estimation
- Step 2: Propose High-Level Design and Get Buy-In
- └API Design
- └Data model
- └High-level Design
- Step 3: Design Deep Dive
- └Improved data model
- └Concurrency issues
- └Scalability
- └Data consistency among services
- Step 4: Wrap Up
Distributed Email Service
- Introduction
- Step 1: Understand the Problem and Establish Design Scope
- └Non-functional requirements
- └Back-of-the-envelope estimation
- Step 2: Propose High-Level Design and Get Buy-In
- └Email knowledge 101
- └Traditional mail servers
- └Distributed mail servers
- Step 3: Design Deep Dive
- └Metadata database
- └Email deliverability
- └Search
- └Scalability and availability
- Step 4: Wrap Up
S3-like Object Storage
- Introduction
- Step 1: Understand the Problem and Establish Design Scope
- └Non-functional requirements
- └Back-of-the-envelope estimation
- Step 2: Propose High-Level Design and Get Buy-In
- └High-level design
- └Uploading an object
- └Downloading an object
- Step 3: Design Deep Dive
- └Data store
- └Metadata data model
- └Listing objects in a bucket
- └Object versioning
- └Optimizing uploads of large files
- └Garbage collection
- Step 4: Wrap Up
Real-time Gaming Leaderboard
- Introduction
- Step 1: Understand the Problem and Establish Design Scope
- └Functional requirements
- └Non-functional requirements
- └Back-of-the-envelope estimation
- Step 2: Propose High-Level Design and Get Buy-In
- └API Design
- └High-level architecture
- └Data models
- Step 3: Design Deep Dive
- └To use a cloud provider or not
- └Scaling Redis
- └Alternative solution: NoSQL
- Step 4: Wrap Up
Payment System
- Introduction
- Step 1: Understand the Problem and Establish Design Scope
- └Functional requirements
- └Non-functional requirements
- └Back-of-the-envelope estimation
- Step 2: Propose High-Level Design and Get Buy-In
- └Pay-in flow
- └APIs for payment service
- └Payment service data model
- └Double-entry ledger system
- └Hosted payment page
- └Pay-out flow
- Step 3: Design Deep Dive
- └PSP Integration
- └Reconciliation
- └Handling payment processing delays
- └Communication among internal services
- └Handling failed payments
- └Exactly-once delivery
- └Consistency
- └Payment security
- Step 4: Wrap Up
Digital Wallet
- Introduction
- Step 1: Understand the Problem and Establish Design Scope
- └Back-of-the-envelope estimation
- Step 2: Propose High-Level Design and Get Buy-In
- └API Design
- └In-memory sharding solution
- └Distributed transactions
- └Distributed transaction using Try-Confirm/Cancel (TC/C)
- └TC/C Failure modes
- └Distributed transaction using Saga
- └Event sourcing
- Step 3: Design Deep Dive
- └High-performance event sourcing
- └Reliable high-performance event sourcing
- └Distributed event sourcing
- Step 4: Wrap Up
Stock Exchange
- Introduction
- Step 1: Understand the Problem and Establish Design scope
- └Non-functional requirements
- └Back-of-the-envelope estimation
- Step 2: Propose High-Level Design and Get Buy-In
- └Business Knowledge 101
- └High-level design
- └API Design
- └Data models
- Step 3: Design Deep Dive
- └Performance
- └Event sourcing
- └High availability
- └Fault tolerance
- └Matching algorithms
- └Determinism
- └Market data publisher optimizations
- └Distribution fairness of market data and multicast
- └Colocation
- └Network Security
- Step 4: Wrap Up