Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 11 · From Scratch · Raft · about 16 min to read

Play it as a journeyTutor comes with a plan

Paxos, made small

Consistency and Consensus
Consistency and Consensus · Open board

: the Data Systems board on consistency and consensus. This lesson builds its core: how five machines agree on one value, then on a whole log of values, while messages go missing.

Before you start. You need three ideas, and each is refreshed here. A majority is more than half of the machines, so 3 of 5. A log is a list of commands in a fixed order, and every machine must end with the same list. Raft Capstone: Everything built that with a leader, a log and a majority vote, so you have seen one answer to this problem. Consistency and Consensus says why agreement is hard. Beyond Raft: Paxos, its family, and liars names Multi-Paxos in a few lines. Here you build it and test it.

Lesson 84 of 117 in From Scratch

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • The problem: two writers, five servers, lost messages
  • The first try: each server keeps the first value it hears
  • Ballots: every attempt gets a number that can be compared
  • Promises: phase one asks acceptors to ignore older ballots
  • Accepts: phase two asks acceptors to take the value
  • Message loss changes speed, never safety
  • Multi-Paxos: do phase one once, then only phase two
  • The acceptor
  • The proposer’s rule
  • The test: three proposers, five acceptors, random loss
  • Multi-Paxos with gap filling
  • Trade-offs and edge cases

Terms it explains: majority, log, Paxos, acceptors, proposers, ballot, prepare, promise, accept, chosen, leader, Multi-Paxos, 2PC, causal consistency, consensus, coordination service, coordinator/participant, FLP, Lamport timestamp, linearizability, partial vs total order, Paxos/Raft/Zab, strict serializability, total order broadcast.

Related papers

Review From Scratch