Paxos is the algorithm every distributed system either uses or replaces. It solves the fundamental problem: N nodes must agree on ONE value even if some fail.

ProposerAcceptor 1Acceptor 2Acceptor 3Phase 1a: Prepare(n)Phase 1b: Promise(n)Phase 2a: Accept(n, v)Phase 2b: Accepted(n, v)Learners get valueconsensus achievedMajority rulequorum = ⌊N/2⌋+1
Paxos: two phases (prepare + accept), each needing majority quorum
Advertisement

The problem

N nodes propose values. At most one value must be chosen. Even if some crash, the chosen value must be stable.

The problem

N nodes propose values. At most one value must be chosen. Even if some crash, the chosen value must be stable.

Advertisement

Phase 1: Prepare

Proposer picks number n, sends Prepare(n) to acceptors. Acceptor promises to reject anything < n and returns any previously accepted value.

Phase 2: Accept

If proposer got promises from a majority, sends Accept(n, v) where v is either its own value or the highest accepted value from Phase 1.

Quorum + safety

Majority for both phases = any two majorities intersect. Guarantees at most one value is chosen.

Why Paxos is hard

Original paper (Lamport 1998) was famously incomprehensible. Multi-Paxos, Fast Paxos add optimizations. Most engineers use Raft instead.

Two phases + majority quorum. Correct, subtle, hard to implement.