Part II — Replication & Consensus · Chapter 4

Multi-Paxos & leader election

Hook

Plain Paxos runs both its phases for every single decision. If the same node keeps winning the prepare phase every time, why keep asking?

Intuition

Same 3 acceptors as before, but now deciding 5 log slots in a row. Plain Paxos pays for prepare/promise every time; Multi-Paxos, with a stable leader, only pays once.

Formalize

Once a leader has run Phase 1 (prepare/promise) successfully and no other proposer has interfered, every acceptor has already promised to accept that leader's numbers. The leader can skip straight to Phase 2 (accept/accepted) for every subsequent decision — right up until something disrupts its leadership.

Counting message-hops per round trip (prepare, promise, accept, accepted = 4 for a full round; accept, accepted = 2 for an accept-only round):

Mplain(k)=4kMmulti(k)=4+2(k1)=2k+2M_{\text{plain}}(k) = 4k \qquad M_{\text{multi}}(k) = 4 + 2(k-1) = 2k+2
  • kk — the number of log slots (decisions) being made.
  • Mplain(k)M_{\text{plain}}(k) — total messages if every decision re-runs both phases.
  • Mmulti(k)M_{\text{multi}}(k) — total messages with one stable leader skipping Phase 1 after the first decision.
  1. Only the first decision pays full price

    Decision 1 still needs a full round (4 messages) to establish the leader's numbers are trusted.

  2. Every decision after that is cheaper

    Decisions 2 through kk only need the accept/accepted round trip — 2 messages each.

Play

Slide kk up. The gap between the two bars is the savings — it grows by 2 messages for every extra decision, because Multi-Paxos never repeats the prepare phase as long as the leader stays the same.

Worked example

k=5k = 5 decisions, one stable leader throughout:

  1. Plain Paxos

    Mplain(5)=4×5=20 messagesM_{\text{plain}}(5) = 4 \times 5 = 20 \text{ messages}

  2. Multi-Paxos

    Mmulti(5)=4+2(51)=4+8=12 messagesM_{\text{multi}}(5) = 4 + 2(5-1) = 4 + 8 = 12 \text{ messages}

  3. Savings

    2012=8 messages saved20 - 12 = 8 \text{ messages saved}

Checkpoint

Slide k (the number of decided log slots) until Multi-Paxos saves exactly 10 messages compared to plain Paxos.

Slide k to try a value
Summary
Mmulti(k)=2k+2,savings=2(k1)M_{\text{multi}}(k) = 2k + 2, \qquad \text{savings} = 2(k-1)

Multi-Paxos is just repeated Paxos with the prepare phase amortized across many decisions instead of paid for every time — as long as the leader stays stable. When the leader changes, whoever takes over has to re-run Phase 1 once before it can go back to skipping it, exactly the way Raft's leader election (next few chapters) re-establishes trust after a crash.