Compare Paxos and Raft
I was asked this
No reports yet. Sign in to say where you were asked it.
A system design interview question asked in Uber's system design round, last asked Sep 2025. It tests consensus, distributed systems and replication.
Explain how Paxos and Raft reach consensus on a replicated log, and compare them: leader election, quorum requirements, log replication, membership changes and behavior under network partitions. Walk through failure scenarios (a leader crash, delayed messages, a node losing its disk) and how each protocol recovers. Then, for a new service whose team values operational simplicity and debuggability, choose one and justify the trade-offs.
Requirements
- Functional: describe each protocol well enough to trace a write from client to commit, including the messages exchanged.
- Functional: compare them point by point on the five areas above.
- Functional: walk through each failure scenario for both protocols, step by step.
- Non-functional (for the recommendation): a small team must run, debug and reason about the service; correctness under partitions is required; latency and throughput needs are moderate.
Clarifying questions
- Is "Paxos" single-decree Paxos, Multi-Paxos, or a family including variants such as EPaxos?
- What does the new service replicate: configuration, a lock service, a database log?
- How many replicas and how many regions?
- Is an existing library acceptable (etcd's Raft, a Paxos implementation), or must the team build one?
What a strong answer covers
- Single-decree Paxos: proposers, acceptors, ballot numbers, the prepare/promise and accept/accepted phases, and why a majority quorum makes any two quorums intersect. Multi-Paxos with a stable leader skipping phase 1.
- Raft: terms, randomized election timeouts, votes granted only to candidates with an up-to-date log,
AppendEntrieswith the previous index and term for consistency, commit once a majority stores an entry from the current term. - Differences: Raft's strong leader and log-matching property against Paxos's per-slot agreement and possible holes in the log; Raft's specified membership change (joint consensus or one server at a time) against Paxos's loosely specified reconfiguration.
- Partitions: a minority side cannot commit in either protocol; a stale leader in Raft steps down on seeing a higher term; linearizable reads need a lease or a read-index round.
- Failures: leader crash and a new election; delayed messages rejected by term or ballot; disk loss is the dangerous one, since a node that forgets its promises or votes can break safety, so it must rejoin as a new member.
- A decision, likely Raft for understandability, tooling and mature libraries, with what you give up.
Follow-ups
- Two Raft nodes both think they are leader for a moment. Why is that safe?
- How do you add a fifth replica without losing availability?
- Where would you choose a leaderless protocol instead, and why?
- How do snapshots and log compaction work in Raft?
Where it's asked
- Uber · System design · Last asked Sep 202560 min · Whiteboard and discussion
What it tests
consensus · distributed systems · replication
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
