Skip to main content

Consensus

Paxos, Raft, leader election, membership changes, and production coordination services.

Figure: Raft leader election and replication states.

What You'll Learn​

Consensus is how distributed systems agree on a single ordered log despite failures. You will understand the consensus problem, why FLP makes pure async consensus impossible, how Raft and Paxos work, and how etcd, ZooKeeper, and Consul apply these ideas in production.

Chapters​

Core Theory​

ChapterFocus
The Consensus ProblemAgreement, validity, termination
FLP ImpossibilityWhy consensus requires failure detectors or timing
PaxosSingle-decree and multi-decree Paxos
Multi-PaxosLog-based Paxos, leader optimization
Raft ConsensusLeader election, log replication, safety
Viewstamped ReplicationAlternative formulation of replicated state machines

Operations and Production​

ChapterFocus
Leader ElectionBully, ring, Raft election details
Membership ChangesJoint consensus, safe reconfiguration
Distributed LeasesTime-bounded locks with TTL
Fencing TokensPreventing stale primary writes
ZooKeeper Atomic Broadcast (Zab)ZooKeeper's consensus protocol

Production Systems​

ChapterFocus
Apache ZooKeeperCoordination service, znodes, watches
etcdKubernetes control plane, Raft-backed KV
HashiCorp ConsulService mesh coordination, Raft

Learning Path​

  1. Consensus Problem and FLP — know the limits before the algorithms.
  2. Raft — whiteboard this for interviews; then read Paxos for historical depth.
  3. Leader Election, Membership Changes, Fencing Tokens — production concerns.
  4. Study etcd or ZooKeeper as a concrete system you have likely operated.

Interview Prep​

ResourceTopic
Google SpannerPaxos groups, TrueTime
Lab 003 RaftRaft simulation on :8098 — engineer guide
Lab 004 KVQuorum replication on :8095 — engineer guide
Lab 007 locksDistributed locks on :8100 — engineer guide

Prerequisites​

Production readiness + Game Day​

Every substantive chapter in this domain targets the Production LLD and Game Day Standard: whiteboard Production LLD (APIs, data, failure paths) and run Game Day drills (inject → detect → mitigate → verify → learn).

Start hereWhat you practice
Chapter §22A / §22B (where present)Ship-ready LLD + drill catalog
Chapter §23 PRACTICEFull interview script
Curriculum Overview — Phase 7Rollout status

Next Domain​

Continue to Replication and Transactions.

Return to the Curriculum Overview for the full learning path.