The Raft Consensus Algorithm and
Implementing Raft in C++

Diego Ongaro, August 2015


  • Started as research platform for Raft at Stanford
  • Developed into production system at Scale Computing
  • Network service running Raft replicated state machine
  • Data model: hierarchical key-value store
  • Written in gcc 4.4's C++0x (Rust was pre-0.1)

How Is Consensus Used?

Top-level system configuration

Replicate entire database state

Paxos Protocol

  • Leslie Lamport, 1989
  • Nearly synonymous with consensus
“The dirty little secret of the NSDI community is that at most five people really, truly understand every part of Paxos ;-).”
—NSDI reviewer
There are significant gaps between the description of the Paxos algorithm and the needs of a real-world system...the final system will be based on an unproven protocol.
—Chubby authors

Raft's Design for Understandability

We wanted an algorithm optimized for building real systems

  • Must be correct, complete, and perform well
  • Must also be understandable

“What would be easier to understand or explain?”

  • Fundamentally different decomposition than Paxos
  • Less complexity in state space
  • Less mechanism

Raft User Study

Raft Implementations

Name Primary Authors Language License
etcd/raft Blake Mizerany, Xiang Li and Yicheng Qin (CoreOS) Go Apache 2.0
go-raft Ben Johnson (Sky) and Xiang Li (CMU, CoreOS) Go MIT
hashicorp/raft Armon Dadgar (hashicorp) Go MPL-2.0
copycat Jordan Halterman Java Apache2
LogCabin Diego Ongaro (Stanford, Scale Computing) C++ ISC
akka-raft Konrad Malawski Scala Apache2
kanaka/raft.js Joel Martin Javascript MPL-2.0
rafter Andrew Stone (Basho) Erlang Apache2
OpenDaylight Moiz Raja, Kamal Rameshan, Robert Varga (Cisco), Tom Pantelis (Brocade) Java Eclipse
liferaft Arnout Kazemier Javascript MIT
skiff Pedro Teixeira Javascript ISC
ckite Pablo Medina Scala Apache2
willemt/raft Willem-Hendrik Thiart C BSD

Copied from Raft website, probably stale.