Git Product home page Git Product logo

nuraft's Introduction

NuRaft

build codecov

Raft implementation derived from the cornerstone project, which is a very lightweight C++ implementation with minimum dependencies, originally written by Andy Chen.

New features that are not described in the original paper, but required for the real-world use cases in eBay, have been added. We believe those features are useful for others outside eBay as well.

Features

In the original cornerstone

  • Core Raft algorithm
    • Log replication & compaction
    • Leader election
    • Snapshot
    • Dynamic membership & configuration change
  • Group commit & pipelined write
  • User-defined log store & state machine support

New features added in this project

How to Build

1. Install cmake and openssl:

  • Ubuntu
$ sudo apt-get install cmake openssl libssl-dev libz-dev
  • OSX
$ brew install cmake
$ brew install openssl
  • Windows
    • Download and install CMake.
    • Currently, we do not support SSL for Windows.

2. Fetch Asio library:

  • Linux & OSX
$ ./prepare.sh
  • Windows
    • Clone Asio into the project directory.

3. Build static library, tests, and examples:

  • Linux & OSX
$ mkdir build
$ cd build
build$ cmake ../
build$ make

Run unit tests

build$ ./runtests.sh
  • Windows:
C:\NuRaft> mkdir build
C:\NuRaft> cd build
C:\NuRaft\build> cmake -G "NMake Makefiles" ..\
C:\NuRaft\build> nmake

You may need to run vcvars script first in your build directory. For example (it depends on how you installed MSVC):

C:\NuRaft\build> c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat

How to Use

Please refer to this document.

Example Implementation

Please refer to examples.

Benchmark

Please refer to tests/bench.

Quick Benchmark Results

Supported Platforms

  • Ubuntu (tested on 14.04, 16.04, and 18.04)
  • Centos (tested on 7)
  • OSX (tested on 10.13 and 10.14)
  • Windows (built using MSVC 2019, not thoroughly tested)

Contributing to This Project

We welcome contributions. If you find any bugs, potential flaws and edge cases, improvements, new feature suggestions or discussions, please submit issues or pull requests.

Contact

License Information

Copyright 2017-2019 eBay Inc.

Author/Developer: Jung-Sang Ahn

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

3rd Party Code

  1. URL: https://github.com/datatechnology/cornerstone
    License: https://github.com/datatechnology/cornerstone/blob/master/LICENSE
    Originally licensed under the Apache 2.0 license.

  2. URL: https://github.com/stbrumme/crc32
    Original Copyright 2011-2016 Stephan Brumme
    See Original ZLib License: https://github.com/stbrumme/crc32/blob/master/LICENSE

  3. URL: https://github.com/greensky00/simple_logger
    License: https://github.com/greensky00/simple_logger/blob/master/LICENSE
    Originally licensed under the MIT license.

  4. URL: https://github.com/greensky00/testsuite
    License: https://github.com/greensky00/testsuite/blob/master/LICENSE
    Originally licensed under the MIT license.

  5. URL: https://github.com/greensky00/latency-collector
    License: https://github.com/greensky00/latency-collector/blob/master/LICENSE
    Originally licensed under the MIT license.

  6. URL: https://github.com/eriwen/lcov-to-cobertura-xml/blob/master/lcov_cobertura/lcov_cobertura.py
    License: https://github.com/eriwen/lcov-to-cobertura-xml/blob/master/LICENSE
    Copyright 2011-2012 Eric Wendelin
    Originally licensed under the Apache 2.0 license.

  7. URL: https://github.com/bilke/cmake-modules
    License: https://github.com/bilke/cmake-modules/blob/master/LICENSE_1_0.txt
    Copyright 2012-2017 Lars Bilke
    Originally licensed under the BSD license.

nuraft's People

Contributors

greensky00 avatar yong-li avatar shigui1989 avatar sheepgrass avatar fletcherj1 avatar anurag870 avatar haoch avatar kexianda avatar yfinkelstein avatar alesapin avatar leic-ss avatar songenjie avatar woonhak avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.