Skip to content
/ raft-kv Public

A C++ implementation of RAFT consensus algorithm based on asio

License

Notifications You must be signed in to change notification settings

jinyyu/raft-kv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A C++ implementation of RAFT consensus algorithm based on asio

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published