Paxos is a family of protocols that enables a distributed system of unreliable nodes to agree on a single value (achieve consensus) despite the possibility of node failures, network delays, and partitions. It works through a series of proposal rounds managed by temporarily elected leader nodes, where a majority (quorum) of nodes must promise to consider and then accept a proposed value for it to be chosen.
The protocol operates in two main phases, which may be repeated:
- Prepare/Promise Phase: A proposer sends a prepare request with a unique, increasing proposal number to a quorum of acceptors. Acceptors promise not to accept any proposal with a number lower than this and reply with the highest-numbered proposal they have already accepted (if any).
- Accept/Accepted Phase: If the proposer receives promises from a quorum, it sends an accept request for a value. This value must be the one from the highest-numbered proposal reported in the promises, or its own if none were reported. If a quorum of acceptors accepts this request, the value is chosen and consensus is achieved.