In this lesson · topic 4 of 7
Topic 4
The leader nobody follows
5 min read
The figures below come from the simulator with fixed seeds, and a test pins each one. Hover a value for its setup.
Elections cost time
Five nodes, election timeout drawn from 300 to 600 ms, heartbeats every 100 ms, mean delay 30 ms. From start to the first leader takes 416 msmeasured on average over eight seeds. From the leader crashing to a replacement takes 635 msmeasured. A leader-based protocol pays that gap on every failover. Writes are refused until it closes, so clients must retry.
Tight timeouts split votes
With the leader crashed six times per seed, 14%measured of terms that had a candidate ended without a leader, because a second node timed out before the first had gathered its votes. Tighten the timeout to 150 to 300 ms with a mean delay of 100 ms, and that share rises to 51%measured. Each split costs a full extra timeout. The paper’s rule of thumb is that broadcast time should be much smaller than the election timeout, or candidates keep colliding.
A leader in the minority
Seed 7, writes every 200 ms, then the leader is cut into a two-node minority for four seconds. The cut-off leader keeps accepting writes and appends 22measured entries it can never commit. On the other side a new leader is elected and commits 18measured entries in the same four seconds. After the network heals, every log matches the new leader’s within 90 msmeasured, and the orphaned entries are gone.
Those entries were never acknowledged to a client, so losing them is correct. The client that sent them saw a timeout and should retry against the new leader. A client that treats a timeout as success has a bug, and no consensus protocol can fix it.
What the model leaves out
The simulator does not snapshot or compact the log, so it grows without bound. It does not change membership, which in real Raft is done through a joint configuration so that no two majorities from the old and new sets can disagree. It does not model disk, so persistence is free and instant. Client sessions and duplicate detection are also absent, so a retried write would be applied twice.
Message loss is modelled, and partitions drop messages in flight. What is not modelled is a Byzantine node, one that lies. Raft assumes nodes fail by stopping, not by misbehaving.
Where consensus is not the answer
Consensus is expensive: every write waits for a majority round trip, and the cluster cannot grow much without that round trip slowing down. It is the right tool for small, critical state such as configuration, membership, leader election and lock services. Most systems use a consensus service for that and a cheaper replication scheme for the bulk of their data.