Keyun Cheng

In Search of an Understandable Consensus Algorithm (RAFT)

Download

ATC, 2014

Summary

This paper presents Raft, a simpler and more understandable consensus algorithm. Previously dominant Paxos protocol which is commonly taught has significant drawbacks: too difficult to understand and not able to provide a good foundation to build pratical implementations. Raft applied specific techniques to improve understandability including decomposition and state space reduction, and it has several novel features: strong leader, leader election and membership changes.

Details

Paxos Drawbacks

Raft consensus Algorithm

Recommend: a commic about Raft.

Motivation

  1. Problem decomposition

  2. Simpify state spaces and eliminate nondeterministim

Basics

Raft guarantee several properties

Roles

Operations

RPC: RequestVotes(Candidate), AppendEntries(Leader)

Leader Election

  1. All server starts as followers

  2. No communication from leader: election timeout, begin election.

  3. A candidate wins with majority votes.

  4. For the case that no candidate wins: Raft use randomized election timeouts to ensure that split votes are rare (the probability to happen for the second time) and resolved quickly.

Log replication

  1. Client request command

  2. Leader append to its own log (new entry)

  3. Leader issues AppendEntries to all Followers

  4. Only if it’s safe (the majority of Followers respond and safely replicated), Leader apply the entry to state machine, return result to client

A lot of details in maintaining Leader and Followers log consistency (consistency check for missing entries).

Safety issues

  1. Election restriction

  2. Committing entries from previous terms

Strength

Adiditional to its completeness as a protocol with guarantee on safety, consistency, it’s

  1. Understandable

  2. More applicable for implementation

Weakness

  1. Single Leader configuration may be a bottleneck for large scale system, unable for load balance

  2. Fixed way of communication

  3. For the case that all candidates split votes, it may be a problem that the randomness causes latency (though finally one candidate will win the election).