-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples: add ycsb-d simulation example
- Loading branch information
1 parent
cc13719
commit 16c6ae7
Showing
6 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
This example shows how to run YCSB-like benchmarks in kvbench by utilizing its customizable | ||
workloads. Here we simulate the YCSB-D workload where there are 5% inserts/writes and 95% reads. | ||
The key distribution still follows Zipfian but the hotspot is always the latest written key. | ||
|
||
Unlike YCSB that really inserts a key, kvbench assumes a fixed-sized key space, and a write | ||
operation can be either an insert or an update internally. For the latest key, it should not make | ||
a huge difference as it's usually cached. | ||
|
||
The workload file, `ycsbd.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 = "shufflep" | ||
report = "hidden" | ||
|
||
[[benchmark]] | ||
timeout = 3 | ||
set_perc = 5 | ||
get_perc = 95 | ||
del_perc = 0 | ||
dist = "latest" | ||
report = "finish" | ||
``` | ||
|
||
In the first phase, all worker threads fill the key space of the store, and the metrics are hidden. | ||
Note that the loading is done using `shufflep` instead of `incrementp`. With `shufflep`, the order | ||
of the keys in the key space is shuffled and each key is written exactly once. | ||
In the second phase, worker threads execute the workload using the built-in `latest` key | ||
distribution. | ||
|
||
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. | ||
|
||
AMD Ryzen 9 5950X CPU 0-15 results ([pdf](ycsbd.pdf)): | ||
|
||
![ycsbd](ycsbd.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
set terminal pdf | ||
set ylabel "Throughput (MOP/s)" | ||
set xlabel "Threads" | ||
set key left top | ||
|
||
set output "ycsbd.pdf" | ||
plot [0:17] [0:] \ | ||
"chashmap.txt" using 2:14 with lp ti "chashmap",\ | ||
"contrie.txt" using 2:14 with lp ti "contrie",\ | ||
"dashmap.txt" using 2:14 with lp ti "dashmap",\ | ||
"flurry.txt" using 2:14 with lp ti "flurry",\ | ||
"papaya.txt" using 2:14 with lp ti "papaya",\ | ||
"scchashmap.txt" using 2:14 with lp ti "scchashmap",\ | ||
"mutex_hashmap.txt" using 2:14 with lp ti "mutexhashmap",\ | ||
"rwlock_hashmap.txt" using 2:14 with lp ti "rwlockhashmap" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
DIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" | ||
|
||
cargo +stable build --profile release-lto --all-features | ||
|
||
STORE_DIR=$DIR/../../presets/stores | ||
BENCHMARK=$DIR/ycsbd.toml | ||
|
||
STORES="chashmap contrie dashmap flurry papaya scchashmap mutex_hashmap rwlock_hashmap" | ||
|
||
for s in $STORES; do | ||
echo $s | ||
rm $s.txt 2>/dev/null | ||
for t in `seq 1 16`; do | ||
data="$(env global.threads=$t cargo +stable run --profile release-lto --all-features -- bench -s $STORE_DIR/$s.toml -b $BENCHMARK 2>/dev/null)" | ||
echo "threads $t $data" | tee -a $s.txt | ||
done | ||
done | ||
|
||
gnuplot $DIR/plot.gpl |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[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 = "shufflep" | ||
report = "hidden" | ||
|
||
[[benchmark]] | ||
timeout = 3 | ||
set_perc = 5 | ||
get_perc = 95 | ||
del_perc = 0 | ||
dist = "latest" | ||
report = "finish" |