Overview
This section teaches system design through heavily annotated examples in Go and Python. Each example is self-contained and includes annotations explaining the reasoning behind every design decision.
What You Will Learn
The by-example path covers 95% of essential system design concepts through 85+ concrete examples organized by difficulty level.
How to Use This Section
Work through the examples in order or jump to topics relevant to your current challenges. Each example stands alone and can be studied independently.
- Beginner - Foundational concepts with simple, approachable examples
- Intermediate - Moderate complexity covering common real-world patterns
- Advanced - Complex distributed systems and large-scale architectures
- Cases - End-to-end worked design cases that combine the patterns above into complete systems
Structure of Each Example
Every example follows a consistent five-part format:
- Brief Explanation — what the design addresses and why it matters (2-3 sentences)
- Mermaid Diagram — visual representation of system components, data flow, or architecture (when appropriate)
- Heavily Annotated Code — implementations in Go and Python with
// =>comments documenting decisions and trade-offs - Key Takeaway — the core insight to retain from the example (1-2 sentences)
- Why It Matters — production relevance and real-world impact (50-100 words)
Examples by Level
Beginner (Examples 1–28)
- Example 1: The Client-Server Model
- Example 2: HTTP Methods and Status Codes
- Example 3: REST API Design Basics
- Example 4: DNS Resolution — How Names Become Addresses
- Example 5: Round-Robin Load Balancing
- Example 6: Least-Connections Load Balancing
- Example 7: In-Memory Caching with TTL
- Example 8: Cache Invalidation Strategies
- Example 9: SQL vs NoSQL — When to Use Each
- Example 10: Database Indexing Basics
- Example 11: Vertical Scaling — Scale Up
- Example 12: Horizontal Scaling — Scale Out
- Example 13: Stateless vs Stateful Services
- Example 14: Forward Proxy — Client-Side Intermediary
- Example 15: Reverse Proxy — Server-Side Intermediary
- Example 16: Measuring Latency and Throughput
- Example 17: The P50/P95/P99 Latency Percentiles
- Example 18: Block Storage vs File Storage vs Object Storage
- Example 19: CDN — Content Delivery Network Basics
- Example 20: API Rate Limiting — Token Bucket Algorithm
- Example 21: Pagination — Offset vs Cursor
- Example 22: Idempotency Keys — Safe Retries
- Example 23: Health Checks — Liveness and Readiness
- Example 24: Message Queue Basics — Decoupling Services
- Example 25: Service Discovery — How Services Find Each Other
- Example 26: Circuit Breaker Pattern
- Example 27: Consistent Hashing — Distributing Data Across Nodes
- Example 28: Availability, Reliability, and SLAs
Intermediate (Examples 29–57)
- Example 29: Publish-Subscribe Pattern with Message Queue
- Example 30: Point-to-Point Queue (Work Queue)
- Example 31: Master-Slave Replication
- Example 32: Multi-Master Replication and Conflict Resolution
- Example 33: Range-Based Sharding
- Example 34: Hash-Based Sharding
- Example 35: Consistent Hashing Ring
- Example 36: Token Bucket Rate Limiter
- Example 37: Sliding Window Rate Limiter
- Example 38: Circuit Breaker with Three States
- Example 39: API Gateway with Request Routing and Authentication
- Example 40: Service Registry and Client-Side Discovery
- Example 41: Health Check Endpoints with Dependency Probing
- Example 42: Synchronous vs Asynchronous Communication
- Example 43: JSON Serialization and Schema Validation
- Example 44: Protocol Buffers Serialization
- Example 45: B-Tree Index vs Sequential Scan
- Example 46: Database Connection Pool
- Example 47: Distributed Session with Token-Based Authentication
- Example 48: Multi-Channel Notification Dispatcher
- Example 49: Inverted Index for Full-Text Search
- Example 50: Object Storage with Metadata Indexing
- Example 51: Structured Logging with Correlation IDs
- Example 52: Metrics Collection and Alerting
- Example 53: Distributed Tracing with Span Propagation
- Example 54: Key-Value Cache with TTL and LRU Eviction
- Example 55: Write-Through and Write-Back Cache Patterns
- Example 56: Load Balancer Algorithms — Round Robin, Least Connections, and Weighted
- Example 57: Idempotency Keys for Safe Retries
Advanced (Examples 58–85)
- Example 58: CAP Theorem — Partition Tolerance Forces a Choice
- Example 59: PACELC — Extending CAP with Latency
- Example 60: Raft Consensus — Leader Election Basics
- Example 61: Paxos Concepts — Two-Phase Agreement
- Example 62: Event Sourcing — State as Append-Only Event Log
- Example 63: CQRS — Separating Read and Write Models
- Example 64: Saga Pattern — Long-Running Transactions Without 2PC
- Example 65: Two-Phase Commit — Atomic Distributed Transactions
- Example 66: Vector Clocks — Causality Tracking Without Synchronized Clocks
- Example 67: Gossip Protocol — Epidemic Information Dissemination
- Example 68: Bloom Filter — Space-Efficient Probabilistic Set Membership
- Example 69: Distributed Caching Strategies — Cache-Aside, Write-Through, Write-Behind
- Example 70: Leader Election — Distributed Lock with Expiring Leases
- Example 71: Geo-Replication — Multi-Region Active-Active vs Active-Passive
- Example 72: Kafka Concepts — Topics, Partitions, Consumer Groups
- Example 73: Service Mesh — Sidecar Proxy Pattern
- Example 74: Chaos Engineering — Fault Injection Testing
- Example 75: Blue-Green and Canary Deployments
- Example 76: Feature Flags — Progressive Feature Rollout
- Example 77: Observability — Metrics, Logs, and Traces (The Three Pillars)
- Example 78: SLA, SLO, SLI — Reliability Target Hierarchy
- Example 79: Back-of-Envelope Estimation — Storage and Throughput
- Example 80: Capacity Planning — Database Sizing and Sharding Decision
- Example 81: Data Lake Architecture — Ingestion, Storage, and Query Layers
- Example 82: Stream Processing — Tumbling Window Aggregations
- Example 83: Incident Management — Runbooks and Blameless Post-Mortems
- Example 84: Multi-Region Strategy — Data Residency and Routing
- Example 85: URL Shortener at Scale — Applying Advanced Patterns
Last updated March 19, 2026