Back to blog

Patterns of Distributed Systems: Complete Roadmap

distributed-systemssystem-designsoftware-architecturebackenddesign-patternsroadmap
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:

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:

PropertyDescriptionExample
Consistency (C)Every read receives the most recent writeetcd, ZooKeeper, CockroachDB
Availability (A)Every request receives a response (no errors)Cassandra, DynamoDB, Riak
Partition Tolerance (P)System continues operating despite network partitionsAll 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:

  1. Solves a specific problem — e.g., "How do we detect that a leader has failed?"
  2. Has a name — e.g., "HeartBeat"
  3. 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 framework

Complete 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:

SystemDurabilityLeadershipConsensusReplicationPartitioningTimeCoordination
KafkaWAL, Segmented Log, Low-Water MarkLeader/FollowersISR (quorum-like)High-Water MarkFixed PartitionsZooKeeper/KRaft
etcdWALLeader/Followers, HeartBeatRaft (Replicated Log)High-Water MarkConsistent Core, Lease, State Watch
ZooKeeperWALLeader/Followers, HeartBeatZABHigh-Water MarkConsistent Core, Lease, State Watch
CassandraWALEmergent Leader— (AP system)Key-Range PartitionsGossip Dissemination
CockroachDBWALLeader/FollowersRaftHigh-Water MarkKey-Range PartitionsHybrid Clock
Google SpannerWALLeader/FollowersPaxosHigh-Water MarkKey-Range PartitionsClock-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:

  1. Post #1: Roadmap Overview
  2. Post #2: Durability Foundations (WAL, Segmented Log)
  3. Post #3: Leader Election (Leader/Followers, HeartBeat)
  4. Post #5: Replication Control (High-Water Mark, Follower Reads)
  5. Post #7: Data Partitioning
  6. 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:

  1. Posts #1-6: All Durability, Election, Consensus, Replication, and Conflict Resolution (6 weeks)
  2. Posts #7-8: Partitioning and Distributed Time (2 weeks)
  3. Posts #9-10: Coordination and Decentralization (2 weeks)
  4. 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:

  1. Post #2: Durability Foundations (crash recovery, log management)
  2. Post #3: Leader Election (failure detection, heartbeats)
  3. Post #5: Replication Control (what "committed" means)
  4. Post #9: Cluster Coordination (leases, watches)
  5. 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:

  1. Post #3: Leader Election (common interview topic)
  2. Post #4: Consensus Protocols (Raft, Paxos)
  3. Post #6: Conflict Resolution (version vectors, idempotency)
  4. Post #7: Data Partitioning (hash vs range, 2PC vs Saga)
  5. 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 StylePhase 1-2 (Posts 2-5)Phase 3-4 (Posts 6-8)Phase 5-6 (Posts 9-12)Total Time
Fast Track2-3 weeks2-3 weeks2-3 weeks6-9 weeks
Standard3-4 weeks3-4 weeks3-4 weeks9-12 weeks
Thorough4-6 weeks4-6 weeks4-5 weeks12-17 weeks

Note: Time estimates assume 8-12 hours per week of study and practice.


The Complete Pattern Catalog

Durability Patterns

PatternDescriptionUsed In
Write-Ahead LogAppend every state change to a log before applyingPostgreSQL, Kafka, etcd
Segmented LogSplit log into segments for manageable file sizesKafka, etcd
Low-Water MarkTrack which log entries can be safely discardedKafka (log compaction), ZooKeeper

Leader Election Patterns

PatternDescriptionUsed In
Leader and FollowersSingle leader accepts writes, followers replicateKafka, MySQL replication, etcd
HeartBeatPeriodic messages to detect server availabilityZooKeeper, etcd, Raft
Generation ClockMonotonic epoch numbers to prevent stale leadersRaft (term), Paxos (ballot), ZooKeeper (epoch)

Consensus Patterns

PatternDescriptionUsed In
Majority QuorumRequire majority agreement for decisionsRaft, Paxos, ZAB
PaxosFoundational two-phase consensus algorithmGoogle Chubby, Spanner
Replicated LogSynchronize state via consensus on log entriesetcd (Raft), ZooKeeper (ZAB)

Replication Control Patterns

PatternDescriptionUsed In
High-Water MarkTrack last entry replicated to a quorumKafka, Raft
Follower ReadsServe reads from followers to scale throughputCockroachDB, etcd, Kafka consumers
Singular Update QueueSingle-threaded processing for ordered updatesetcd, ZooKeeper

Conflict Resolution Patterns

PatternDescriptionUsed In
Versioned ValueStore updates with version numbers (MVCC)PostgreSQL, CockroachDB
Version VectorDetect concurrent updates across nodesCassandra, Riak, DynamoDB
Idempotent ReceiverIgnore duplicate requests via unique IDsKafka consumers, payment APIs

Partitioning Patterns

PatternDescriptionUsed In
Fixed PartitionsStable partition count with hash-based assignmentKafka, Redis Cluster
Key-Range PartitionsSorted key ranges for efficient range queriesHBase, CockroachDB, Spanner
Two-Phase CommitAtomic updates across partitionsDistributed databases, XA transactions

Distributed Time Patterns

PatternDescriptionUsed In
Lamport ClockLogical timestamps for causal orderingMany distributed algorithms
Hybrid ClockPhysical + logical counters for ordered, readable versionsCockroachDB, YugabyteDB
Clock-Bound WaitWait to cover time uncertainty before read/writeGoogle Spanner (TrueTime)

Cluster Coordination Patterns

PatternDescriptionUsed In
Consistent CoreSmall strongly-consistent cluster coordinates larger clusterZooKeeper, etcd
LeaseTime-bound tokens for coordination and distributed locksetcd, ZooKeeper, Redis
State WatchPush notifications when values changeetcd, ZooKeeper

Decentralized Patterns

PatternDescriptionUsed In
Gossip DisseminationRandom node-to-node information spreadingCassandra, Consul, SWIM
Emergent LeaderAutomatic leader selection by node orderingCassandra

Communication Patterns

PatternDescriptionUsed In
Single-Socket ChannelOne TCP connection per node pair for orderingKafka inter-broker, etcd
Request BatchCombine requests for network efficiencyKafka producer, database drivers
Request PipelineSend without waiting for responsesHTTP/2, gRPC streaming
Request Waiting ListTrack deferred async responsesDistributed protocol implementations

How This Series Connects to Other Roadmaps


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:

  1. Apply patterns at work — Identify which patterns your infrastructure uses and deepen your understanding
  2. Read Unmesh Joshi's bookPatterns of Distributed Systems has implementation details this series summarizes
  3. Study Martin Kleppmann's DDIADesigning Data-Intensive Applications provides complementary depth
  4. Contribute to distributed systems — Use your pattern vocabulary to contribute to open-source projects like etcd, Kafka, or CockroachDB
  5. 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


This Patterns of Distributed Systems roadmap complements other learning paths:


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.