Why it matters

You don't need to implement Paxos yourself, but understanding it helps you reason about consensus in general. It also explains why Raft is so popular — anything is more understandable than Paxos.

Advertisement

The architecture

Roles: Proposers (propose values), Acceptors (vote on proposals), Learners (learn the chosen value). Each node may play multiple roles.

Two-phase protocol: Phase 1 (prepare) — proposer picks a proposal number, sends prepare to acceptors, acceptors promise not to accept lower numbers. Phase 2 (accept) — proposer sends accept with the value; acceptors accept if they haven't promised a higher number.

Paxos two-phase protocolPrepare phasepropose number, promiseAccept phaseaccept valueLearnerslearn chosen valueChosen value = value accepted by majority; safety follows from invariants across proposals
Basic Paxos flow.
Advertisement

How it works end to end

Multi-Paxos: efficient version for a sequence of values (i.e., replicated log). One proposer becomes a stable leader; subsequent values skip Phase 1. This is what real systems use.

Safety: only one value is ever chosen for a given instance. Guaranteed by the promise-and-accept protocol.

Liveness: not guaranteed under contention. Multiple proposers can duel indefinitely. Multi-Paxos with leader election avoids this.