« All posts

OpenRaft: An async Rust Raft crate with key protocol improvements

OpenRaft brings generalized membership changes, low-conflict elections, and high-throughput batching to async Rust Raft consensus.

OpenRaft is a Rust implementation of the Raft consensus protocol, derived from async-raft, aimed at powering distributed storage systems (SQL, NoSQL, KV, streaming, graph). It already serves as the consensus engine for Databend's meta-service cluster and diverges from textbook Raft with generalized joint membership changes and a redesigned Vote scheme that reduces election conflicts.

Built as event-driven rather than tick-based, OpenRaft batches messages to hit 33,000 writes/sec for a single writer and 5,615,000 writes/sec with batching in framework benchmarks. Storage, networking, and core types (node ID, term, vote, log entry) are fully pluggable via RaftTypeConfig, and the crate supports multiple async runtimes—tokio, compio, monoio—plus a single-threaded mode.

The 0.10 release line is currently in alpha, and the API remains unstable pre-1.0.0, with breaking changes tracked via a structured changelog. Correctness is checked through a turmoil-based simulation fuzzer that verifies Raft invariants against the paper and TLA+ spec after every tick, backed by 92% unit test coverage. Adopters include CnosDB, RobustMQ, RocketMQ-rust, and Hiqlite.