A map of distributed-system patterns

Thirty recurring building blocks (logs, quorums, leases, clocks, partitions, heartbeats and more) grouped by the problem each solves, so you can name them in a design.

On the roadmap:Advanced · step 4: Distributed systems

Lesson 9 of 10 · 15 min read · quiz · exercise

Why a pattern map

Real distributed systems (Kafka, etcd, Cassandra, Kubernetes and others) are assembled from a small set of recurring solutions. Knowing their names lets you read documentation faster, discuss designs precisely and spot what a design is missing. This lesson groups thirty well-known patterns by the problem they solve. Each is explained in a sentence or two; the catalogue linked below gives full treatment. Many have their own lessons on this site (consensus, storage engines, Kafka, Redis).

Figure SDA-ADS-09-1 · Problems and the pattern families that solve them · © forcsguy.com

1. Durability and ordering

  • Write-ahead log: record every change durably before applying it, so a crash can be recovered by replaying (see the storage engines lesson).
  • Segmented log: split the log into segment files so old data can be deleted or compacted cheaply and lookups stay fast (Kafka does this).
  • Low-water mark: the oldest log position still needed; everything before it can be discarded.
  • High-water mark: the newest position known to be safely replicated; readers must not go beyond it.
  • Replicated log: a log kept identical on several nodes, usually driven by a leader; the basis of consensus-backed systems.

2. Replication and agreement

  • Leader and followers: one node orders writes; others copy and can serve reads.
  • Majority quorum: act only when more than half of the nodes agree, so any two decisions overlap.
  • Paxos: a protocol that makes a majority agree on a value despite failures (see the consensus lesson; Raft is its more understandable cousin).
  • Consistent core: a small strongly consistent cluster (the "core") makes decisions for a much larger, weakly coupled cluster, such as metadata and leadership.
  • Two-phase commit: a coordinator asks all participants to prepare, then to commit; gives atomicity across nodes but blocks if the coordinator fails, so use sparingly.
  • Follower reads: allow reads from followers to spread load, accepting some staleness (or bounding it).
  • Emergent leader: nodes agree on a leader from membership data (for example the oldest member) without a separate vote.

3. Failure handling and authority

  • Heartbeat: periodic "I am alive" messages; absence signals failure.
  • Gossip dissemination: nodes pass information to random peers, so news (membership, failure) spreads exponentially without a central point (used by Cassandra and Dynamo-style stores).
  • Lease: a time-bound right (to be leader or hold a lock) that expires automatically unless renewed.
  • Generation clock (also called epoch or term): a number increased at each leadership change and sent with requests; receivers ignore lower numbers, stopping a stale leader.
  • Idempotent receiver: handle repeated requests safely by remembering what was already processed.
  • State watch: clients subscribe to changes of a key or range and are notified, instead of polling (etcd and ZooKeeper watches).

4. Time and versions

  • Lamport clock: a logical counter that orders events consistently with causality without synchronised wall clocks.
  • Version vector: per-node counters that detect whether two copies are ordered or concurrent (conflict); see the clocks lesson.
  • Hybrid clock: combines physical time with a logical counter so timestamps are close to real time yet still ordered.
  • Clock-bound wait: wait out the clock uncertainty before committing, so timestamps reflect real order (used by globally consistent databases with bounded-error clocks).
  • Versioned value: store each update as a new version so reads can be consistent snapshots and conflicts can be detected.

5. Partitioning

  • Fixed partitions: split data into a fixed number of partitions up front and move whole partitions between nodes when scaling (like Redis hash slots or Kafka partitions).
  • Key-range partitions: split by sorted ranges of keys, good for range scans; ranges split as they grow (like Bigtable and HBase), at the risk of hot ranges.

6. Performance and concurrency

  • Request batch: group several requests into one network call or one disk write to amortise cost.
  • Request pipeline: send further requests without waiting for earlier responses, keeping the link busy.
  • Request waiting list: park a request until the cluster has replied or an event happens, then answer the client.
  • Singular update queue: funnel all updates through one thread and queue to avoid locks and keep order (the idea behind single-threaded cores in Redis and exchanges).
  • Single-socket channel: one connection per peer, with ordered messages, to preserve order and reduce overhead.

Seeing the patterns in a system

SystemPatterns visible
KafkaSegmented log, replicated log, leader and followers, high-water mark, fixed partitions, request batch, heartbeats
etcd or ZooKeeperReplicated log with majority quorum, leader election, state watch, leases, generation clock
CassandraGossip, fixed or token partitions, version-based conflict resolution, write-ahead log, tunable quorum reads
A global SQL databaseConsensus per partition, key-range partitions, hybrid or bounded clocks, two-phase commit across partitions
Redis ClusterFixed partitions (16,384 slots), leader and followers, gossip, singular update queue

How to use this in an interview

When you propose "a leader", immediately address: how it is elected, how a stale leader is fenced (generation clock or lease), how failure is detected (heartbeat) and how followers catch up (replicated log, high-water mark). Naming these shows you know what a one-word box hides.

Real-world reading

Check your understanding

Question 1 of 3

0 correct so far

Which pattern stops a stale leader from acting after a new one is elected?

Go deeper

Topics covered in this lesson

All topics

© 2026 forcsguy.com. Original lesson text and diagrams. Books and sites linked above belong to their authors.