Course contentsShow
← Computer Science
Lesson 2664 of 2,87259. Consensus and ReplicationFree lesson

Leader Election: Handling Split Votes

Learn how randomized election timeouts prevent split votes and ensure election progress when no candidate wins majority.

Leader Election: Handling Split Votes

What you'll learn: How Raft uses randomized election timeouts to break deadlocks when multiple candidates split the vote and no one wins a majority.

The Split Vote Problem

In Raft's leader election, a split vote occurs when multiple candidates simultaneously start elections in the same term, and each receives some votes but none achieves a majority. This deadlock would prevent any leader from being elected, violating the liveness property of consensus.

Imagine three nodes all timing out at the exact same moment, each voting for themselves, and receiving exactly one vote each. With no majority winner, the election fails—but if they all timeout again at the same time, the cycle repeats indefinitely.

Randomized Election Timeouts

Raft solves this elegantly: each follower chooses a randomized election timeout from a range (typically 150–300ms). When an election fails due to a split vote:

  1. All candidates revert to follower state
  2. Each waits for its own randomized timeout
  3. The first to timeout becomes a candidate and starts a new election
  4. It will likely request votes before others timeout, winning the election

This randomization makes simultaneous elections extremely unlikely in subsequent rounds.

Why It Works

The key insight: you only need one node to act first. By spreading out timeout values randomly, you ensure that—with high probability—one server will "jump ahead" and secure votes before competitors wake up. Even if a second split vote occurs (rare), the next round's fresh randomization will break it.

Key Takeaway: Randomized election timeouts prevent split vote deadlocks by ensuring servers trigger elections at different times, allowing one candidate to win majority before others compete, thus guaranteeing election progress in Raft.