Skip to content

Commit

Permalink
examples: update readme files
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdroychan committed Jul 25, 2024
1 parent 86fdce4 commit 54941ce
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 1 deletion.
73 changes: 73 additions & 0 deletions examples/mixed/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
This example shows a benchmark that consists of multiple phases (5 seconds
running time each), benchmarked with 32 threads.

The workload file, `mixed.toml` is as follows:

```toml
[global]
threads = 1
repeat = 5
klen = 8
vlen = 16
kmin = 0
kmax = 1000000
report = "repeat"

[[benchmark]]
set_perc = 100
get_perc = 0
del_perc = 0
repeat = 1
dist = "incrementp"
report = "hidden"

# write-intensive, zipfian
[[benchmark]]
set_perc = 50
get_perc = 50
del_perc = 0
timeout = 1.0
dist = "zipfian"

# write-intensive, zipfian, hotspot in middle
[[benchmark]]
set_perc = 50
get_perc = 50
del_perc = 0
timeout = 1.0
dist = "zipfian"
zipf_hotspot = 0.5

# read-intensive, zipfian
[[benchmark]]
set_perc = 5
get_perc = 95
del_perc = 0
timeout = 1.0
dist = "zipfian"

# read-only, uniform
[[benchmark]]
set_perc = 0
get_perc = 100
del_perc = 0
timeout = 1.0
dist = "uniform"
```

In the first phase, all worker threads fill the key space of the store, and the metrics are hidden.
Then, the benchmark consists of 4 parts with 5 seconds running time each:

- Write-intensive on popular keys.
- Write-intensive on popular keys while the popular keys shifted to the middle of the
key space.
- Read-intensive (only 5% writes) on popular keys.
- Read-only on uniformly random keys.

The script file `run.sh` runs this benchmark against multiple stores with 32 threads.
Although the number of threads set in the configuration file is only 1, the number of threads are
dynamically adjusted by setting `global.threads` to 32.

Results:

![mixed](mixed.pdf)
42 changes: 42 additions & 0 deletions examples/readpopular/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
This example shows a benchmark that reads popular records in the store, running with different
number of threads.

The workload file, `readpopular.toml` is as follows:

```toml
[global]
threads = 1
repeat = 1
klen = 8
vlen = 16
kmin = 0
kmax = 1000000

[[benchmark]]
set_perc = 100
get_perc = 0
del_perc = 0
repeat = 1
dist = "incrementp"
report = "hidden"

[[benchmark]]
timeout = 1
set_perc = 0
get_perc = 100
del_perc = 0
dist = "zipfian"
zipf_theta = 1.0
report = "finish"
```

In the first phase, all worker threads fill the key space of the store, and the metrics are hidden.
In the second phase, worker threads execute the read-only workload that accesses Zipfian keys for
1 second and report once when finished.

The script file `run.sh` runs this benchmark against multiple stores with different number of
threads. The number of threads are dynamically adjusted via `global.threads` environment variable.

Results:

![readpopular](readpopular.pdf)
41 changes: 41 additions & 0 deletions examples/writeheavy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
This example shows a benchmark that mixes reads and writes at 1:1 ratio accessing a random record
in the store, running with different number of threads.

The workload file, `writeheavy.toml` is as follows:

```toml
[global]
threads = 1
repeat = 1
klen = 8
vlen = 16
kmin = 0
kmax = 1000000

[[benchmark]]
set_perc = 100
get_perc = 0
del_perc = 0
repeat = 1
dist = "incrementp"
report = "hidden"

[[benchmark]]
timeout = 1
set_perc = 50
get_perc = 50
del_perc = 0
dist = "uniform"
report = "finish"
```

In the first phase, all worker threads fill the key space of the store, and the metrics are hidden.
In the second phase, worker threads execute the write-heavy workload for 1 second and report once
when finished.

The script file `run.sh` runs this benchmark against multiple stores with different number of
threads. The number of threads are dynamically adjusted via `global.threads` environment variable.

Results:

![writeheavy](writeheavy.pdf)
2 changes: 2 additions & 0 deletions examples/your-kv-store/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
This example shows how to integrate `kvbench` into your own key-value store implementations.

To compile, simply use:

```
Expand Down
2 changes: 1 addition & 1 deletion examples/your-kv-store/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extern crate kvbench;
use kvbench::inventory;
use kvbench::toml;

use kvbench::bench::{BenchKVMap, Registry};
use kvbench::stores::{BenchKVMap, Registry};
use kvbench::{KVMap, KVMapHandle};
use std::collections::HashMap;
use std::sync::{Arc, RwLock};
Expand Down

0 comments on commit 54941ce

Please sign in to comment.