OpenRaft

Advanced Raft consensus in Rust, on any async runtime

Library
Cargo
v0.10.0-alpha.34
2,026stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
93/100Excellent
Development Activity100
Maintenance96
Community76
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
84/100Excellent
Architecture90
Code Quality88
Innovation86
Learning Curve62

OpenRaft is an advanced implementation of the Raft consensus protocol for Rust, designed to be the replication and consensus engine behind distributed data stores — SQL, NoSQL, key-value, streaming, and graph systems. It is derived from async-raft with numerous bug fixes and is the consensus engine of the meta-service cluster in Databend.

OpenRaft runs on any async runtime (Tokio, monoio, compio) and gives applications the building blocks for leader election, log replication, membership changes, and snapshotting, so they can turn a single-node state machine into a fault-tolerant, strongly-consistent cluster.

What You Get

  • A complete Raft implementation with leader election, log replication, and membership changes
  • Runtime-agnostic design that works on Tokio, monoio, compio, or a custom async runtime
  • Pluggable storage and network traits so you control persistence and transport
  • Snapshotting and log compaction support for long-running clusters
  • Rich metrics and an extensive guide, FAQ, and example applications

Common Use Cases

  • Building a fault-tolerant, strongly-consistent distributed key-value or metadata store
  • Adding replicated consensus to a database or streaming system’s control plane
  • Coordinating cluster membership and leader election across nodes
  • Replicating a state machine so it survives node failures

Under The Hood

Architecture — OpenRaft is a large Cargo workspace: the core openraft/ crate implements the Raft state machine (election, replication, membership joint-consensus, snapshots), while runtime is abstracted behind rt/ with concrete adapters rt-tokio/, rt-monoio/, and rt-compio/. Applications implement storage and network traits (see stores/ and examples/) that OpenRaft drives; macros/, metrics-otel/, and multiraft/ provide code generation, observability, and multi-group support. Correctness is stressed via jepsen/, tests-turmoil/, and dedicated tests/.

Tech Stack — Rust (edition 2024) built on futures with pluggable async runtimes, using derive_more, anyerror/anyhow for errors, chrono for time, clap for example CLIs, and base2histogram for metrics. Distributed as an alpha 0.10 line with per-runtime feature crates.

Code Quality — The project reports ~92% unit-test coverage, runs Jepsen and turmoil deterministic simulation tests, and maintains extensive guides, an FAQ, and a change log. It is battle-tested as the consensus engine inside Databend, reflecting strong engineering rigor.

API Design — The public API is trait-driven: you implement log store, state machine, and network traits, then interact through a Raft handle. This is powerful and flexible but has a steeper learning curve than a typical library, which the project offsets with a getting-started guide, DeepWiki docs, and runnable examples.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search