Patterns of Distributed Systems: Complete Roadmap

You've built monoliths, deployed microservices, and designed event-driven architectures. But when your system spans multiple machines, a completely different set of challenges emerge:
"What happens when a node crashes mid-write?"
"How do three servers agree on who's the leader?"
"How do we keep data consistent across replicas when the network splits?"
"Can we even trust timestamps in a distributed system?"
These are the questions that Patterns of Distributed Systems answers. Cataloged by Unmesh Joshi in Martin Fowler's signature series (Addison-Wesley, 2023), these patterns describe the recurring solutions found in systems like Kafka, etcd, ZooKeeper, Cassandra, and CockroachDB.
Every distributed system you interact with — every database cluster, every message broker, every coordination service — is built from combinations of these patterns. Understanding them is the difference between using distributed systems and understanding why they work the way they do.
Why Learn Distributed Systems Patterns?
✅ Understand your infrastructure — Kafka uses WAL + segmented log + leader/followers + high-water mark under the hood
✅ Debug production incidents — When a leader failover takes too long, knowing heartbeat and generation clock patterns explains why
✅ Design resilient systems — Choose between strong consistency and availability with confidence
✅ Ace system design interviews — Distributed systems patterns are the core of senior/staff-level interviews
✅ Evaluate technologies — Compare etcd vs ZooKeeper vs Consul by understanding the patterns they implement
✅ Avoid costly mistakes — Know when you need consensus, when eventual consistency is fine, and when 2PC is dangerous
✅ Career growth — Distributed systems knowledge separates senior engineers from staff/principal engineers
Who Is This Series For?
- Backend Engineers — Building or operating systems that span multiple machines
- DevOps/SRE Engineers — Understanding the internals of the infrastructure you manage
- Senior Developers — Deepening knowledge of patterns used in databases, message brokers, and coordination services
- Tech Leads & Architects — Making informed decisions about consistency, replication, and partitioning strategies
- Interview Candidates — Preparing for system design rounds at top companies
Prerequisites
Required Knowledge:
✅ Comfortable with at least one backend language (Java, Go, Python, or TypeScript)
✅ Experience building web applications with databases and APIs
✅ Basic understanding of networking (TCP, HTTP, client-server model)
✅ Familiarity with databases (transactions, replication concepts)
Helpful But Not Required:
- Understanding of software architecture patterns (microservices, event-driven)
- Experience with Docker and containerization
- Knowledge of enterprise application patterns
- Familiarity with message brokers (Kafka, RabbitMQ) or coordination services (ZooKeeper, etcd)
No distributed systems experience needed! This roadmap starts from the fundamentals and builds up.
Why Distributed Systems Are Hard
Before diving into patterns, let's understand why distributed systems need special patterns that centralized systems don't:
The Three Fundamental Challenges
Network Partitions: In a centralized system, function calls don't fail because the network is down. In a distributed system, any message between two nodes might be lost, delayed, duplicated, or arrive out of order. You can't tell the difference between a slow node and a dead node.
Partial Failures: When your monolith crashes, everything stops. When a node in a distributed system crashes, some nodes keep running — and they may not agree on what happened. You need mechanisms to detect failures, elect new leaders, and recover state.
Clock Skew: In a single machine, time.Now() gives a consistent ordering of events. Across machines, clocks drift apart (even with NTP). Two events on different machines might have conflicting timestamps, making "which happened first?" a surprisingly hard question.
The CAP Theorem in Practice
The CAP theorem states that during a network partition, a distributed system must choose between:
| Property | Description | Example |
|---|---|---|
| Consistency (C) | Every read receives the most recent write | etcd, ZooKeeper, CockroachDB |
| Availability (A) | Every request receives a response (no errors) | Cassandra, DynamoDB, Riak |
| Partition Tolerance (P) | System continues operating despite network partitions | All distributed systems (non-negotiable) |
Since network partitions are unavoidable in practice, the real choice is CP (consistency over availability) or AP (availability over consistency) during partitions. Different patterns in this series optimize for different sides of this trade-off.
Important: CAP is a simplification. Real systems operate on a spectrum of consistency models — from linearizability (strongest) to eventual consistency (weakest). The patterns in this series give you the vocabulary to navigate that spectrum.
The Pattern Language Approach
What makes this series unique is the pattern language approach. Each pattern:
- Solves a specific problem — e.g., "How do we detect that a leader has failed?"
- Has a name — e.g., "HeartBeat"
- Connects to other patterns — HeartBeat failure triggers Generation Clock, which triggers leader election via Majority Quorum
Patterns don't exist in isolation — they compose to build complete systems. Understanding the connections between patterns is as important as understanding individual patterns.
The Distributed Systems Pattern Landscape
Learning Path Overview
This series is organized into 6 phases with 12 comprehensive posts:
Phase 1: Durability Foundations (1 post)
How to persist data reliably — the foundation every distributed system needs before replication or consensus.
Phase 2: Leader Election & Consensus (3 posts)
How nodes agree on who leads, how they detect failures, and how they reach agreement — the heart of distributed systems.
Phase 3: Replication & Conflict Resolution (2 posts)
How to keep replicas in sync, serve reads from followers, and resolve conflicts when nodes disagree.
Phase 4: Partitioning & Time (2 posts)
How to split data across nodes and how to order events when clocks can't be trusted.
Phase 5: Coordination & Decentralization (2 posts)
How to coordinate a cluster with a small consistent core, and when to use gossip-based decentralized approaches instead.
Phase 6: Communication & Capstone (2 posts)
High-performance communication patterns and a capstone combining all patterns into real system designs.
PDS-1 (Roadmap & Overview) ← You are here
│
├─ Phase 1: Durability Foundations (Post 2)
│ └─ PDS-2: Write-Ahead Log, Segmented Log & Low-Water Mark
│ └─ Crash recovery, log segmentation, log compaction
│
├─ Phase 2: Leader Election & Consensus (Posts 3-5)
│ ├─ PDS-3: Leader and Followers, HeartBeat & Generation Clock
│ │ └─ Single-leader replication, failure detection, epoch numbers
│ ├─ PDS-4: Majority Quorum, Paxos & Replicated Log
│ │ └─ Consensus algorithms, Raft, Multi-Paxos
│ └─ PDS-5: High-Water Mark, Follower Reads & Singular Update Queue
│ └─ Committed entries, read scaling, ordered processing
│
├─ Phase 3: Conflict Resolution (Post 6)
│ └─ PDS-6: Versioned Value, Version Vector & Idempotent Receiver
│ └─ MVCC, concurrent update detection, exactly-once semantics
│
├─ Phase 4: Partitioning & Time (Posts 7-8)
│ ├─ PDS-7: Fixed Partitions, Key-Range Partitions & Two-Phase Commit
│ │ └─ Hash partitioning, range partitioning, distributed transactions
│ └─ PDS-8: Lamport Clock, Hybrid Clock & Clock-Bound Wait
│ └─ Logical clocks, hybrid timestamps, Google Spanner's TrueTime
│
├─ Phase 5: Coordination & Decentralization (Posts 9-10)
│ ├─ PDS-9: Consistent Core, Lease & State Watch
│ │ └─ Metadata management, distributed locks, change notifications
│ └─ PDS-10: Gossip Dissemination & Emergent Leader
│ └─ Epidemic protocols, SWIM, decentralized leadership
│
└─ Phase 6: Communication & Capstone (Posts 11-12)
├─ PDS-11: Single-Socket Channel, Request Batch, Pipeline & Waiting List
│ └─ Connection management, batching, pipelining, async responses
└─ PDS-12: Putting It All Together — Building Distributed Systems with Patterns
└─ Kafka, etcd, Cassandra, CockroachDB pattern maps, decision frameworkComplete Roadmap Structure
Post #1: Patterns of Distributed Systems Roadmap (Overview) ✅ You are here
- Why distributed systems are hard
- The pattern language approach
- Complete pattern catalog overview
- Learning paths and time estimates
- How real systems combine patterns
Phase 1: Durability Foundations
Post #2: Write-Ahead Log, Segmented Log & Low-Water Mark — Durability Foundations
Topics:
-
Write-Ahead Log (WAL):
- Persist every state change as a command to an append-only log before applying it
- Crash recovery by replaying the log from the last checkpoint
- WAL in PostgreSQL, MySQL InnoDB, and Kafka
-
Segmented Log:
- Splitting a single large log file into multiple smaller segments
- Segment rotation and cleanup policies
- How Kafka uses log segments for retention and performance
-
Low-Water Mark:
- Tracking which portion of the log can be safely discarded
- Snapshot-based vs time-based low-water marks
- Log compaction in Kafka
- Relationship between WAL → segments → low-water mark
-
How They Work Together:
- WAL provides durability, segments manage file sizes, low-water mark enables cleanup
- Practical examples from PostgreSQL, Kafka, and etcd
Learning Outcomes:
✅ Implement a basic write-ahead log for crash recovery
✅ Understand how Kafka manages billions of messages with segmented logs
✅ Configure log retention and compaction using low-water mark patterns
✅ Explain why every distributed system starts with a WAL
Estimated Time: 3-5 days
Phase 2: Leader Election & Consensus
Post #3: Leader and Followers, HeartBeat & Generation Clock — Leader Election
Topics:
-
Leader and Followers:
- Single server coordinates replication — why a single leader simplifies consistency
- Leader responsibilities: accepting writes, replicating to followers
- What triggers leader election (startup, leader failure, network partition)
-
HeartBeat:
- Periodic messages to detect server availability
- Heartbeat intervals and timeout configuration
- Trade-off: fast failure detection (short timeout) vs false positives (network hiccups)
- How ZooKeeper and etcd use heartbeats
-
Generation Clock:
- Monotonically increasing epoch/term numbers
- Preventing stale leaders (split-brain scenarios)
- Generation numbers in Raft (term), Paxos (ballot number), ZooKeeper (epoch)
- The flow: heartbeat timeout → increment generation → new leader election
Learning Outcomes:
✅ Design a leader-follower replication topology
✅ Configure heartbeat intervals for your availability requirements
✅ Explain how generation clocks prevent split-brain
✅ Trace a complete leader election flow from failure detection to new leader
Estimated Time: 4-6 days
Post #4: Majority Quorum, Paxos & Replicated Log — Consensus Protocols
Topics:
-
Majority Quorum:
- Requiring majority agreement to prevent split-brain
- Quorum math: 2f+1 nodes tolerate f failures (3 nodes tolerate 1, 5 nodes tolerate 2)
- Read quorums and write quorums — tuning consistency vs availability
-
Paxos:
- The foundational consensus algorithm
- Two phases: prepare/promise and accept/accepted
- Multi-Paxos for continuous consensus on a sequence of values
- Why Paxos is notoriously hard to implement correctly
-
Replicated Log:
- Keeping state synchronized using consensus on each log entry
- Raft as a more understandable alternative to Paxos
- Log replication in etcd (Raft) and ZooKeeper (ZAB)
- When you need strong consensus vs eventual consistency
Learning Outcomes:
✅ Calculate quorum sizes for different fault tolerance requirements
✅ Explain the Paxos algorithm's two phases and why they're necessary
✅ Compare Raft, Paxos, and ZAB consensus approaches
✅ Determine when strong consensus is worth the performance cost
Estimated Time: 5-7 days
Post #5: High-Water Mark, Follower Reads & Singular Update Queue — Replication Control
Topics:
-
High-Water Mark:
- Tracking the last log entry successfully replicated to a quorum
- Committed vs uncommitted entries — when is data "safe"?
- How clients know data is durable
- Kafka's high-water mark for consumer visibility
-
Follower Reads:
- Serving read requests from followers to scale read throughput
- Read-your-own-writes consistency guarantees
- Stale reads trade-off: read scaling vs consistency
- Linearizable reads via read index protocol
-
Singular Update Queue:
- Processing all state-changing requests through a single thread
- Maintaining ordering without locks
- Request waiting list for async responses
- How these patterns combine for consistent replication
Learning Outcomes:
✅ Explain why Kafka consumers only see messages below the high-water mark
✅ Design a system that scales reads using followers while maintaining consistency
✅ Implement ordered processing with singular update queue
✅ Choose between linearizable reads and eventually consistent reads
Estimated Time: 4-6 days
Phase 3: Conflict Resolution
Post #6: Versioned Value, Version Vector & Idempotent Receiver — Conflict Resolution
Topics:
-
Versioned Value:
- Storing every update with a new version number
- Reading historical values for audit and rollback
- MVCC in databases (PostgreSQL, CockroachDB)
- Optimistic concurrency control with version checks
-
Version Vector:
- Maintaining a vector of counters (one per node) to detect concurrent updates
- Detecting conflicts vs causal ordering
- Version vectors in Dynamo-style databases (Cassandra, Riak)
- Vector clocks vs version vectors — subtle but important differences
-
Idempotent Receiver:
- Assigning unique IDs to client requests to safely ignore duplicates
- Exactly-once semantics in message processing
- Idempotency keys in payment APIs (Stripe, PayPal)
- Deduplication in Kafka consumers
Learning Outcomes:
✅ Implement MVCC-style versioned values for concurrent access
✅ Use version vectors to detect conflicting updates in multi-leader systems
✅ Design idempotent APIs that safely handle duplicate requests
✅ Choose between conflict prevention (locking) and conflict detection (versioning)
Estimated Time: 4-6 days
Phase 4: Partitioning & Time
Post #7: Fixed Partitions, Key-Range Partitions & Two-Phase Commit — Data Partitioning
Topics:
-
Fixed Partitions:
- Keeping the number of partitions fixed so data-to-partition mapping stays stable
- Hash-based partition assignment and consistent hashing
- Partition rebalancing when nodes join or leave
- Kafka's fixed partition model
-
Key-Range Partitions:
- Partitioning data in sorted key ranges for efficient range queries
- Splitting and merging ranges dynamically
- Hot spots and mitigation strategies
- How HBase and CockroachDB use range partitions
-
Two-Phase Commit (2PC):
- Coordinating atomic updates across multiple partitions/nodes
- Prepare and commit phases — the coordinator's role
- Coordinator failure and the blocking problem
- Alternatives: Saga pattern, TCC (Try-Confirm-Cancel)
Learning Outcomes:
✅ Choose between hash and range partitioning for your data access patterns
✅ Design partition rebalancing strategies that minimize data movement
✅ Explain the 2PC blocking problem and its practical implications
✅ Compare 2PC with Saga pattern for distributed transactions
Estimated Time: 5-7 days
Post #8: Lamport Clock, Hybrid Clock & Clock-Bound Wait — Distributed Time
Topics:
-
Why Wall Clocks Can't Be Trusted:
- Clock skew, NTP drift, leap seconds
- Two events on different machines with conflicting timestamps
- The "which happened first?" problem
-
Lamport Clock:
- Logical timestamps that capture causal ordering (happens-before relation)
- Incrementing on send/receive
- Limitations: can't detect concurrent events
-
Hybrid Clock:
- Combining physical timestamps with logical counters
- Versions that are both ordered and human-readable
- HLC in CockroachDB and YugabyteDB
-
Clock-Bound Wait:
- Waiting to cover uncertainty in time across cluster nodes
- Google Spanner's TrueTime API — trading latency for consistency
- Commit-wait and start-wait strategies
- Why Spanner can offer external consistency across data centers
Learning Outcomes:
✅ Explain why wall clocks are insufficient for ordering events in distributed systems
✅ Implement Lamport clocks for causal ordering
✅ Understand how CockroachDB uses hybrid clocks for versioning
✅ Describe how Google Spanner achieves global consistency with TrueTime
Estimated Time: 5-7 days
Phase 5: Coordination & Decentralization
Post #9: Consistent Core, Lease & State Watch — Cluster Coordination
Topics:
-
Consistent Core:
- Maintaining a smaller cluster (3-5 nodes) with strong consistency to coordinate a larger data cluster
- Metadata management and configuration storage
- ZooKeeper and etcd as consistent cores
- When to use a separate coordination service vs embed consensus
-
Lease:
- Time-bound tokens for coordinating activities
- Leader leases to prevent split-brain
- Distributed locks with automatic expiry
- The Redlock debate — can Redis provide distributed locks?
-
State Watch:
- Notifying clients when specific values change on the server
- Watch mechanism in etcd and ZooKeeper
- Avoiding polling with push notifications
- Handling watch events reliably (revision-based watches)
Learning Outcomes:
✅ Design a system using a consistent core for metadata coordination
✅ Implement distributed locks with lease-based expiry
✅ Build reactive systems using state watch for configuration changes
✅ Evaluate whether Redis, etcd, or ZooKeeper fits your coordination needs
Estimated Time: 4-6 days
Post #10: Gossip Dissemination & Emergent Leader — Decentralized Management
Topics:
-
Gossip Dissemination:
- Using random selection of nodes to pass on information
- Epidemic/gossip protocols and convergence guarantees
- SWIM membership protocol for failure detection
- Gossip in Cassandra and Consul
-
Emergent Leader:
- Ordering cluster nodes by age/criteria for automatic leader selection
- Seniority-based leadership without explicit election
- Comparing to explicit leader election (Raft/Paxos)
- Use cases where decentralized approaches outperform centralized consensus
-
When to Use Gossip vs Consensus:
- Strong consistency (consensus) vs convergent state (gossip)
- AP vs CP systems in practice
- Hybrid approaches: consensus for metadata, gossip for data
Learning Outcomes:
✅ Implement gossip-based failure detection and membership management
✅ Design systems that converge without centralized coordination
✅ Choose between gossip and consensus based on consistency requirements
✅ Explain how Cassandra combines gossip with tunable consistency
Estimated Time: 4-5 days
Phase 6: Communication & Capstone
Post #11: Single-Socket Channel, Request Batch, Request Pipeline & Request Waiting List — Communication Patterns
Topics:
-
Single-Socket Channel:
- Maintaining request order by using a single TCP connection per node pair
- Avoiding out-of-order delivery
- Connection management and reconnection strategies
-
Request Batch:
- Combining multiple requests to optimize network utilization
- Batch size trade-offs: latency vs throughput
- Batching in Kafka producer and database drivers
-
Request Pipeline:
- Sending multiple requests without waiting for responses
- Pipelining in HTTP/2, gRPC streaming, and database protocols
- Pipeline depth and flow control
-
Request Waiting List:
- Tracking client requests that need deferred responses
- Correlating requests with async completions
- Callback patterns in distributed protocols
Learning Outcomes:
✅ Design high-throughput inter-node communication using batching and pipelining
✅ Configure Kafka producer batching for optimal throughput vs latency
✅ Implement async request tracking with waiting lists
✅ Understand how these patterns combine for efficient cluster communication
Estimated Time: 3-5 days
Post #12: Putting It All Together — Building Distributed Systems with Patterns
Topics:
-
How Real Systems Combine Patterns:
- Kafka: WAL + segmented log + leader/followers + high-water mark + fixed partitions
- etcd: WAL + Raft + consistent core + state watch + lease
- Cassandra: Gossip + version vector + key-range partitions + emergent leader
- CockroachDB: Raft + hybrid clock + key-range partitions + 2PC
-
Pattern Selection Decision Framework:
- Choosing between CP and AP
- When you need consensus vs eventual consistency
- Single-leader vs multi-leader vs leaderless replication
- Hash partitioning vs range partitioning
-
Common Anti-Patterns:
- Distributed monolith — the worst of both worlds
- Premature distributed systems — adding complexity before you need it
- Ignoring partial failures — treating remote calls like local calls
- Two generals' problem violations — assuming messages always arrive
-
Building a Simple Distributed Key-Value Store:
- Combining patterns from this series into a working system
- WAL for durability, Raft for consensus, hash partitioning for scaling
Learning Outcomes:
✅ Map patterns to real systems (Kafka, etcd, Cassandra, CockroachDB)
✅ Apply a systematic framework for choosing distributed system patterns
✅ Identify and avoid common anti-patterns in distributed system design
✅ Design a distributed key-value store from first principles using patterns
Estimated Time: 5-7 days
How Real Systems Use These Patterns
Understanding which patterns real systems use helps you see how everything connects:
| System | Durability | Leadership | Consensus | Replication | Partitioning | Time | Coordination |
|---|---|---|---|---|---|---|---|
| Kafka | WAL, Segmented Log, Low-Water Mark | Leader/Followers | ISR (quorum-like) | High-Water Mark | Fixed Partitions | — | ZooKeeper/KRaft |
| etcd | WAL | Leader/Followers, HeartBeat | Raft (Replicated Log) | High-Water Mark | — | — | Consistent Core, Lease, State Watch |
| ZooKeeper | WAL | Leader/Followers, HeartBeat | ZAB | High-Water Mark | — | — | Consistent Core, Lease, State Watch |
| Cassandra | WAL | Emergent Leader | — (AP system) | — | Key-Range Partitions | — | Gossip Dissemination |
| CockroachDB | WAL | Leader/Followers | Raft | High-Water Mark | Key-Range Partitions | Hybrid Clock | — |
| Google Spanner | WAL | Leader/Followers | Paxos | High-Water Mark | Key-Range Partitions | Clock-Bound Wait (TrueTime) | — |
Learning Paths by Goal
Path 1: Backend Engineer (6-8 weeks)
Goal: Understand the patterns behind the infrastructure you use daily
Recommended Sequence:
- Post #1: Roadmap Overview
- Post #2: Durability Foundations (WAL, Segmented Log)
- Post #3: Leader Election (Leader/Followers, HeartBeat)
- Post #5: Replication Control (High-Water Mark, Follower Reads)
- Post #7: Data Partitioning
- Post #12: Putting It All Together
Outcome: Understand how Kafka, databases, and coordination services work under the hood
Path 2: Distributed Systems Engineer (10-14 weeks)
Goal: Comprehensive knowledge of all distributed systems patterns
Recommended Sequence:
- Posts #1-6: All Durability, Election, Consensus, Replication, and Conflict Resolution (6 weeks)
- Posts #7-8: Partitioning and Distributed Time (2 weeks)
- Posts #9-10: Coordination and Decentralization (2 weeks)
- Posts #11-12: Communication and Capstone (2 weeks)
Outcome: Ready to design and evaluate distributed systems with proper pattern selection
Path 3: SRE / DevOps Engineer (5-7 weeks)
Goal: Understand failure modes and recovery patterns for the systems you operate
Recommended Sequence:
- Post #2: Durability Foundations (crash recovery, log management)
- Post #3: Leader Election (failure detection, heartbeats)
- Post #5: Replication Control (what "committed" means)
- Post #9: Cluster Coordination (leases, watches)
- Post #10: Gossip and Decentralized Management
Outcome: Debug production incidents, tune heartbeat timeouts, understand failover behavior
Path 4: Interview Preparation (4-6 weeks)
Goal: System design interview readiness
Recommended Sequence:
- Post #3: Leader Election (common interview topic)
- Post #4: Consensus Protocols (Raft, Paxos)
- Post #6: Conflict Resolution (version vectors, idempotency)
- Post #7: Data Partitioning (hash vs range, 2PC vs Saga)
- Post #12: Putting It All Together (decision framework)
Focus Areas:
- CAP theorem trade-offs and practical implications
- Consensus: when to use Raft vs Paxos, quorum math
- Partitioning: hash vs range, rebalancing strategies
- Consistency models: linearizable, sequential, eventual
- Pattern combinations for specific system designs
Estimated Total Time
| Learning Style | Phase 1-2 (Posts 2-5) | Phase 3-4 (Posts 6-8) | Phase 5-6 (Posts 9-12) | Total Time |
|---|---|---|---|---|
| Fast Track | 2-3 weeks | 2-3 weeks | 2-3 weeks | 6-9 weeks |
| Standard | 3-4 weeks | 3-4 weeks | 3-4 weeks | 9-12 weeks |
| Thorough | 4-6 weeks | 4-6 weeks | 4-5 weeks | 12-17 weeks |
Note: Time estimates assume 8-12 hours per week of study and practice.
The Complete Pattern Catalog
Durability Patterns
| Pattern | Description | Used In |
|---|---|---|
| Write-Ahead Log | Append every state change to a log before applying | PostgreSQL, Kafka, etcd |
| Segmented Log | Split log into segments for manageable file sizes | Kafka, etcd |
| Low-Water Mark | Track which log entries can be safely discarded | Kafka (log compaction), ZooKeeper |
Leader Election Patterns
| Pattern | Description | Used In |
|---|---|---|
| Leader and Followers | Single leader accepts writes, followers replicate | Kafka, MySQL replication, etcd |
| HeartBeat | Periodic messages to detect server availability | ZooKeeper, etcd, Raft |
| Generation Clock | Monotonic epoch numbers to prevent stale leaders | Raft (term), Paxos (ballot), ZooKeeper (epoch) |
Consensus Patterns
| Pattern | Description | Used In |
|---|---|---|
| Majority Quorum | Require majority agreement for decisions | Raft, Paxos, ZAB |
| Paxos | Foundational two-phase consensus algorithm | Google Chubby, Spanner |
| Replicated Log | Synchronize state via consensus on log entries | etcd (Raft), ZooKeeper (ZAB) |
Replication Control Patterns
| Pattern | Description | Used In |
|---|---|---|
| High-Water Mark | Track last entry replicated to a quorum | Kafka, Raft |
| Follower Reads | Serve reads from followers to scale throughput | CockroachDB, etcd, Kafka consumers |
| Singular Update Queue | Single-threaded processing for ordered updates | etcd, ZooKeeper |
Conflict Resolution Patterns
| Pattern | Description | Used In |
|---|---|---|
| Versioned Value | Store updates with version numbers (MVCC) | PostgreSQL, CockroachDB |
| Version Vector | Detect concurrent updates across nodes | Cassandra, Riak, DynamoDB |
| Idempotent Receiver | Ignore duplicate requests via unique IDs | Kafka consumers, payment APIs |
Partitioning Patterns
| Pattern | Description | Used In |
|---|---|---|
| Fixed Partitions | Stable partition count with hash-based assignment | Kafka, Redis Cluster |
| Key-Range Partitions | Sorted key ranges for efficient range queries | HBase, CockroachDB, Spanner |
| Two-Phase Commit | Atomic updates across partitions | Distributed databases, XA transactions |
Distributed Time Patterns
| Pattern | Description | Used In |
|---|---|---|
| Lamport Clock | Logical timestamps for causal ordering | Many distributed algorithms |
| Hybrid Clock | Physical + logical counters for ordered, readable versions | CockroachDB, YugabyteDB |
| Clock-Bound Wait | Wait to cover time uncertainty before read/write | Google Spanner (TrueTime) |
Cluster Coordination Patterns
| Pattern | Description | Used In |
|---|---|---|
| Consistent Core | Small strongly-consistent cluster coordinates larger cluster | ZooKeeper, etcd |
| Lease | Time-bound tokens for coordination and distributed locks | etcd, ZooKeeper, Redis |
| State Watch | Push notifications when values change | etcd, ZooKeeper |
Decentralized Patterns
| Pattern | Description | Used In |
|---|---|---|
| Gossip Dissemination | Random node-to-node information spreading | Cassandra, Consul, SWIM |
| Emergent Leader | Automatic leader selection by node ordering | Cassandra |
Communication Patterns
| Pattern | Description | Used In |
|---|---|---|
| Single-Socket Channel | One TCP connection per node pair for ordering | Kafka inter-broker, etcd |
| Request Batch | Combine requests for network efficiency | Kafka producer, database drivers |
| Request Pipeline | Send without waiting for responses | HTTP/2, gRPC streaming |
| Request Waiting List | Track deferred async responses | Distributed protocol implementations |
How This Series Connects to Other Roadmaps
- Software Architecture Patterns — System-level patterns that distributed systems implement
- Enterprise Application Architecture — Implementation patterns inside each node
- Microservices Architecture — Distributed services that use these patterns
- Event-Driven Architecture — Event-based systems built on WAL and replication patterns
- SQL & NoSQL Roadmap — Database internals that use these patterns
- Networking for Web Developers — Network foundations for distributed communication
Common Pitfalls to Avoid
Conceptual Pitfalls:
❌ Treating CAP as binary — real systems operate on a consistency spectrum, not a checkbox
❌ Assuming network is reliable — messages get lost, delayed, duplicated, and reordered
❌ Treating remote calls like local calls — latency, partial failures, and timeouts change everything
❌ "We need strong consistency everywhere" — most data doesn't need linearizability
Design Pitfalls:
❌ Premature distribution — adding distributed complexity before a single node is insufficient
❌ Distributed monolith — tightly coupled services that must be deployed together
❌ Ignoring partial failures — assuming operations either fully succeed or fully fail
❌ No idempotency — retrying requests without deduplication creates duplicate effects
Operational Pitfalls:
❌ Wrong heartbeat timeout — too short causes false failovers, too long delays real recovery
❌ Cluster of two nodes — no majority possible if one fails, so no consensus
❌ Mixing CP and AP assumptions — using Cassandra (AP) where you need strict consistency
❌ Ignoring clock skew — using wall-clock timestamps as version numbers across machines
Mindset Pitfalls:
❌ "We'll add consistency later" — retrofitting consensus is extremely hard
❌ "Kubernetes handles distributed systems for us" — K8s manages containers, not data consistency
❌ "Eventually consistent means sometimes consistent" — eventual consistency has precise guarantees
❌ "I'll implement my own Paxos" — use an existing library; getting consensus right takes years
Tips for Success
1. Map Patterns to Systems You Already Use
- If you use Kafka, you're already depending on WAL, segmented log, leader/followers, and high-water mark
- If you use etcd or ZooKeeper, you're depending on Raft/ZAB, consistent core, lease, and state watch
- If you use PostgreSQL replication, you're depending on WAL, leader/followers, and streaming replication
- Name the patterns first, then deepen your understanding
2. Start with Durability, Then Build Up
- Every distributed system starts with a WAL — understand this foundation first
- Leader election builds on durability (you need to replicate the log)
- Consensus builds on leader election (you need agreement on the leader's log)
- Each layer adds capabilities that the next layer depends on
3. Study One Real System Deeply
- Pick one system (Kafka, etcd, or CockroachDB) and trace how patterns compose
- Read the design docs and source code — patterns become concrete
- Understanding one system well transfers to understanding others
4. Build a Toy Implementation
- Implement a simple Raft node in your language of choice
- Build a basic partitioned key-value store with WAL
- The patterns only click when you've fought the edge cases yourself
5. Think in Trade-offs, Not Best Practices
- Every pattern trades something: consistency for availability, latency for durability, complexity for correctness
- "It depends" is the right answer — the skill is knowing what it depends on
- The capstone post provides a decision framework for these trade-offs
After Completing This Roadmap
You Will Be Able To:
✅ Explain how Kafka, etcd, ZooKeeper, Cassandra, and CockroachDB work internally
✅ Design distributed systems with proper replication, partitioning, and consensus strategies
✅ Debug production incidents by understanding leader election, heartbeats, and failover behavior
✅ Choose between CP and AP approaches based on actual requirements
✅ Evaluate distributed databases and coordination services by the patterns they implement
✅ Ace system design interviews with deep knowledge of distributed systems patterns
✅ Avoid common anti-patterns like distributed monoliths and premature distribution
✅ Combine patterns into cohesive system designs using a principled decision framework
Next Steps:
- Apply patterns at work — Identify which patterns your infrastructure uses and deepen your understanding
- Read Unmesh Joshi's book — Patterns of Distributed Systems has implementation details this series summarizes
- Study Martin Kleppmann's DDIA — Designing Data-Intensive Applications provides complementary depth
- Contribute to distributed systems — Use your pattern vocabulary to contribute to open-source projects like etcd, Kafka, or CockroachDB
- Explore the Software Architecture Patterns — Connect distributed patterns to system-level architecture
Ready to Start?
This roadmap provides everything you need to master the patterns that power distributed systems. The journey from understanding write-ahead logs to confidently designing distributed systems takes 2-4 months of consistent effort.
Start with Post #2: Write-Ahead Log, Segmented Log & Low-Water Mark and begin understanding the durability foundation that every distributed system is built on!
Summary and Key Takeaways
✅ Distributed systems are hard because of network partitions, partial failures, and clock skew
✅ This roadmap covers 12 comprehensive posts organized into 6 phases with 30+ patterns
✅ Based on Unmesh Joshi's Patterns of Distributed Systems — the patterns found in Kafka, etcd, ZooKeeper, Cassandra, and CockroachDB
✅ Patterns compose — Kafka = WAL + segmented log + leader/followers + high-water mark + fixed partitions
✅ Four learning paths tailored to different goals (Backend Engineer, Distributed Systems Engineer, SRE, Interview Prep)
✅ The key decisions: CP vs AP, consensus vs gossip, hash vs range partitioning, strong vs eventual consistency
✅ Estimated time: 6-17 weeks depending on pace and depth
✅ By the end, you'll understand not just what distributed systems do, but why they do it
Related Series
This Patterns of Distributed Systems roadmap complements other learning paths:
- Software Architecture Patterns Roadmap — System-level patterns that distributed systems implement
- Enterprise Application Architecture Roadmap — Implementation patterns inside each service/node
- Microservices Architecture Guide — Distributed services using these patterns in practice
- Event-Driven Architecture Guide — Event-based systems built on replication and log patterns
- SQL & NoSQL Roadmap — Database foundations for distributed data patterns
Understand the patterns, master the systems, build with confidence!
Happy building! 🏗️
Have questions about this roadmap or distributed systems patterns? Feel free to reach out!
📬 Subscribe to Newsletter
Get the latest blog posts delivered to your inbox every week. No spam, unsubscribe anytime.
We respect your privacy. Unsubscribe at any time.
💬 Comments
Sign in to leave a comment
We'll never post without your permission.