Can unreliable processes on an asynchronous network always reach the same decision? If not, what can they still guarantee?
Committing a transaction, keeping replicas identical, recovering from a crash: all are agreement problems, and consensus is their general form. FLP proves that in a fully asynchronous system no deterministic protocol can guarantee a decision if even one process may crash, because a crashed process looks exactly like a slow one. The way out is to keep safety unconditional and let only termination depend on the system staying calm for long enough. Paxos does exactly that. Run it once per log slot and you get state machine replication.
Components may hold divergent views of the system state and of what is happening. Coherent behaviour then requires them to agree on everything relevant (state, events…). What matters is that they reach the very same conclusion, whatever it is about.
Examples of agreement problems [Fischer, 1983]
Agreement problems involve a system of processes, some of which may be faulty. A fundamental problem of fault-tolerant distributed computing is for the reliable processes to reach a consensus.
Consensus is the process by which we reach agreement over system state between unreliable machines connected by (possibly) asynchronous networks.
When processes fail, the reliable ones must agree on what has happened and what happens next, so that state and evolution stay consistent, e.g. during recovery (Ch. 4). So consensus is essential to fault tolerance: when a crash breaks replica synchronisation, recovery needs the replicas to agree on each replica's state and on the events handled or still to handle.
Consensus is often hidden inside other problems: commit (§3), replication (Ch. 5), replicated state machines (§7), coordinator election (Ch. 2) and ledgers (Ch. 7). Reducing so many issues to one abstract problem gives general solutions. “…how hard can this be?”
A system is modelled as a collection of processes (logical) or processors (physical) that compute at the same time and interact through:
Concurrent or distributed, process or processor, even parallel: the literature uses them interchangeably when the problem is unaffected by its physical nature (precise terms: Ch. 1).
Synchronous: there is a bound Δ on message transmission delay and a bound Φ on the relative speed of processes, which allows accurate failure detection.
Asynchronous: otherwise. This models unpredictable load on network and CPUs, where it is never possible to know whether a process has crashed or not.
A crashed process and a slow one both look silent. Waiting for it may never end; deciding without it risks contradicting a decision it is about to make.
Failure model: processes, processors and links may all fail, in diverse ways. Fault tolerance is the property of keeping working beyond faults of any sort (Ch. 4).
There is a fixed number n of possibly faulty processors, and each has an initial bit xi. The non-faulty processes must agree on a bit y, the consensus value. The problem is solvable if some protocol makes all non-faulty processors terminate with the same y.
As stated, “always output 0” would work. So dependency requirements say how y must depend on the inputs, and each choice defines a different problem:
Dependency requirements [Fischer, 1983]
Two relatives change what is agreed on:
| Problem [Fischer, 1983] | Agree on | Strong | Weak |
|---|---|---|---|
| Interactive consistency | a vector y: what each processor's initial value was | yi = xi for each non-faulty i | the same, if no failures occur during the run |
| Generals problem (reliable broadcast) | the bit x that the general (transmitter) sends to all | y = x if the general is not faulty | y = x if no failures occur |
The concrete case is transaction commit [Dolev & Strong, 1982]: the data managers of a transaction agree whether to install its results or discard them (say, because one could not do its part). All must decide the same, or the database becomes inconsistent.
For Paxos the slides use today's names. Agreement: no two processes decide differently. Validity: the decided value was proposed. Termination: every non-faulty process eventually decides. The first two are safety, the third liveness.
With reliable processes and network, commit is straightforward. Real systems suffer faults [Fich & Ruppert, 2003]:
Enough faults overwhelm any protocol, so the goal is tolerating a prescribed number of “expected” ones.
Fich & Ruppert survey “hundreds” of impossibility results, outright or within resource bounds, across models of synchrony, fault tolerance, communication and randomisation. CAP is not alone (Ch. 5):
Impossibility, again
In a fully asynchronous system, no consensus protocol can tolerate even a single crash failure, under the mere requirement of non-triviality.
The other hypotheses are kind: no Byzantine failures, reliable exactly-once delivery. Still, one process stopping at an inopportune time can defeat any commit protocol. Without further assumptions, or tighter limits on the failures tolerated, there is no robust solution.
A configuration (all process states plus the messages in transit) is univalent (0- or 1-valent) if only one decision is still reachable from it, and bivalent if both are. For a deterministic protocol, the proof has two steps:
FLP shows that a bad run exists for every such protocol, not that it is likely.
Give up the problems, or essential features of the systems solving them? The slides choose a third road: solutions within the boundaries impossibility theorems set, following Howard's “making impossible possible”:
Solution to FLP [Howard, 2016]
Neither refutes FLP. A timer only guesses that a silent process crashed, so a wrong guess must cost time, never safety; and assuming some bound, however large, suffices to prove eventual decision. Paxos is built on this split.
Partial synchrony [Dwork, Lynch & Stockmeyer, 1988]: bounds exist but are unknown. Failure detectors [Chandra & Toueg, 1996]: eventually accurate suspicion. Randomisation [Ben-Or, 1983]: termination with probability 1.
Lineage
Features
Items 4 and 5 are the answer to FLP: safety is unconditional, liveness is conditional.
Process roles
Roles are logical processes [Tanenbaum & van Steen, 2017]: one process may play all three. The basic idea is a two-phase process (promise, then commit), majority agreement and monotonically increasing numbers labelling proposals.
Paxos made simple [Lamport, 2001]
One acceptor's crash would stop everything, hence several. A majority suffices because any two majorities share at least one acceptor, and with 2f + 1 acceptors a majority survives f crashes. Hence n ≥ 2f + 1, and an odd number: a (2f + 2)-th acceptor enlarges the majority without tolerating another crash.
Point 4 is the core. A proposer cannot see whether a value was chosen: acceptances may be lost or sit on crashed acceptors. So it first asks a majority what they accepted, and makes them promise to ignore older proposals so the answer cannot go stale. That majority overlaps any choosing majority, so the chosen value (or a later proposal carrying it) is among the replies, and adopting the highest-numbered one suffices.
Proposals
Phases
ack(n, ⊥, ⊥), a promise to ignore proposals numbered below n. If it has already accepted (v, n′) with n′ < n, it replies ack(n, v, n′).accept(v, n) to all acceptors. If any ack carried a value, v must be the one with the highest number (rule 2.1). An acceptor accepts unless it has promised some n′ > n.Ghosh's observations turn these rules into the two invariants behind safety:
accept(v, n) is sent, then either no acceptor in some majority has accepted any n′ < n, or v is the value of the highest-numbered such proposal accepted in that majority.P1 wants red, P2 wants blue. You are the network: deliver, drop, crash. Step through a scenario or play freely; the verdict checks that at most one value is ever chosen.
In flight
blue: prepare/ack · green: accept/accepted · ○ ignored · × dropped or lost · red bar: acceptor down
Scenario 4 is point 6's livelock. Promises for 2 make P1's accept for 1 ignored; P1 retries with 3, making P2's accept ignored; and so on. Every rule holds and nothing is chosen: FLP's endless run, made concrete. The remedy is a distinguished proposer, a leader, plus timers and backoffs. This reduces conflicts without eliminating them: electing a leader is itself agreement, so two processes may briefly both believe they lead. That costs progress, never safety.
Replication relates to consensus because all replicas of a resource must agree on the same state over time. The state machine approach is a general method for implementing fault-tolerant services in distributed systems.
Determinism makes the shift sound: same start, same operations, same order, same state. It is the replicated bank account of Ch. 2, fixed by agreement rather than clocks.
Multi-Paxos [Van Renesse & Altinbuken, 2015]
Other Paxos-based algorithms
Chubby. Google built a Paxos-based fault-tolerant database [Chandra et al., 2007] for Chubby [Burrows, 2006], a reliable lock service used widely inside Google, e.g. by GFS and Bigtable. They use Chubby; Chubby runs Paxos. Ledgers take the same state-machine idea to open, Byzantine settings (Ch. 7).
General
Specific
A timeout guesses a crash; the process may only be slow. Acting risks disagreement, never acting risks waiting forever. Timeouts give progress; safety must survive wrong ones.
A proposer cannot see whether a value was chosen. Prepare queries a majority (intersecting any choosing one) and freezes the answer with promises; rule 2.1 carries the value forward. Show scenario 3 with and without the broken rule.
Majorities intersect, so no accepted value is forgotten, and 2f + 1 acceptors keep a majority after f crashes. With more crashes (scenario 2), Paxos stalls but never decides wrongly.
No. Safety always holds; termination needs a calm enough period. Duelling proposers can stall it forever. A leader makes that unlikely, not impossible.
SMR turns replication into agreeing on the order of deterministic operations. In a partition, a minority cannot form a majority and stops rather than diverging: in CAP terms, Paxos picks consistency (Ch. 5).
:nodedown rely on timeouts, so a slow node can be declared dead. In Thunk that costs duplicate work, never a wrong result: lose time, not safety.| Slides | Content | Here |
|---|---|---|
| C3 · Agreement I–II; Agreement & FT; Consensus; Consensus & FT | Problem, examples, definitions, why | §1 |
| C3 · Basic ontology I–IV | Components, terms, time and failure models | §2 |
| C3 · Many problems I–III; Commit; So what?; What is the problem? | Fischer's problems and requirements; commit; faults | §3, §1 |
| C3 · Impossibility I–II; FLP | Impossibility results; FLP | §4 |
| C3 · So what?; Harsh reality I–II | Options; solution to FLP | §5 |
| C3 · Paxos I–VI; Made simple; Phases I–IV; Observations | Lineage, features, roles, reasoning, phases | §6 |
| C3 · SMR I–II; Beyond Paxos I–II; Chubby | SMR, Multi-Paxos, variants, Chubby | §7 |
| C3 · Lessons learnt I–II | General and specific lessons | §8 |