In this project, we present a highly available, consistent, fault tolerant distributed Key-Value Store. It adapts the RAFT consensus algorithm broadly in the system and supports concurrent transactions across shards. Each operation on the store is handled by a set of coordinators as a RAFT group.
The keys in the store are partitioned across shards and each shard maintains multiple replicas forming their own RAFT groups. The distributed transactions across shards is achieved using two-phase commit protocol with two-phase locking to guarantee atomicity and serializability.
docker runtime is the only dependency to build and run
make build
This drops into a client container shell to perform kv CRUDs
make cluster
######################### Starting Client #########################
>
>
>txn
Entering transaction status
>set universe 42
>set team 4
>end
Submitting [method:"set" key:"universe" value:42 method:"set" key:"team" value:4]
OK
>get team
Key=team, Value=4
>get universe
Key=universe, Value=42
get [key]
: get value of a key from RAFT KV store- Examples:
get class
orget "distributed system"
- If the
[key]
does not exist, return messageKey=[key] does not exist
- Examples:
set [key] [value]
: put (key, value) on RAFT KV store- Examples:
put universe 42
orput "2020 spring class students" 100
- Examples:
del [key]
: delete key from RAFT KV store- Examples:
del class
ordel "distributed system"
- Examples:
txn
: start a transaction (Onlyset
anddel
are supported in transaction)endtxn
: end a transaction- Example:
txn set universe 42 set team 4 del class end
add [key] [value]
: add value to an existing key- Example:
add "my account" 100
- Example:
sub [key] [value]
: subtract value to an existing key- Example:
sub "my account" 50
- Example:
xfer [from-key] [to-key] [value]
: transfer value from one key to another- Example:
xfer bank-A bank-B 50
- If either of
[key]
does not exist, return messageKey=[key] does not exist
- If
[from-key]
has a current value less than[value]
, return messageInsufficient funds
- Example:
exit
: exit client from server
To run the performance test locally:
go run metric/performance.go
To run the performance in the client container:
make test-performance
Copyright [2020] [Chen Chen, Varun Kulkarni, Supriya Premkumar, Renga Srinivasan]
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
http://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.