/kvs

A key-value store for practicing rust-lang.

Primary LanguageRustMIT LicenseMIT

kvs

A simple key/value store for practicing rust-lang.

How to use

  1. compile
cargo build
cd target/release/
  1. 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

Feature

  1. friendly CLI
  2. error handling with Result
  3. log-structured k/v store
    logging with compaction
  4. simple & readable protocol
    like redis RESP
  5. 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.

Benchmark

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.

full_operation_benchmark

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.

full_density_avg

Reference