Skip to content

Commit

Permalink
benchmarks: improve README
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Wünsche committed Jan 23, 2024
1 parent 4be952b commit a83cd9f
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 21 deletions.
35 changes: 35 additions & 0 deletions betree/haura-benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,38 @@ This directory contains some additional tools and benchmarks which can be helpfu
- `src/main.rs`: CLI to select and configure a benchmark, also spawns the sysinfo-log binary
- `src/{ingest, rewrite, switchover, tiered1, zip, scientific_evaluation, filesystem, filesystem_zip, checkpoints}.rs`: Individual benchmarks
- `run.sh`: Example usage, runs benchmarks with different configurations

## Configuration

All benchmark invocations can be seen in the `run.sh` script, which can be used
to create a custom benchmark run. Benchmarks are represented by their own
function you can uncomment at the bottom of the script.

If you have followed the general scripts to setup `bectl` and `haura` in the
[documentation](https://parcio.github.io/haura/) you are good to go. Otherwise,
provide a configuration for the benchmarks either by pointing to a valid
configuration in the `BETREE_CONFIG` environment variable or by creating a
`perf-config.json` in the `haura-benchmarks` directory. A collection of example
configurations can be found in the `example_config` directory.

``` sh
$ # EITHER
$ export BETREE_CONFIG=<path_to_config>
$ # OR
$ cp example_config/example-config.json perf-config.json
```

Be sure to modify the example config, if chosen, to your desired specification.


## Running the benchmark

If you have configured your benchmarks *and* chosen a configuration for Haura,
you can start the benchmark. If required for identification of multiple runs a
name can be given with each invocation which will be used in the stored results:

``` sh
$ ./run.sh my-benchmark-run
```

After each individual benchmark an idle period of 1 minute is done by default.
47 changes: 47 additions & 0 deletions betree/haura-benchmarks/example_config/example-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"storage": {
"tiers": [
{
"top_level_vdevs": [
{
"mem": 4294967296
}
],
"preferred_access_type": "Unknown"
},
{
"top_level_vdevs": [
{
"path": "/tmp/example_disk",
"direct": true
}
],
"preferred_access_type": "Unknown"
}
],
"queue_depth_factor": 20,
"thread_pool_size": null,
"thread_pool_pinned": false
},
"alloc_strategy": [
[
0
],
[
0
],
[
0
],
[
0
]
],
"default_storage_class": 0,
"compression": "None",
"cache_size": 268435456,
"access_mode": "AlwaysCreateNew",
"sync_interval_ms": null,
"migration_policy": null,
"metrics": null
}
42 changes: 21 additions & 21 deletions betree/haura-benchmarks/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,43 +68,43 @@ function run {
function tiered() {
(
export BETREE__ALLOC_STRATEGY='[[0],[0],[],[]]'
run "$VDEV_TYPE" tiered1_all0_alloc tiered1
run "$RUN_IDENT" tiered1_all0_alloc tiered1
)

(
export BETREE__ALLOC_STRATEGY='[[0],[1],[],[]]'
run "$VDEV_TYPE" tiered1_id_alloc tiered1
run "$RUN_IDENT" tiered1_id_alloc tiered1
)

(
export BETREE__ALLOC_STRATEGY='[[1],[1],[],[]]'
run "$VDEV_TYPE" tiered1_all1_alloc tiered1
run "$RUN_IDENT" tiered1_all1_alloc tiered1
)
}

function scientific_evaluation() {
export BETREE__ALLOC_STRATEGY='[[0],[1],[],[]]'
run "$VDEV_TYPE" scientific_evaluation_id_alloc evaluation-read 30
run "$RUN_IDENT" scientific_evaluation_id_alloc evaluation-read 30
}

function evaluation_rw() {
export BETREE__ALLOC_STRATEGY='[[0],[1],[],[]]'
run "$VDEV_TYPE" file_system_three evaluation-rw
run "$RUN_IDENT" file_system_three evaluation-rw
}

function filesystem_zip() {
export BETREE__ALLOC_STRATEGY='[[0],[1],[2],[]]'
run "$VDEV_TYPE" file_system_three "$ZIP_ARCHIVE"
run "$RUN_IDENT" file_system_three "$ZIP_ARCHIVE"
}

function checkpoints() {
export BETREE__ALLOC_STRATEGY='[[0, 1],[1],[],[]]'
run "$VDEV_TYPE" checkpoints_fastest checkpoints
run "$RUN_IDENT" checkpoints_fastest checkpoints
}

function filesystem() {
export BETREE__ALLOC_STRATEGY='[[0],[1],[2],[]]'
run "$VDEV_TYPE" file_system_three filesystem
run "$RUN_IDENT" file_system_three filesystem
}

function zip_cache() {
Expand All @@ -113,7 +113,7 @@ function zip_cache() {
for cache_mib in 32 64 128 256 512 1024 2048 4096 8192; do
(
export BETREE__CACHE_SIZE=$((cache_mib * 1024 * 1024))
run "$VDEV_TYPE" "zip_cache_$cache_mib" zip 4 100 10 "$ZIP_ARCHIVE" "$F_CD_START"
run "$RUN_IDENT" "zip_cache_$cache_mib" zip 4 100 10 "$ZIP_ARCHIVE" "$F_CD_START"
)
done
}
Expand All @@ -134,7 +134,7 @@ function zip_mt() {
local per_worker=$((total / num_workers))
local per_run=$((per_worker / 10))

run "$VDEV_TYPE" "zip_mt_${cache_mib}_${num_workers}_${per_run}_10" zip "$num_workers" "$per_run" 10 "$F" "$F_CD_START"
run "$RUN_IDENT" "zip_mt_${cache_mib}_${num_workers}_${per_run}_10" zip "$num_workers" "$per_run" 10 "$F" "$F_CD_START"
done
)
done
Expand All @@ -159,17 +159,17 @@ function zip_tiered() {

(
export BETREE__ALLOC_STRATEGY='[[0],[0],[],[]]'
run "$VDEV_TYPE" "zip_tiered_all0_${cache_mib}_${num_workers}_${per_run}_10" zip "$num_workers" "$per_run" 10 "$ZIP_ARCHIVE" "$F_CD_START"
run "$RUN_IDENT" "zip_tiered_all0_${cache_mib}_${num_workers}_${per_run}_10" zip "$num_workers" "$per_run" 10 "$ZIP_ARCHIVE" "$F_CD_START"
)

(
export BETREE__ALLOC_STRATEGY='[[0],[1],[],[]]'
run "$VDEV_TYPE" "zip_tiered_id_${cache_mib}_${num_workers}_${per_run}_10" zip "$num_workers" "$per_run" 10 "$ZIP_ARCHIVE" "$F_CD_START"
run "$RUN_IDENT" "zip_tiered_id_${cache_mib}_${num_workers}_${per_run}_10" zip "$num_workers" "$per_run" 10 "$ZIP_ARCHIVE" "$F_CD_START"
)

(
export BETREE__ALLOC_STRATEGY='[[1],[1],[],[]]'
run "$VDEV_TYPE" "zip_tiered_all1_${cache_mib}_${num_workers}_${per_run}_10" zip "$num_workers" "$per_run" 10 "$ZIP_ARCHIVE" "$F_CD_START"
run "$RUN_IDENT" "zip_tiered_all1_${cache_mib}_${num_workers}_${per_run}_10" zip "$num_workers" "$per_run" 10 "$ZIP_ARCHIVE" "$F_CD_START"
)

done
Expand All @@ -187,21 +187,21 @@ function ingest() {
for level in $(seq 1 16); do
(
export BETREE__COMPRESSION="{ Zstd = { level = $level } }"
run "$VDEV_TYPE" "ingest_hdd_zstd_$level" ingest "$ZIP_ARCHIVE"
run "$RUN_IDENT" "ingest_hdd_zstd_$level" ingest "$ZIP_ARCHIVE"
)
done
)
}

function switchover() {
run "$VDEV_TYPE" switchover_tiny switchover 32 "$((32 * 1024 * 1024))"
run "$VDEV_TYPE" switchover_small switchover 8 "$((128 * 1024 * 1024))"
run "$VDEV_TYPE" switchover_medium switchover 4 "$((2 * 1024 * 1024 * 1024))"
run "$VDEV_TYPE" switchover_large switchover 4 "$((8 * 1024 * 1024 * 1024))"
run "$RUN_IDENT" switchover_tiny switchover 32 "$((32 * 1024 * 1024))"
run "$RUN_IDENT" switchover_small switchover 8 "$((128 * 1024 * 1024))"
run "$RUN_IDENT" switchover_medium switchover 4 "$((2 * 1024 * 1024 * 1024))"
run "$RUN_IDENT" switchover_large switchover 4 "$((8 * 1024 * 1024 * 1024))"
}

function ci() {
run "$VDEV_TYPE" switchover_small switchover 4 "$((128 * 1024 * 1024))"
run "$RUN_IDENT" switchover_small switchover 4 "$((128 * 1024 * 1024))"
}

cargo build --release
Expand All @@ -215,7 +215,7 @@ export ROOT="$PWD"
export ZIP_ARCHIVE="$PWD/data/linux.zip"
# Category under which the default runs should be made, a function may modify
# this if multiple categories are needed.
export VDEV_TYPE="default"
export RUN_IDENT="default"

if [ "$1" == "-h" ] || [ "$1" == "--help" ] || [ "$1" = "help" ]
then
Expand All @@ -226,7 +226,7 @@ fi

if [ -n "$*" ]
then
export VDEV_TYPE=$*
export RUN_IDENT=$*
fi

ensure_bectl
Expand Down

0 comments on commit a83cd9f

Please sign in to comment.