| a consensus algorithm for managing a replicated log | Raft | [1] Abstract
Raft is a consensus algorithm for managing a replicated log. |
| equivalent in result, as efficient, different in structure | Raft against Paxos | [1] Abstract
It produces a result equivalent to (multi-)Paxos, and it is as efficient as Paxos, but its structure is different from Paxos |
| understandability | the primary goal | [1] §1
our primary goal was understandability |
| five | a typical cluster | [1] §5.1
A Raft cluster contains several servers; five is a typical number, which allows the system to tolerate two failures. |
| four | the TLA+ specification's message types | [3] raft.tla
CONSTANTS RequestVoteRequest, RequestVoteResponse, AppendEntriesRequest, AppendEntriesResponse |
| two | RPC types in the basic algorithm | [1] §5.1
the basic consensus algorithm requires only two types of RPCs |
| sends initial empty AppendEntries | Figure 2, a new leader | [1] Figure 2
Upon election: send initial empty AppendEntries RPCs (heartbeat) to each server; repeat during idle periods to prevent election timeouts (§5.2) |
| commits a blank no-op entry | a new leader | [1] §8
Raft handles this by having each leader commit a blank no-op entry into the log at the start of its term. |
| with no leader | a split vote ends a term | [1] §5.1
In this case the term will end with no leader |
| a logical clock | terms | [1] §5.1
Terms act as a logical clock [14] in Raft, and they allow servers to detect obsolete information such as stale leaders. |
| rejected | a stale request | [1] §5.1
If a server receives a request with a stale term number, it rejects the request. |
| a larger term always converts to follower | Figure 2, all servers | [1] Figure 2
If RPC request or response contains term T > currentTerm: set currentTerm = T, convert to follower (§5.1) |
| leader, follower or candidate | server states | [1] §5.1
At any given time each server is in one of three states: leader, follower, or candidate. |
| returns to follower state if the term is at least its own | a candidate that hears from a leader | [1] §5.2
If the leader’s term (included in its RPC) is at least as large as the candidate’s current term, then the candidate recognizes the leader as legitimate and returns to follower state. |
| valid RPCs from a leader or candidate | section 5.2, followers | [1] §5.2
RPCs from a leader or candidate. Leaders send periodic heartbeats |
| convert on a timeout without AppendEntries or a granted vote | Figure 2, followers | [1] Figure 2
If election timeout elapses without receiving AppendEntries RPC from current leader or granting vote to candidate: convert to candidate |
| does not grant its vote or reset its timer | a voter with a more up-to-date log | [4] §What happens when logs differ?
a voter does not grant its vote or reset its election timer if the voter's log is more up-to-date than the candidate's. |
| AppendEntries RPCs that carry no log entries | heartbeats | [1] §5.2
Leaders send periodic heartbeats (AppendEntries RPCs that carry no log entries) to all followers in order to maintain their authority. |
| a period of time with no communication | election timeout | [1] §5.2
If a follower receives no communication over a period of time called the election timeout, then it assumes there is no viable leader and begins an election to choose a new leader. |
| safety does not depend on timing | the timing requirement | [1] §5.6
One of our requirements for Raft is that safety must not depend on timing: the system must not produce incorrect results just because some event happens more quickly or slowly than expected. |
| chosen randomly from a fixed interval (e.g., 150–300ms) | election timeouts | [1] §5.2
To prevent split votes in the first place, election timeouts are chosen randomly from a fixed interval (e.g., 150–300ms). |
| halfway through the range | a single server's timeout | [4] §How fast will Raft elect a leader with no split votes?
Intuitively, any individual server is expected to time out halfway through the election timeout range |
| a base of 100000 microseconds, drawn between one and two bases | RaftScope election timeout | [6] raft.js
return now + (Math.random() + 1) * ELECTION_TIMEOUT; |
| 100000 microseconds | RaftScope base timeout | [6] raft.js
var ELECTION_TIMEOUT = 100000; |
| 10000 to 15000 microseconds | RaftScope message latency | [6] raft.js
var MIN_RPC_LATENCY = 10000; var MAX_RPC_LATENCY = 15000; |
| half the base election timeout | RaftScope heartbeat | [6] raft.js
server.heartbeatDue[peer] = model.time + ELECTION_TIMEOUT / 2; |
| increment the term, vote for itself, ask the others | beginning an election | [1] §5.2
To begin an election, a follower increments its current term and transitions to candidate state. It then votes for itself and issues RequestVote RPCs in parallel to each of the other servers in the cluster. |
| at most one, first come first served | votes per term | [1] §5.2
Each server will vote for at most one candidate in a given term, on a first-come-first-served basis |
| at most one leader per term | Election Safety | [1] Figure 3
Election Safety: at most one leader can be elected in a given term. |
| a majority of the full cluster | winning | [1] §5.2
A candidate wins an election if it receives votes from a majority of the servers in the full cluster for the same term. |
| three | outcomes of an election | [1] §5.2
A candidate continues in this state until one of three things happens: (a) it wins the election, (b) another server establishes itself as leader, or (c) a period of time goes by with no winner. |
| a small amount of mechanism on top of heartbeats | randomised timers | [1] §1
This adds only a small amount of mechanism to the heartbeats already required for any consensus algorithm, while resolving conflicts simply and rapidly. |
| a ranking system | the first design | [1] §5.2
Initially we planned to use a ranking system: each candidate was assigned a unique rank, which was used to select between competing candidates. |
| new corner cases appeared | why ranking was dropped | [1] §5.2
We made adjustments to the algorithm several times, but after each adjustment new corner cases appeared. |
| many candidates at once | split votes | [1] §5.2
if many followers become candidates at the same time, votes could be split so that no candidate obtains a majority. |
| split votes could repeat indefinitely | without randomisation | [1] §5.2
However, without extra measures split votes could repeat indefinitely. |
| no deterministic termination in an asynchronous model | the dissertation on termination | [4] ch. Leader election evaluation
According to the FLP impossibility result, no fault-tolerant consensus protocol can deterministically terminate in a purely asynchronous model. |
| the manifestation of FLP | split votes | [4] ch. Leader election evaluation
This manifests itself in split votes in Raft, which can potentially impede progress repeatedly during leader election. |
| restarts its randomized timeout | a candidate after a split vote | [1] §5.2
Each candidate restarts its randomized election timeout at the start of an election, and it waits for that timeout to elapse before starting the next election; this reduces the likelihood of another split vote in the new election. |
| a smaller range for candidates | separate candidate timeouts | [4] §How fast will Raft elect a leader when split votes are possible?
The optimization separates followers' timeouts from candidates' timeouts, where candidates select smaller timeouts from a distribution with a smaller range. |
| appended, then replicated | a client request | [1] §5.3
The leader appends the command to its log as a new entry, then issues AppendEntries RPCs in parallel to each of the other servers to replicate the entry. |
| AppendEntries retried indefinitely | a slow or crashed follower | [1] §5.3
the leader retries AppendEntries RPCs indefinitely (even after it has responded to the client) until all followers eventually store all log entries. |
| log entries flow only from the leader | strong leadership | [1] §1
log entries only flow from the leader to other servers. |
| a single round of RPCs to a majority | a normal commit | [1] §5.3
in the normal case a new entry can be replicated with a single round of RPCs to a majority of the cluster |
| replicated on a majority | committed | [1] §5.3
A log entry is committed once the leader that created the entry has replicated it on a majority of the servers (e.g., entry 7 in Figure 6). |
| also commits all before it | committing an entry | [1] §5.3
This also commits all preceding entries in the leader’s log, including entries created by previous leaders. |
| a majority, and the entry from the current term | the leader's commit rule | [1] Figure 2
If there exists an N such that N > commitIndex, a majority of matchIndex[i] ≥ N, and log[N].term == currentTerm: set commitIndex = N (§5.3, §5.4). |
| commitIndex = min(leaderCommit, index of last new entry) | receiver step 5 | [1] Figure 2
If leaderCommit > commitIndex, set commitIndex = min(leaderCommit, index of last new entry) |
| an induction step | the consistency check | [1] §5.3
The consistency check acts as an induction step: the initial empty state of the logs satisfies the Log Matching Property, and the consistency check preserves the Log Matching Property whenever logs are extended. |
| same index and term, same command | Log Matching, part one | [1] §5.3
If two entries in different logs have the same index and term, then they store the same command. |
| follows from one entry per index per term | the first Log Matching property | [1] §5.3
The first property follows from the fact that a leader creates at most one entry with a given log index in a given term, and log entries never change their position in the log. |
| same index and term, same history | Log Matching, part two | [1] §5.3
If two entries in different logs have the same index and term, then the logs are identical in all preceding entries. |
| the leader decrements nextIndex and retries | a rejected AppendEntries | [1] §5.3
After a rejection, the leader decrements nextIndex and retries the AppendEntries RPC. |
| the follower's log is consistent with the leader's | after AppendEntries succeeds | [1] §5.3
Once AppendEntries succeeds, the follower’s log is consistent with the leader’s, and it will remain that way for the rest of the term. |
| delete an existing entry that conflicts with a new one | receiver step 3 | [1] Figure 2
If an existing entry conflicts with a new one (same index but different terms), delete the existing entry and all that follow it (§5.3) |
| six possible follower logs | Figure 7 | [1] Figure 7
When the leader at the top comes to power, it is possible that any of scenarios (a–f) could occur in follower logs. |
| followers duplicate the leader’s log | the leader forces the logs | [1] §5.3
In Raft, the leader handles inconsistencies by forcing the followers’ logs to duplicate its own. |
| just after the leader’s last entry (11 in Figure 7) | nextIndex at election | [1] §5.3
it initializes all nextIndex values to the index just after the last one in its log (11 in Figure 7). |
| optional; the authors doubt it is needed | skipping a term at a time | [1] §5.3
In practice, we doubt this optimization is necessary, since failures happen infrequently and it is unlikely that there will be many inconsistent entries. |
| a leader only appends | Leader Append-Only | [1] Figure 3
Leader Append-Only: a leader never overwrites or deletes entries in its log; it only appends new entries. |
| a leader can be elected without all committed entries | Viewstamped Replication | [1] §5.4.1
In some consensus algorithms, such as Viewstamped Replication [22], a leader can be elected even if it doesn’t initially contain all of the committed entries. |
| a voter denies a less up-to-date candidate | the election restriction | [1] §5.4.1
The RequestVote RPC implements this restriction: the RPC includes information about the candidate’s log, and the voter denies its vote if its own log is more up-to-date than that of the candidate. |
| later last term wins, then longer | which log is more up-to-date | [1] §5.4.1
If the logs have last entries with different terms, then the log with the later term is more up-to-date. If the logs end with the same term, then whichever log is longer is more up-to-date. |
| never committed by counting replicas | old-term entries | [1] §5.4.2
Raft never commits log entries from previous terms by counting replicas. |
| a current-term entry on a majority commits | Figure 8 (e) | [1] Figure 8
However, if S1 replicates an entry from its current term on a majority of the servers before crashing, as in (e), then this entry is committed (S5 cannot win an election). |
| more conservative than necessary, for simplicity | the commit rule | [1] §5.4.2
There are some situations where a leader could safely conclude that an older log entry is committed (for example, if that entry is stored on every server), but Raft takes a more conservative approach for simplicity. |
| unlike other algorithms | old entries keep their term numbers | [1] §5.4.2
Raft incurs this extra complexity in the commitment rules because log entries retain their original term numbers when a leader replicates entries from previous terms. |
| same index and term means identical prefix | Log Matching | [1] Figure 3
Log Matching: if two logs contain an entry with the same index and term, then the logs are identical in all entries up through the given index. |
| committed entries are in every later leader | Leader Completeness | [1] Figure 3
Leader Completeness: if a log entry is committed in a given term, then that entry will be present in the logs of the leaders for all higher-numbered terms. |
| no two servers apply different entries at one index | State Machine Safety | [1] Figure 3
State Machine Safety: if a server has applied a log entry at a given index to its state machine, no other server will ever apply a different log entry for the same index. |
| at least one voter both accepted the entry and voted for the later leader | the Leader Completeness argument | [1] §5.4.3
leaderU received votes from a majority of the cluster. Thus, at least one server (“the voter”) |
| safety properties formally specified and proven | the introduction | [1] Abstract
its safety properties have been formally specified and proven |
| one property, with unchecked invariants | the mechanical proof | [1] §9.2
We have mechanically proven the Log Completeness Property using the TLA proof system [7]. However, this proof relies on invariants that have not been mechanically checked (for example, we have not proven the type safety of the specification). |
| about 400 lines | the TLA+ specification | [1] §9.2
It is about 400 lines long and serves as the subject of the proof. |
| average time to send RPCs to every server in parallel and receive the responses | broadcastTime | [1] §5.6
broadcastTime is the average time it takes a server to send RPCs in parallel to every server in the cluster and receive their responses |
| an order of magnitude | broadcast against timeout | [1] §5.6
The broadcast time should be an order of magnitude less than the election timeout so that leaders can reliably send the heartbeat messages required to keep followers from starting elections |
| 0.5 ms to 20 ms | broadcast time | [1] §5.6
so the broadcast time may range from 0.5ms to 20ms, depending on storage technology. |
| 10 ms to 500 ms | the election timeout | [1] §5.6
As a result, the election timeout is likely to be somewhere between 10ms and 500ms. |
| several months or more | server MTBF | [1] §5.6
server MTBFs are several months or more, which easily satisfies the timing requirement. |
| a few orders of magnitude | the election timeout against MTBF | [1] §5.6
The election timeout should be a few orders of magnitude less than MTBF so that the system makes steady progress. |
| unavailable for roughly the election timeout | after a leader crash | [1] §5.6
When the leader crashes, the system will be unavailable for roughly the election timeout |
| unsafe | switching configurations directly | [1] §6
any approach where servers switch directly from the old configuration to the new configuration is unsafe. |
| two independent majorities | direct switch | [1] §6
It isn’t possible to atomically switch all of the servers at once, so the cluster can potentially split into two independent majorities during the transition (see Figure 10). |
| a transitional configuration | joint consensus | [1] §6
In Raft the cluster first switches to a transitional configuration we call joint consensus; once the joint consensus has been committed, the system then transitions to the new configuration. |
| separate majorities from both configurations | agreement under joint consensus | [1] §6
Agreement (for elections and entry commitment) requires separate majorities from both the old and new configurations. |
| join as non-voting members first | new servers | [1] §6
Raft introduces an additional phase before the configuration change, in which the new servers join the cluster as non-voting members |
| steps down once C_new is committed | a leader not in the new configuration | [1] §6
In this case, the leader steps down (returns to follower state) once it has committed the Cnew log entry. |
| can disrupt the cluster | removed servers | [1] §6
These servers will not receive heartbeats, so they will time out and start new elections. |
| ignore RequestVote within the minimum election timeout of a leader | the remedy | [1] §6
Specifically, if a server receives a RequestVote RPC within the minimum election timeout of hearing from a current leader, it does not update its term or grant its vote. |
| the latest in its log, committed or not | which configuration a server uses | [1] §6
a server always uses the latest configuration in its log, regardless of whether the entry is committed |
| the first approach the authors came up with | joint consensus | [4] ch. Cluster membership changes
This was the first approach to membership changes that we came up with, and it is described only for completeness. |
| one server at a time | the dissertation's membership change | [4] ch. Cluster membership changes
Thus, Raft restricts the types of changes that are allowed: only one server can be added or removed from the cluster at a time. |
| any old majority overlaps any new majority | a single-server change | [4] ch. Cluster membership changes
When adding a single server to a cluster or removing a single server from a cluster, any majority of the old cluster overlaps with any majority of the new cluster |
| no longer recommended | joint consensus | [4] ch. Cluster membership changes
Now that we know about the simpler single-server approach, we recommend that one instead, since handling arbitrary changes requires extra complexity. |
| still used the complex approach | the authors' own implementation | [4] ch. Cluster membership changes
it still uses the more complex approach at the time of this writing. |
| snapshotting is the simplest approach | compaction | [1] §7
Snapshotting is the simplest approach to compaction. |
| each server, independently | who snapshots | [1] §7
Each server takes snapshots independently, covering just the committed entries in its log. |
| last included index and term | what a snapshot records | [1] §7
Raft also includes a small amount of metadata in the snapshot: the last included index is the index of the last entry in the log that the snapshot replaces (the last entry the state machine had applied), and the last included term is the term of this entry. |
| is sent a snapshot | a lagging follower | [1] §7
The leader uses a new RPC called InstallSnapshot to send snapshots to followers that are too far behind; see Figure 13. |
| later entries are kept | a snapshot that describes a prefix of the log | [1] §7
If instead the follower receives a snapshot that describes a prefix of its log (due to retransmission or by mistake), then log entries covered by the snapshot are deleted but entries following the snapshot are still valid and must be retained. |
| departs from the strong leader principle | snapshotting | [1] §7
This snapshotting approach departs from Raft’s strong leader principle, since followers can take snapshots without the knowledge of the leader. |
| log cleaning and log-structured merge trees | incremental compaction | [1] §7
Incremental approaches to compaction, such as log cleaning [36] and log-structured merge trees [30, 5], are also possible. |
| connects to a randomly chosen server | a client starting up | [1] §8
that server will reject the client’s request and supply information about the most recent leader it has heard from |
| retried indefinitely; RPCs are idempotent | follower and candidate crashes | [1] §5.5
Raft handles these failures by retrying indefinitely; if the crashed server restarts, then the RPC will complete successfully. |
| idempotent | AppendEntries | [1] §5.5
Raft RPCs are idempotent, so this causes no harm. |
| suppressed with serial numbers | duplicate commands | [1] §8
The solution is for clients to assign unique serial numbers to every command. |
| lets the leader learn its commit index | the no-op | [4] ch. Client interaction
To find out, it needs to commit an entry from its term. Raft handles this by having each leader commit a blank no-op entry into the log at the start of its term. |
| needs a heartbeat round with a majority | a read-only request | [1] §8
Raft handles this by having the leader exchange heartbeat messages with a majority of the cluster before responding to read-only requests. |
| rely on timing for safety | lease reads | [1] §8
but this would rely on timing for safety (it assumes bounded clock skew). |
| 43 students at two universities | the user study | [1] Abstract
A user study with 43 students at two universities shows that Raft is significantly easier to understand than Paxos |
| Raft 25.7, Paxos 20.8, out of 60 | quiz scores | [1] §9.1
On average, participants scored 4.9 points higher on the Raft quiz than on the Paxos quiz (out of a possible 60 points, the mean Raft score was 25.7 and the mean Paxos score was 20.8) |
| 33 of 43 | participants who scored higher on Raft | [1] Figure 14
Points above the diagonal (33) represent participants who scored higher for Raft. |
| at least 2.5 points larger, at 95% confidence | the paired t-test | [1] §9.1
A paired t-test states that, with 95% confidence, the true distribution of Raft scores has a mean at least 2.5 points larger than the true distribution of Paxos scores. |
| 15 of 43 had Paxos experience; the Paxos video was 14% longer | prior experience | [1] §9.1
The experiment favored Paxos in two ways: 15 of the 43 participants reported having some prior experience with Paxos, and the Paxos video is 14% longer than the Raft video. |
| 33 of 41 | self-reported ease | [1] §9.1
An overwhelming majority of participants reported Raft would be easier to implement and explain (33 of 41 for each question). |
| exceptionally difficult to understand | the complaint about Paxos | [1] §3
The first drawback is that Paxos is exceptionally difficult to understand. |
| almost a year | understanding Paxos | [1] §3
a process that took almost a year |
| election, replication, safety | decomposition | [1] §1
including decomposition (Raft separates leader election, log replication, and safety) |
| a single round-trip from the leader to half the cluster | replicating a new entry | [1] §9.3
Raft achieves this using the minimal number of messages (a single round-trip from the leader to half the cluster). |
| lower latency than Raft in WAN settings | EPaxos | [1] §10
However, if commands that are proposed concurrently do not commute with each other, EPaxos requires an additional round of communication. |
| Raft 4; VR and ZooKeeper 10 each | message types | [1] §10
VR and ZooKeeper each define 10 different message types, while Raft has only 4 message types (two RPC requests and their responses). |
| roughly 2000 lines of C++ | the implementation | [1] §9
The Raft implementation contains roughly 2000 lines of C++ code, not including tests, comments, or blank lines. |
| longer than 10 seconds | with no randomness | [1] §9.3
In the absence of randomness, leader election consistently took longer than 10 seconds in our tests due to many split votes. |
| median downtime 287 ms | with 5 ms of randomness | [1] §9.3
Adding just 5ms of randomness helps significantly, resulting in a median downtime of 287ms. |
| worst case 513 ms over 1000 trials | with 50 ms of randomness | [1] §9.3
with 50ms of randomness the worst-case completion time (over 1000 trials) was 513ms. |
| 35 ms on average, longest 152 ms | with 12–24 ms timeouts | [1] §9.3
With an election timeout of 12–24ms, it takes only 35ms on average to elect a leader (the longest trial took 152ms). |
| repeatedly crash the leader of five servers | the leader-election benchmark | [1] §9.3
To measure leader election, we repeatedly crashed the leader of a cluster of five servers and timed how long it took to detect the crash and elect a new leader (see Figure 16). |
| timers start together | the synchronized heartbeat | [1] §9.3
Furthermore, to encourage split votes, our test script triggered a synchronized broadcast of heartbeat RPCs from the leader before terminating its process |
| uniform within the heartbeat interval, half the minimum timeout | the crash | [1] §9.3
The leader was crashed uniformly randomly within its heartbeat interval, which was half of the minimum election timeout for all tests. |
| different log lengths and a synchronized heartbeat | the worst case they built | [1] §9.3
To generate a worst-case scenario, the servers in each trial had different log lengths, so some candidates were not eligible to become leader. |
| 1000 trials per line; broadcast time roughly 15 ms | Figure 16, trials and broadcast time | [1] Figure 16
The measurements were taken on a cluster of five servers with a broadcast time of roughly 15ms. |
| 1000 (100 for 150–150 ms) | Figure 16, trials per line | [1] Figure 16
Each line represents 1000 trials (except for 100 trials for “150–150ms”) |
| 35 ms on average | a LAN with aggressive timeouts | [4] ch. Leader election evaluation
In a real-world LAN, our system was able to elect a leader in an average of 35ms when configured with aggressive timeouts, though we suggest using a more conservative timeout range in practice. |
| essentially memoryless | each term | [4] §How fast will Raft elect a leader when split votes are possible?
In other words, each election term is essentially memoryless |
| geometric, mean 1/(1 − split rate) | terms to elect | [4] ch. Leader election evaluation
The number of election terms required to elect a leader follows a geometric distribution |
| about 3–8 times the network latency, depending on the cluster | the knee | [4] §How fast will Raft elect a leader when split votes are possible?
Once timeout ranges are sufficiently large (about 3–8 times the network latency, depending on the cluster), the curves become linear with a slight upward slope |
| 10–20 times the one-way latency, split rates under 40% | the recommended range | [4] ch. Leader election evaluation
We recommend a range that is 10–20 times the one-way network latency, which keeps split votes rates under 40% in all cases for reasonably sized clusters, and typically results in much lower rates. |
| about one third of the way into the timeout range | with no split vote | [4] ch. Leader election evaluation
When no split vote occurs, elections complete about one third of the way into the election timeout range, on average. |
| a conservative setting is probably best | configuring the timeout | [4] §How fast will Raft elect a leader when split votes are possible?
The graphs provide insight into how to configure election timeouts: a conservative setting is probably best in practice. |
| a range ten times the one-way latency | the dissertation’s advice | [4] §How fast will Raft elect a leader when split votes are possible?
Thus, we recommend using a timeout range that is ten times the one-way network latency |
| elections typically within half a second, 99.9% within 3 seconds | a simulated WAN | [4] ch. Leader election evaluation
On a simulated WAN spanning the US, elections typically complete in half a second, and 99.9% of elections complete in 3 seconds, even when two of five servers have failed. |
| expected 1/(s+1) of the way through the range | the first timeout among s servers | [4] §How fast will Raft elect a leader with no split votes?
For example, with four available servers, the first timeout is expected to occur |
| about 0.06% | split rate, n=5, s=4, 1 ms of 100 ms | [4] §How common are split votes?
In about 0.06% of elections, if the one-way network latency is 1ms |
| about 5.2% | split rate, n=5, s=4, 10 ms of 100 ms | [4] §How common are split votes?
In about 5.2% of elections, if the one-way network latency is 10ms |
| about 18.1% | split rate, n=5, s=4, 20 ms of 100 ms | [4] §How common are split votes?
In about 18.1% of elections, if the one-way network latency is 20ms |
| about half | five servers, two failed, l = 0.2 | [4] §How common are split votes?
a five-server cluster with two failures and $l=0.2$ will see about half of elections end in split votes. |
| nearly 70% | nine servers, four failed, l = 0.2 | [4] §How common are split votes?
However, when it is down to its bare majority with four failures, the nine-server cluster will experience a nearly 70% split vote rate. |
| 10000 runs per point | the dissertation’s simulation | [4] §How common are split votes?
After 10000 runs, the fraction of split votes was calculated. |
| broadcastTime ≪ electionTimeout ≪ MTBF | the timing requirement | [1] §5.6
broadcastTime ≪ electionTimeout ≪ MTBF |
| violate the timing requirement | timeouts below that | [1] §9.3
However, lowering the timeouts beyond this point violates Raft’s timing requirement: leaders have difficulty broadcasting heartbeats before other servers start new elections. |
| 150–300 ms | the recommendation | [1] §9.3
We recommend using a conservative election timeout such as 150–300ms; such timeouts are unlikely to cause unnecessary leader changes and will still provide good availability. |
| low timeout and high heartbeat interval encourage leader changes | testing advice | [4] ch. Correctness
setting the election timeout very low and the heartbeat interval very high will result in more leader changes. |
| a candidate increments its term only after a majority says it would vote | Pre-Vote | [4] §Preventing disruptions when a server rejoins the cluster
a candidate only increments its term if it first learns from a majority of the cluster that they would be willing to grant the candidate their votes |
| does not appear to significantly harm it | Pre-Vote and election performance | [4] §Preventing disruptions when a server rejoins the cluster
it does not appear to significantly harm election performance. |
| asymmetric networks, packet loss, clock drift | questions the dissertation leaves | [4] §Conclusion of the leader election chapter
How does leader election perform in asymmetric networks, where each link has a different latency? |