How a cluster of unreliable machines agrees on a single ordering of events.
It is that messages arrive late, machines fall silent, and the network can split in two. A split brain leaves each side convinced that the other is gone.
Any two majorities must overlap in at least one machine.
Three roles, and agreement in two round trips.
Picks a ballot number and drives a value toward a decision.
Five of them. Each remembers the highest ballot it has promised, and the value it last accepted.
Learns the chosen value once a majority has accepted it.
Google's Chubby team described the result plainly: the protocol has a poor reputation for being difficult to understand, and the gap between paper and running system is where the bugs live.
Designed for understandability, by decomposing consensus into three separate problems.
A follower that hears nothing starts an election, after a randomized timeout that breaks ties.
Votes from a majority make a candidate leader. The randomization makes split votes rare.
| index | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| leader | x = 1term 1 | y = 7term 1 | z = 4term 2 | w = 2term 3 | v = 9term 3 |
| follower A | x = 1term 1 | y = 7term 1 | z = 4term 2 | w = 2term 3 | — |
| follower B | x = 1term 1 | y = 7term 1 | z = 4term 2 | w = 2term 3 | pending |
Committed through index 4: a majority has stored it. Index 5 exists only on the leader, so it is not yet committed.
A stale leader can still send appends — but its entries cannot reach a majority, so it cannot commit.
| PAXOS | RAFT | |
|---|---|---|
| Understandability | Compact proof, subtle to implement | Decomposed into three sub-problems |
| Leader | Optional — needed only for liveness | Required — exactly one per term |
| Log | Multi-Paxos, gaps, unspecified | Log matching, no gaps, indexed |
| Membership change | Left to the implementer | Joint consensus, one server at a time |
| Running in production | Chubby, Spanner | etcd, Consul, CockroachDB, TiKV, Kafka KRaft |