GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
PaPoC 2020

Paxos vs Raft: Have we reached consensus on distributed consensus?

Describe Paxos in Raft's vocabulary and the two algorithms turn out to differ only in leader election. Raft's famous understandability comes mostly from its presentation, the authors conclude.

Breakdown by FDE Interviews · 11 min read · Updated

About the original · 2020
AUTHORS
Howard, Mortier
FROM
University of Cambridge
PUBLISHED
Apr 2020 · PaPoC 2020
CITED BY
91Semantic Scholar · Nov 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 26% of this breakdown.

01

The paper in one minute

Replicated databases and coordination services keep several servers in agreement by replicating a log of operations: every server applies the same operations in the same order. Distributed consensus decides that order even when servers crash and messages are delayed. Two algorithms dominate production. Paxos, from Lamport, is famously subtle and is really a family described differently from paper to paper. Raft, from Ongaro and Ousterhout in 2014, was designed to be easier to understand and claimed to be as efficient.

Howard and Mortier rewrite Paxos, in the multi-decree form used in practice, using Raft's structure. Both algorithms then look the same in most respects. Servers are followers, candidates or leaders. Each server tracks a term number that only increases. A leader appends client operations to its log and sends them to followers with AppendEntries; once a majority acknowledges an entry, it is committed. When followers stop hearing from the leader, one becomes a candidate and asks for votes with RequestVote.

The differences are all in leader election. In Paxos, terms are divided among servers (server s may only run in terms where term mod n equals s), and any candidate can win; the votes it receives include the voters' log entries after its commit index, and the new leader adopts the entry with the highest term at each index, re-stamped with its own term. In Raft, any follower can run in any term, each server votes once per term, and a vote is granted only if the candidate's log is at least as up to date; no entries move during election, but a new leader cannot treat old-term entries as committed until it commits one from its own term.

The authors judge Raft slightly, not significantly, more understandable, and Raft's election surprisingly efficient because it sends no log entries. They expect Raft elections to be slower and more variable, because simultaneous candidates in the same term can split the vote, which Raft handles with randomized timeouts. Their conclusion: much of Raft's understandability comes from its clear presentation rather than from the algorithm.

THE IDEA, VISUALLY
LOGS BEFORE AND AFTER ELECTION (FIGURE 2) index 1 2 3 4 s1 before 1A 2B s2 before 1A 2B 2C s3 before 1A 3B 3D 3E s1 leads term 4 1A 4B 4C s2 leads term 5 1A 2B 5D 5E s3 leads term 6 1A 6B 6D 6E Paxos: re-stamped entries in blue; vote replies carry the voter's entries after the candidate's commit index. Raft: only s2 or s3 can win (s1's log is behind); entries keep their original terms; no entries in votes. arXiv 2004.05074 v2, University of Cambridge, PaPoC 2020 TIME TO ELECT A NEW LEADER (OUR SIMULATION) Raft, timeouts 150-155 ms p50 3,870 p99 24,595 Raft, timeouts 150-200 ms p50 171 p99 534 Raft, timeouts 150-300 ms p50 187 p99 431 Paxos-style, higher term wins p50 161 p99 183 ms, log scale from 100 Narrow jitter makes candidates collide, split the vote and retry: 34 split rounds per election on average. Wider randomization fixes it, at a cost in median time. The paper predicts this but does not measure it; delays and timeouts here are our assumptions.
Left: Figure 2's three server logs before a leader election and after each server wins a Paxos election, replayed by our code; entries Paxos re-stamps with the new term are highlighted. Right: our simulation of time to elect a new leader after a failure, for Raft with three timeout ranges and a Paxos-style rule where the higher term wins.
Research notes: the problem, approach and results
3

differences, all in leader election: who may run in a term, who may win, and which term re-replicated entries carry (Section 6)

0 vs 1-2

log entries carried in vote replies under Raft vs Paxos when replaying the paper's Figure 2 (our run)

34

average split-vote rounds per Raft election in our simulation when election timeouts vary by only 5 ms

THE PROBLEM

Production systems that need strongly consistent replication rely on Paxos or Raft. Raft was introduced as more understandable and as efficient as Paxos, but Paxos is described in many inconsistent ways, so the two are hard to compare fairly.

THE IDEA

Write a simplified Paxos (multi-decree, as used in practice) in Raft's terminology and structure: the same server states, terms, RequestVote and AppendEntries RPCs, then compare the two line by line, including safety proofs.

THE RESULT

The algorithms differ only in leader election. Paxos assigns terms to servers and lets any candidate win, then copies missing entries into the new leader; Raft lets anyone run but only an up-to-date log can win, so no entries move during election. Understandability differs little; Raft's election is surprisingly lightweight.

02

Why it matters to an FDE

Your customers' infrastructure runs on these. etcd (and so Kubernetes), Consul and CockroachDB use Raft; Chubby, Megastore, Borg, Azure Data Lake Store and WeChat's PaxosStore use Paxos, per the paper's citations. When a cluster misbehaves after a node failure, you are watching leader election.

A leader failure is a pause. Writes stop until a new leader is elected and has caught up. Our simulation puts that at roughly 160 to 190 ms with sensible timeouts and seconds when timeouts are configured too tightly. Know the election timeouts in the systems you deploy and how clients retry during elections.

Timeout tuning is a real lever. Raft relies on randomized timeouts to avoid split votes. In our model, a 5 ms spread caused 34 split rounds per election on average; a 50 to 150 ms spread fixed it. If a customer sees repeated elections under load, check timeouts, clock pauses (such as garbage collection) and network latency against them.

Use a proven implementation. The paper's point that the algorithms are subtle in small details, such as Raft's rule about committing old-term entries, is the reason not to build your own. Use etcd, ZooKeeper or a database's built-in replication.

Majorities set the failure budget. Both need a majority: three servers tolerate one failure, five tolerate two. Placing all of a majority in one zone defeats the point.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 290 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    The shared structure, the three election differences, safety, understandability and efficiency

    Free account
  2. 04How it works

    Normal replication, Paxos election step by step, Raft election, the safety argument and terminology

    Premium
  3. 05The numbers that matter

    Figure 2 replayed, the summary table, and our election simulation

    Premium
  4. 06Try it yourself

    Replay Figure 2 under both rules, then simulate elections with different timeout ranges

    Premium
  5. 07Where it breaks

    Simplified algorithms, no measurements, judgment-based understandability, and omitted features

    Premium
  6. 08Using it on a deployment

    Size clusters, place replicas, set timeouts, and design clients for elections

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →