This project intends to improve raft as the next-generation consensus protocol for distributed data storage systems (SQL, NoSQL, KV, Streaming, Graph ... or maybe something more exotic).
Currently, openraft is the consensus engine of meta-service cluster in databend.
🚀 Get started:
💡 Example Applications:
0.10.0-alpha.36 (alpha) on crates.io/openraft;🙌 Questions? Ask on Discord, in a GitHub discussion, in our Feishu group, or on WeChat: drmingdrmer.
OpenRaft is derived from async-raft with several bugs fixed: Fixed bugs.
main: network partition, process pause, process kill, slow packets, flaky packets, clock skew, membership churn, and all of them combined.OpenRaft API is not stable yet. Before 1.0.0, an upgrade may contain incompatible changes. Check our change-log. A commit message starts with a keyword to indicate the modification type of the commit:
data-change: on-disk data types changes, which may require manual upgrade.change: if it introduces incompatible changes.feat: if it introduces compatible non-breaking new features.fix: if it just fixes a bug.Branch main has been under active development. The main branch is for the release-0.10. Latest alpha on crates.io: v0.10.0-alpha.36. The 0.10 line is in alpha — the API may still change before the final 0.10.0 release. Upgrade guide: ⬆️ 0.9 to 0.10.
Branch release-0.9: Latest: ( v0.9.25 | Change log ); Upgrade guide: ⬆️ 0.8 to 0.9; release-0.9 Won't accept new features but only bug fixes.
Branches release-0.8, release-0.7 and release-0.6 are closed; their upgrade guides stay published.
Config::enable_pre_vote; See: design discussion.The benchmark is focused on the OpenRaft framework itself and is run on a minimized store and network. This is NOT a real world application benchmark!!!
Single writes:
| clients | put/s |
|---|---|
| 4096 | 3,548,000 |
| 1024 | 3,006,000 |
| 256 | 1,808,000 |
| 64 | 912,000 |
| 1 | 33,000 |
Batch writes (4 entries per batch):
| clients | put/s |
|---|---|
| 4096 | 5,615,000 |
For benchmark detail, go to the ./benchmarks/minimal folder.
What sets OpenRaft apart from a standard Raft implementation:
RaftLogStorage, RaftStateMachine), networking (RaftNetworkV2, including application-defined snapshot transport), and every core type — node ID, node, term, vote, log entry — via RaftTypeConfig.AsyncRuntime trait, and a single-threaded mode that removes Send bounds.Trigger::elect()).Trigger::transfer_leader().Config::enable_pre_vote; it runs as a dedicated RPC, see Pre-Vote protocol.add_learner().Trigger::snapshot()).ensure_linearizable().Raft::metrics(), Raft::data_metrics(), and Raft::server_metrics().append_membership() writes a caller-built membership, without joint config. It accepts only a restricted set of transitions.RuntimeConfigHandle::heartbeat() / RuntimeConfigHandle::elect().Trigger::snapshot() / Trigger::elect().Trigger::purge_log().📣 Using openraft in your project? We'd love to feature it here — open an issue to let us know, or skip the wait and submit a pull request directly.
Check out the CONTRIBUTING.md guide for more details on getting started with contributing to this project.
Thanks to everyone who contributes to OpenRaft:
OpenRaft is licensed under the terms of the MIT License or the Apache License 2.0, at your choosing.