A simple key/value store for practicing rust-lang.
- compile
cargo build
cd target/release/
- run the server and the client
$ ./kvs-server --help
kvs-server 0.1.0
TangliziGit <tanglizimail@foxmail.com>
the server for the key value store
USAGE:
kvs-server [OPTIONS]
FLAGS:
-h, --help Prints help information
-V, --version Print the version
OPTIONS:
-e, --engine <ENGINE-NAME> the key-value store engine name [default: kvs] [possible values: kvs, sled]
-a, --addr <IP-PORT> a v4 or v6 IP address with a port number [default: 127.0.0.1:4000]
$ ./kvs-client
kvs-client 0.1.0
TangliziGit <tanglizimail@foxmail.com>
a client for the key value store
USAGE:
kvs-client [SUBCOMMAND]
FLAGS:
-h, --help Prints help information
-V, --version Print the version
SUBCOMMANDS:
get Get the string value of a given string key
rm Remove a given key
set Set the value of a string key to a string
- friendly CLI
- error handling with
Result
- log-structured k/v store
logging with compaction - simple & readable protocol
like redisRESP
- shared store engine for multi-threads
unique shared writer and cloneable reader, based on reference counting and locks. next step is to use wait-free data structures.
This benchmark compares it with sled (A modern embedded database).
kvs
engine has lower spaces and faster speed, because it has very basic function like setting, getting, removing k/v pairs and log compaction.
The benchmark result is showed below.
For example, when set, get and remove 2^16 k/v pairs, kvs
uses 350ms and 4.05MB while sled
uses 2176ms and 7.45MB.
- Write a Good CLI Program
- Rust API Guidelines
- rust-lang-nursery
- Error Handling in Rust
- The Design and Implementation of a Log-Structured File System
- Bitcask: A Log-Structured Hash Table for Fast Key/Value Data
- Redis Protocol specification: the redis client-server communication protocol
- Statistically Rigorous Java Performance Evaluation: a good example of the kind of thinking necessary to create effective benchmarks
- Rust: A unique perspective
- Lock-free vs. wait-free concurrency
- Lock-Free and Wait-Free, definition and examples [Chinese]