Skip to content

Commit bf3748a

Browse files
committed
add configurable number of shards to compare_and_set bench
1 parent f0674a9 commit bf3748a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/persist-client/benches/benches.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use std::sync::Arc;
1212
use criterion::measurement::WallTime;
1313
use criterion::{Bencher, BenchmarkGroup, BenchmarkId, Criterion, criterion_group, criterion_main};
1414
use mz_build_info::DUMMY_BUILD_INFO;
15+
use mz_ore::cast::CastInto;
1516
use mz_ore::metrics::MetricsRegistry;
1617
use mz_ore::now::SYSTEM_TIME;
1718
use mz_persist::file::{FileBlob, FileBlobConfig};
@@ -74,6 +75,13 @@ pub fn bench_persist(c: &mut Criterion) {
7475
DataGenerator::small()
7576
};
7677

78+
let num_shards: usize =
79+
if let Some(num_shards_string) = std::env::var_os("MZ_PERSIST_BENCH_NUM_SHARDS") {
80+
num_shards_string.cast_into()
81+
} else {
82+
ncpus_useful
83+
};
84+
7785
porcelain::bench_writes("porcelain/writes", throughput, c, &runtime, &data);
7886
porcelain::bench_write_to_listen("porcelain/write_to_listen", throughput, c, &runtime, &data);
7987
porcelain::bench_snapshot("porcelain/snapshot", throughput, c, &runtime, &data);
@@ -95,7 +103,7 @@ pub fn bench_persist(c: &mut Criterion) {
95103
)
96104
};
97105
bench_compare_and_set(1, 1);
98-
bench_compare_and_set(1, ncpus_useful);
106+
bench_compare_and_set(1, num_shards);
99107
}
100108
plumbing::bench_encode_batch("plumbing/encode_batch", throughput, c, &data);
101109
plumbing::bench_trace_push_batch(c);

0 commit comments

Comments
 (0)