@@ -12,6 +12,7 @@ use std::sync::Arc;
12
12
use criterion:: measurement:: WallTime ;
13
13
use criterion:: { Bencher , BenchmarkGroup , BenchmarkId , Criterion , criterion_group, criterion_main} ;
14
14
use mz_build_info:: DUMMY_BUILD_INFO ;
15
+ use mz_ore:: cast:: CastInto ;
15
16
use mz_ore:: metrics:: MetricsRegistry ;
16
17
use mz_ore:: now:: SYSTEM_TIME ;
17
18
use mz_persist:: file:: { FileBlob , FileBlobConfig } ;
@@ -74,6 +75,13 @@ pub fn bench_persist(c: &mut Criterion) {
74
75
DataGenerator :: small ( )
75
76
} ;
76
77
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
+
77
85
porcelain:: bench_writes ( "porcelain/writes" , throughput, c, & runtime, & data) ;
78
86
porcelain:: bench_write_to_listen ( "porcelain/write_to_listen" , throughput, c, & runtime, & data) ;
79
87
porcelain:: bench_snapshot ( "porcelain/snapshot" , throughput, c, & runtime, & data) ;
@@ -95,7 +103,7 @@ pub fn bench_persist(c: &mut Criterion) {
95
103
)
96
104
} ;
97
105
bench_compare_and_set ( 1 , 1 ) ;
98
- bench_compare_and_set ( 1 , ncpus_useful ) ;
106
+ bench_compare_and_set ( 1 , num_shards ) ;
99
107
}
100
108
plumbing:: bench_encode_batch ( "plumbing/encode_batch" , throughput, c, & data) ;
101
109
plumbing:: bench_trace_push_batch ( c) ;
0 commit comments