Giter Site home page Giter Site logo

raft-kv's Introduction

raft-kv

A C++ implementation of RAFT consensus algorithm based on asio. It provides a key-value store compatible with the redis protocol.

Getting Started

Build

git clone https://github.com/jinyyu/raft-kv.git
mkdir -p raft-kv/build
cd raft-kv/build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j8

Running a cluster

First install goreman, which manages Procfile-based applications.

goreman start

Test

install redis-cli, a redis console client.

redis-cli -p 63791
127.0.0.1:63791> set mykey myvalue
OK
127.0.0.1:63791> get mykey
"myvalue"

remove a node and replace the myvalue with "new-value" to check cluster availability:

goreman run stop node2
redis-cli -p 63791
127.0.0.1:63791> set mykey new-value
OK

bring the node back up and verify it recovers with the updated value "new-value":

redis-cli -p 63792
127.0.0.1:63792> KEYS *
1) "mykey"
127.0.0.1:63792> get mykey
"new-value"

benchmark

redis-benchmark -t set,get -n 100000 -p 63791

====== SET ======
  100000 requests completed in 1.35 seconds
  50 parallel clients
  3 bytes payload
  keep alive: 1

96.64% <= 1 milliseconds
99.15% <= 2 milliseconds
99.90% <= 3 milliseconds
100.00% <= 3 milliseconds
73909.83 requests per second

====== GET ======
  100000 requests completed in 0.95 seconds
  50 parallel clients
  3 bytes payload
  keep alive: 1

99.95% <= 4 milliseconds
100.00% <= 4 milliseconds
105485.23 requests per second

raft-kv's People

Contributors

jinyyu avatar

Stargazers

Yifan Gao avatar  avatar Ivan Chien avatar Li Zhijie avatar LIUYONGBIN avatar Do2eM0N avatar 思无邪 avatar 鸭心驰神往 avatar Boer avatar  avatar  avatar  avatar  avatar  avatar Andrejs Agejevs avatar Farley Knight avatar  avatar 陈春亮 avatar Xiao avatar  avatar

Watchers

 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.