https://github.com/google-parfait/raft-rs

Raft distributed consensus algorithm implemented in Rust.

https://github.com/google-parfait/raft-rs

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.3%) to scientific vocabulary

Keywords from Contributors

argument-parser azblob gcs binding data-structures olap version
Last synced: 6 months ago · JSON representation

Repository

Raft distributed consensus algorithm implemented in Rust.

Basic Info
  • Host: GitHub
  • Owner: google-parfait
  • License: apache-2.0
  • Language: Rust
  • Default Branch: master
  • Homepage:
  • Size: 2.51 MB
Statistics
  • Stars: 11
  • Watchers: 1
  • Forks: 3
  • Open Issues: 0
  • Releases: 0
Created over 2 years ago · Last pushed about 2 years ago
Metadata Files
Readme Changelog Contributing License Code of conduct

README.md

Raft

Build Status Documentation Crates.io dependency status

Problem and Importance

When building a distributed system one principal goal is often to build in fault-tolerance. That is, if one particular node in a network goes down, or if there is a network partition, the entire cluster does not fall over. The cluster of nodes taking part in a distributed consensus protocol must come to agreement regarding values, and once that decision is reached, that choice is final.

Distributed Consensus Algorithms often take the form of a replicated state machine and log. Each state machine accepts inputs from its log, and represents the value(s) to be replicated, for example, a hash table. They allow a collection of machines to work as a coherent group that can survive the failures of some of its members.

Two well known Distributed Consensus Algorithms are Paxos and Raft. Paxos is used in systems like Chubby by Google, and Raft is used in things like tikv or etcd. Raft is generally seen as a more understandable and simpler to implement than Paxos.

Design

Raft replicates the state machine through logs. If you can ensure that all the machines have the same sequence of logs, after applying all logs in order, the state machine will reach a consistent state.

A complete Raft model contains 4 essential parts:

  1. Consensus Module, the core consensus algorithm module;

  2. Log, the place to keep the Raft logs;

  3. State Machine, the place to save the user data;

  4. Transport, the network layer for communication.

The design of the Raft crate

Note: This Raft implementation in Rust includes the core Consensus Module only, not the other parts. The core Consensus Module in the Raft crate is customizable, flexible, and resilient. You can directly use the Raft crate, but you will need to build your own Log, State Machine and Transport components.

Using the raft crate

You can use raft with either rust-protobuf or Prost to encode/decode gRPC messages. We use rust-protobuf by default. To use Prost, build (or depend on) Raft using the prost-codec feature and without default features.

Developing the Raft crate

Raft is built using the latest version of stable Rust, using the 2018 edition. Minimum supported version is 1.44.0.

Using rustup you can get started this way:

bash rustup component add clippy rustup component add rustfmt

In order to have your PR merged running the following must finish without error:

bash cargo test --all && \ cargo clippy --all --all-targets -- -D clippy::all && \ cargo fmt --all -- --check

You may optionally want to install cargo-watch to allow for automated rebuilding while editing:

bash cargo watch -s "cargo check"

Modifying Protobufs

See instructions in the proto subdirectory.

Benchmarks

We use Criterion for benchmarking.

It's currently an ongoing effort to build an appropriate benchmarking suite. If you'd like to help out please let us know! Interested?

You can run the benchmarks by installing gnuplot then running:

bash cargo bench

You can check target/criterion/report/index.html for plots and charts relating to the benchmarks.

You can check the performance between two branches:

bash git checkout master cargo bench --bench benches -- --save-baseline master git checkout other cargo bench --bench benches -- --baseline master

This will report relative increases or decreased for each benchmark.

Acknowledgments

Thanks etcd for providing the amazing Go implementation!

Projects using the Raft crate

  • TiKV, a distributed transactional key value database powered by Rust and Raft.

Links for Further Research

Owner

  • Name: Parfait
  • Login: google-parfait
  • Kind: organization

Private aggregation & retrieval, federated, analytics, inference, & training from Google.

GitHub Events

Total
  • Watch event: 8
  • Fork event: 2
Last Year
  • Watch event: 8
  • Fork event: 2

Committers

Last synced: 6 months ago

All Time
  • Total Commits: 528
  • Total Committers: 83
  • Avg Commits per committer: 6.361
  • Development Distribution Score (DDS): 0.822
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Jay Lee b****e@g****m 94
ngaut n****t@1****m 57
Jay B****y@u****m 55
Hoverbear o****r@h****g 37
siddontang s****g@g****m 34
A. Hobden a****w@h****g 33
qupeng q****g@p****m 18
Dylan Wen h****2@g****m 15
Nick Cameron n****c@n****g 11
Tesla Ice Zhang‮ i****n@f****m 10
Hetian Zhu f****5@g****m 9
goroutine n****t@u****m 9
csmoe 3****e@u****m 8
qupeng o****g@g****m 8
july2993 j****3@g****m 7
disksing i@d****m 7
Liqi Geng g****i@g****m 6
tiancaiamao 3****3@q****m 6
Zhijie Zhan j****1@g****m 6
Zhijie Zhan b****7@g****m 5
tison w****6@g****m 4
zhangjinpeng1987 z****g@p****m 4
Shuai Li l****u@g****m 4
Arnaud Gourlay a****y@g****m 3
Connor z****9@g****m 3
Dzmitry Huba h****a@g****m 3
Ivan.Yang m****j@u****m 3
Neil Shen o****s@g****m 3
Pratyush Singhal p****0@g****m 3
renhongdi r****i@m****m 3
and 53 more...

Issues and Pull Requests

Last synced: 8 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/ci.yml actions
  • actions/checkout v2 composite
Cargo.toml cargo
  • anyhow 1.0.40 development
  • criterion 0.3 development
  • datadriven 0.1.0 development
  • itertools 0.10.0 development
  • regex 1 development
  • slog-async 2.3.0 development
  • slog-envlogger 2.1.0 development
  • slog-stdlog 4 development
  • slog-term 2.4.0 development
  • ahash 0.8.3
  • bytes 1
  • fail 0.4
  • fxhash 0.2.1
  • getrandom 0.2.10
  • getset 0.1.1
  • hashbrown 0.14.0
  • prost 0.11
  • protobuf 2
  • raft-proto 0.7.0
  • rand 0.8
  • slog 2.2
  • slog-envlogger 2.1.0
  • slog-stdlog 4
  • slog-term 2.4.0
  • spin 0.9.8
  • thiserror 1.0
datadriven/Cargo.toml cargo
harness/Cargo.toml cargo
  • criterion 0.3 development
  • fxhash 0.2.1 development
  • lazy_static 1 development
  • protobuf 2 development
  • regex 1 development
  • fail 0.4
  • rand 0.8
  • slog 2.2
proto/Cargo.toml cargo