Problem
Distributed nodes must decide on one value despite crashes, message loss and competing proposers. Without a safe protocol, two groups can decide different values. Practical systems also need to agree on a sequence of values, not just one.
Also known as: paxos, multi-paxos
Reach agreement on a single value among unreliable nodes using proposers, acceptors and quorums.
Distributed nodes must decide on one value despite crashes, message loss and competing proposers. Without a safe protocol, two groups can decide different values. Practical systems also need to agree on a sequence of values, not just one.
Paxos is the original family of consensus protocols. Basic Paxos decides one value; Multi-Paxos chains many decisions into a replicated log. Most modern consensus systems are Paxos relatives, and Raft was designed as a more approachable alternative.
Three roles exist, often colocated on each node: proposers, acceptors and learners. Each proposal has a unique, increasing number n.
Phase 1 Proposer -> Acceptors: prepare(n)
Acceptor: if n > promised then promised=n,
reply promise(acceptedN, acceptedV)
Phase 2 Proposer -> Acceptors: accept(n, v)
v = value with highest acceptedN seen, else own value
Acceptor: if n >= promised then accept
Chosen when a majority accepted the same (n, v)
The key safety rule is that a proposer must adopt any value a majority might already have accepted. Two majorities always overlap in at least one acceptor, so that acceptor carries the earlier decision forward. Multi-Paxos lets a distinguished leader run phase 1 once and then issue only phase 2 messages for each log slot.
3 or 5 acceptor replicas
High: custom implementations and tooling
High: subtle invariants and variants
Dueling proposers livelock without a stable leader
Acceptor state not persisted before reply breaks safety
Incorrect quorum configuration lets two values be chosen