Skip to content

Commit

Permalink
*: major refactor; add github workflow for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdroychan committed Jul 24, 2024
1 parent 2d5fff6 commit ad52951
Show file tree
Hide file tree
Showing 19 changed files with 371 additions and 167 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: test

on:
push:
branches: [ "master" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: build
run: cargo build --verbose --release
- name: tests
run: cargo test --release
50 changes: 25 additions & 25 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ edition = "2021"
exclude = ["presets", "examples"]

[dependencies]
serde = { version = "*", features = ["derive"] }
bincode = "*"
chashmap = "*"
contrie = "*"
mio = { version = "*", features = ["net", "os-poll"] }
dashmap = { version = "*", features = ["inline"] }
parking_lot = "*"
clap = { version = "=4.0.0", features = ["derive"] }
rand = "*"
log = "*"
zipf = "*"
serial_test = "*"
env_logger = "*"
jemallocator = "*"
toml = "*"
inventory = "*"
core_affinity = "*"
quanta = "*"
hashbrown = "*"
ahash = "*"
figment = { version = "*", features = ["toml", "env"] }
scc = "*"
flurry = "*"
papaya = "*"
ctrlc = "*"
ahash = "0.8.11"
bincode = "1.3.3"
chashmap = "2.2.2"
clap = { version = "=4.5.10", features = ["derive"] }
contrie = "0.1.4"
core_affinity = "0.8.1"
ctrlc = "3.4.4"
dashmap = { version = "6.0.1", features = ["inline"] }
env_logger = "0.11.3"
figment = { version = "0.10.19", features = ["toml", "env"] }
flurry = "0.5.1"
hashbrown = "0.14.5"
inventory = "0.3.15"
jemallocator = "0.5.4"
log = "0.4.22"
mio = { version = "1.0.0", features = ["net", "os-poll"] }
papaya = "0.1.1"
parking_lot = "0.12.3"
quanta = "0.12.3"
rand = "0.8.5"
scc = "2.1.2"
serde = { version = "1.0.204", features = ["derive"] }
serial_test = "3.1.1"
toml = "0.8.14"
zipf = "7.0.1"

[profile.release]
debug = true
Expand Down
54 changes: 45 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,52 @@
# kvbench

![GitHub Workflow](https://github.com/nerdroychan/kvbench/actions/workflows/test.yml/badge.svg)
![GPLv3](https://img.shields.io/github/license/nerdroychan/kvbench)

A benchmarking framework designed for testing key-value stores with easily customizable
workloads.

With `kvbench`, you can define the details of a benchmark using the TOML format, such as the
proportions of mixed operations, the key access pattern, and key space size, just to name a
few. In addition to regular single-process benchmarks, `kvbench` also integrates a key-value
client/server implementation that works with a dedicated server thread/machine.
## Intro

This Rust crate enables the execution of tailored benchmarks on various key-value stores. Users
have the flexibility to adjust benchmark and key-value store parameters and store them in a
TOML-formatted file. The default command line interface is capable of loading these files and
running the benchmarks as specified.

In addition to standard single-process benchmarks, kvbench seamlessly incorporates a key-value
client/server setup that operates with a dedicated server thread/machine.

## Usage

Without any changes, you can run the default command line interface with three modes:

- `kvbench bench -s <STORE_FILE> -b <BENCH_FILE>` runs a (group of) benchmark using the parameters
stored in `<STORE_FILE>` and `<BENCH_FILE>`.
- `kvbench server -h <HOST> -p <PORT> -s <STORE_FILE> -n <THREADS>` boots up a key-value server
with `<THREADS>` workers, listening on `<HOST>:<PORT>`, and uses the key-value stores specified in
`<STORE_FILE>`.
- `kvbench list` lists all registered key-value stores that can be used.

See [examples](examples/) for more examples.

## Configuration

See the documentation of the modules `stores` and `bench` for available options.

## Integration

You can incorporate `kvbench` into your own key-value store implementations and run it
against the built-in stores. All you need is implementing the necessary traits, depending on the
type of the store, and call the default command line interface provided by this crate.

See [examples/your-kv-store](examples/your-kv-store) for a minimal but concrete example.

## Development

You can also incorporate `kvbench` into your own key-value store implementations and run it
against the built-in stores. All you need is implementing the [`KVMap`] or the [`AsyncKVMap`]
trait, depending on the type of the store. After registering your store, simply reuse the
exported [`cmdline()`] in your `main` function and it will work seamlessly with your own store.
The missing pieces that are currently under active development:

More detailed usage could be found in the module-level rustdocs.
- Latency measurement (incl. CDF and tail/avg. latency metrics).
- Atomic Read-modify-write (RMW) support.
- More key-distributions (e.g., latest key, composite-zipfian).
- Ordered key-value stores support (range query workloads).
- Extra built-ins (e.g., YCSB workloads).
Loading

0 comments on commit ad52951

Please sign in to comment.