Diego Ongaro and John Ousterhout built Raft around an unusual primary constraint: make distributed consensus easy to understand, and make it obvious why every rule works. After spending nearly a year struggling through Leslie Lamport’s Paxos papers and finding at NSDI 2012 that few seasoned systems researchers felt comfortable with the protocol, they designed a new algorithm for replicated state machines from the ground up.
Today, Raft sits inside etcd (backing Kubernetes cluster state), Consul, CockroachDB, TiKV, and YugabyteDB. Just as importantly, its design methodology directly addressed a warning the Chubby implementers had published years earlier: production systems diverged so far from single-decree Paxos sketches that the formal proofs no longer covered the running code.
- One-way log flow: A single elected leader accepts all client commands and pushes
AppendEntriesRPCs outward; core consensus and membership changes need only 4 message types (two RPC requests and replies), versus 10 in Viewstamped Replication and ZooKeeper. - Two understandability levers: Problem decomposition splits election, replication, safety, and reconfiguration into semi-independent pieces, while state-space reduction forbids log holes and limits how logs can diverge.
- Randomized timers break split votes fast: With zero jitter on a 150ms timeout, split votes stalled leader election past 10 seconds; adding just 5ms of randomness cut median downtime to 287ms, and a 150 to 300ms window converged within 513ms across all 1,000 trials.
- Measured comprehension advantage: In a 43-student crossover study at Stanford and UC Berkeley, 33 students scored higher on Raft than Paxos (mean 25.7 vs. 20.8 out of 60; linear regression estimates a 12.5-point edge controlling for prior Paxos exposure).
Why Paxos left a gap, and how strong leadership closes it
Ongaro and Ousterhout argue in Section 3 that Paxos suffers from two structural flaws, both traceable to starting from single-decree agreement as described in The Part-Time Parliament. First, single-decree Paxos splits into two intertwined phases that lack independent intuition, and composing multiple decrees into a log adds extra rules for filling gaps and reordering proposals. Second, Lamport sketched multi-Paxos without pinning down a canonical log algorithm, leaving builders to invent their own leader election, log repair, and reconfiguration details.
Raft flips the starting point. Rather than letting any peer propose entries for any log slot and later stitching the slots together, Raft makes leader election the first step of consensus. Time is divided into monotonically increasing terms that act as logical clocks. Every server starts as a passive follower; if an election timeout passes without an AppendEntries heartbeat, it increments currentTerm, becomes a candidate, votes for itself, and broadcasts RequestVote. Whenever any server sees a higher term in an RPC request or response, it immediately updates currentTerm and reverts to follower.
Strong leadership shrinks the state space dramatically. Logs grow sequentially with no holes, leaders only append (Leader Append-Only), and entries flow strictly from leader to followers. Where Viewstamped Replication and ZooKeeper allow entries to move back into a newly elected leader during recovery, Raft guarantees every committed entry is already on the new leader at election time.
Even so, the authors hit dead ends when choosing mechanisms inside that framework. Several intuitive designs failed under edge-case analysis and had to be replaced.
Log matching, the election restriction, and the Figure 8 trap
During normal operation, the leader appends a client command to its log, sends parallel AppendEntries RPCs, and marks the entry committed once a majority of servers store it. In the common case, committing takes one round-trip to half the cluster, and a single slow follower does not stall the majority.
Crashes leave follower logs messy: missing committed entries, holding extra uncommitted entries from crashed leaders, or both across multiple terms (Figure 7). Raft repairs every divergence with one rule. Each AppendEntries call carries prevLogIndex and prevLogTerm for the entry right before the new batch. If a follower lacks an entry matching both index and term, it rejects the RPC; the leader decrements that follower’s nextIndex and retries until they find a matching prefix, then overwrites any conflicting follower tail. By induction from empty logs, this enforces the Log Matching Property: if two logs share an index and term, their entire prefixes up through that index are identical.
Because logs never flow from followers back to a new leader, Raft must prevent any server missing a committed entry from winning an election. That is the job of the election restriction in Section 5.4.1. A voter denies RequestVote if its own log is more up-to-date than the candidate’s, comparing the last log entry’s term first and breaking ties by log length. Since both a committing majority and a voting majority must intersect in at least one server, any winning candidate is guaranteed to hold every entry committed in prior terms (Leader Completeness).
Yet that rule creates a famous subtlety shown in Figure 8 of the paper. Suppose leader S1 writes a term-2 entry at index 2 on two of five servers and crashes. S5 wins term 3 with votes from S3, S4, and itself, then writes a term-3 entry at index 2 and crashes. Now S1 restarts, wins term 4, and replicates its old term-2 entry to S3. That term-2 entry now sits on a majority (S1, S2, S3). Can S1 mark it committed by counting replicas? No. If S1 crashes before writing a term-4 entry, S5 still has last log term 3 (higher than S2 and S3’s last log term 2), so S5 can win term 5 from S2, S3, and S4 and overwrite the term-2 entry across the whole cluster. Raft therefore forbids committing previous-term entries by counting replicas: a leader may only commit entries from its current term by majority count, which then commits all earlier log entries indirectly via Log Matching.
Like Paxos, Raft guarantees safety under arbitrary packet loss, reordering, and delays, while liveness depends on the timing inequality broadcastTime << electionTimeout << MTBF (Section 5.6). With persistent disk writes making broadcastTime 0.5 to 20ms, an election timeout of 150 to 300ms leaves ample margin for heartbeats while keeping crash recovery brief, respecting FLP impossibility by isolating timing assumptions strictly to progress rather than correctness.
Trace five corner cases that break naive consensus
A consensus design looks clean on the happy path and fails in the transitions: tied elections, dirty follower tails, partial commits across crashes, live cluster resizing, and linearizable client reads. Step through the five scenarios below to compare what breaks in a naive design, how Raft handles it, and what the paper’s evidence shows.
Select a corner case (or use Left and Right arrow keys) to inspect the failure scenario, Raft's exact rule, and the paper's evidence.
Tied elections stall deterministic timers
Leader electionIf followers time out in lockstep after a leader crash, each votes for itself and no candidate reaches a majority.
- Why naive fix breaks
- Deterministic timeouts (150-150ms) keep servers colliding term after term; ranked-candidate tie-breakers triggered live-lock races when higher-ranked nodes crashed.
- Raft's mechanism
- Each server draws an independent random election timeout (150 to 300ms) both before starting an election and after a split vote.
- Measured evidence
- On a 5-server cluster with 15ms broadcast time (Figure 16), 150-150ms took over 10s; 150-155ms cut median downtime to 287ms; 150-300ms capped worst-case across 1,000 trials at 513ms.
- Practical tuning
- 12-24ms timers averaged 35ms recovery (152ms max) but risked violating broadcastTime << electionTimeout; 150-300ms avoided spurious elections.
Crashed leaders leave missing or extra entries
Log replicationRepeated crashes can leave followers missing committed entries, holding uncommitted tails from dead terms, or both.
- Why naive fix breaks
- Letting followers keep uncommitted entries or letting a new leader pull missing entries from peers forces bidirectional log merging and complex hole repair.
- Raft's mechanism
- Leader decrements nextIndex[i] on AppendEntries rejection until prevLogIndex and prevLogTerm match, then overwrites the follower's conflicting tail.
- Optional speedup
- Followers can include the conflicting term and its first index on rejection so the leader jumps one whole term per RPC instead of one entry at a time.
- Invariant preserved
- Combined with the election restriction, only uncommitted entries are ever overwritten; Log Matching holds inductively across all logs.
Counting replicas on an older term's entry
Safety ruleEven if a restarted leader copies an earlier term's entry onto a majority, a rival with a higher last-log term can still overwrite it.
- Why naive fix breaks
- In Figure 8, S1 replicates its term-2 entry to 3 of 5 servers in term 4, yet S5 (holding a term-3 entry) can still win term 5 and erase index 2.
- Raft's mechanism
- Leaders only commit entries created in their own currentTerm by counting replicas; committing one current-term entry indirectly commits all prior entries.
- Why entries keep old terms
- Unlike algorithms that renumber old entries into the new term, preserving original terms avoids re-sending extra log entries and keeps Log Matching direct.
- Read impact
- Because a newly elected leader may not yet know which entries are committed, Section 8 requires committing a blank no-op entry at term start.
Resizing a live cluster without dual majorities
MembershipServers never switch configuration files instantaneously, so naive live transitions split a cluster into two independent quorums.
- Why naive fix breaks
- In Figure 10, moving directly from 3 nodes (Cold) to 5 (Cnew) lets Cold and Cnew simultaneously elect two distinct leaders in the same term.
- Raft's mechanism
- Two-phase joint consensus: replicate Cold,new (requiring separate majorities of both Cold and Cnew), commit it, then replicate and commit Cnew.
- Three edge fixes
- New nodes catch up as non-voting learners first; deposed leaders step down only after committing Cnew; servers ignore RequestVote inside min election timeout of a leader heartbeat.
- Availability edge
- Unlike Viewstamped Replication (which pauses client requests) or SMART (which bounds concurrency), joint consensus serves normal requests throughout.
Returning linearizable reads without writing logs
Client semanticsA partitioned old leader can answer local reads after a new leader has already committed writes on the majority side.
- Why naive fix breaks
- Serving reads from a leader's local state machine ignores partitions; retrying un-tracked writes after a crash executes commands twice.
- Raft's mechanism
- For linearizable reads: commit a no-op at term start, then exchange heartbeats with a majority before answering. For writes: track client serial numbers.
- Timing tradeoff
- Leader leases avoid read heartbeats but tie safety to bounded clock skew; Raft's default heartbeat check keeps safety clock-free.
- Log compaction
- Local copy-on-write snapshots (via Linux fork()) bound log growth independently; only lagging followers receive chunked InstallSnapshot RPCs.
If you prefer the short version without clicking through the tabs, here are the five mechanisms that keep Raft safe across edge cases:
- Split votes: randomized election timeouts (
150–300ms) break symmetry in a single round, cutting recovery from over 10 seconds to under 513ms in 1,000-trial runs. - Divergent logs:
AppendEntriesenforces an inductiveprevLogIndex/prevLogTermprefix check so leaders overwrite conflicting follower tails without ever editing their own log. - Old-term commits: leaders commit only current-term entries by majority count (Figure 8), avoiding a subtle race where a higher-term rival overwrites an earlier-term majority.
- Cluster resizing: two-phase joint consensus (
Cold,newthenCnew) overlaps old and new quorums, paired with non-voting catch-up and minimum-timeout vote filtering for removed nodes. - Linearizable clients: a term-start no-op, majority heartbeat read check, and per-client serial numbers guarantee exact-once linearizable semantics without logging reads.
Caveats, formal proofs, and where Raft stops
Three caveats keep Raft’s claims in sharp engineering perspective.
First, the understandability user study is encouraging but not definitive. Across 43 upper-level and graduate students at Stanford and UC Berkeley, Raft beat Paxos by 4.9 raw points (25.7 vs. 20.8 out of 60, 95% confidence interval at least +2.5 points) and 33 of 41 respondents rated Raft easier to implement and explain. Yet 15 students already knew Paxos, the Paxos lecture was 14% longer, self-reported difficulty ratings could reflect awareness of the authors’ hypothesis, and the authors noticed an unexplained 6.3-point drop on Raft for students who took the Paxos quiz first.
Second, simplicity lives in the core protocol, not in every production extension. The core 400-line TLA+ specification was mechanically checked for Log Completeness in TLAPS (relying on unverified type-safety invariants) while State Machine Safety received a 3,500-word informal proof. Once a real system adds InstallSnapshot chunking, Linux fork() copy-on-write snapshots, client serial-number deduplication, non-voting learners, and minimum-timeout vote guards against deposed nodes, the implementation grows substantially beyond the crisp summary in Figure 2. Their own RAMCloud C++ implementation totaled roughly 2,000 lines before full ecosystem tooling.
Third, strong leadership trades away leaderless WAN performance. As Ongaro and Ousterhout explicitly note in Section 10, protocols like EPaxos allow any replica to commit commuting operations in a single wide-area round-trip, avoiding the bottleneck of funneling every write and linearizable read check through one leader. Likewise, in production clusters, Ongaro’s later work supplemented joint consensus with single-server membership changes to simplify operational tooling, and real deployments routinely add a pre-vote phase to keep partitioned nodes from bumping cluster terms on reconnect.
For infrastructure engineers, the lesson from Raft is less about winning a philosophical war against Paxos and more about choosing invariants you can verify under pressure. Every replicated log eventually needs leader leases or read heartbeats, membership transitions, snapshotting, and client deduplication; Raft’s lasting contribution is assembling those pieces around one-way log flow so an engineer on call at 3 a.m. can still trace which node is allowed to lead and why.


