@@ -11,7 +11,7 @@ use taskbroker::{
11
11
} ;
12
12
use tokio:: task:: JoinSet ;
13
13
14
- async fn get_pending_activations ( num_activations : u32 , num_workers : u32 ) {
14
+ async fn get_pending_activations ( num_activations : u32 , num_workers : u32 , shards : u8 ) {
15
15
let url = if cfg ! ( feature = "bench-with-mnt-disk" ) {
16
16
let mut rng = rand:: thread_rng ( ) ;
17
17
format ! (
@@ -26,7 +26,7 @@ async fn get_pending_activations(num_activations: u32, num_workers: u32) {
26
26
InflightActivationStore :: new (
27
27
& url,
28
28
InflightActivationStoreConfig {
29
- sharding_factor : 8 ,
29
+ sharding_factor : shards ,
30
30
vacuum_interval_ms : 60000 ,
31
31
max_processing_attempts : 1 ,
32
32
} ,
@@ -67,7 +67,7 @@ async fn get_pending_activations(num_activations: u32, num_workers: u32) {
67
67
) ;
68
68
}
69
69
70
- async fn set_status ( num_activations : u32 , num_workers : u32 ) {
70
+ async fn set_status ( num_activations : u32 , num_workers : u32 , shards : u8 ) {
71
71
assert ! ( num_activations % num_workers == 0 ) ;
72
72
73
73
let url = if cfg ! ( feature = "bench-with-mnt-disk" ) {
@@ -84,7 +84,7 @@ async fn set_status(num_activations: u32, num_workers: u32) {
84
84
InflightActivationStore :: new (
85
85
& url,
86
86
InflightActivationStoreConfig {
87
- sharding_factor : 8 ,
87
+ sharding_factor : shards ,
88
88
max_processing_attempts : 1 ,
89
89
vacuum_interval_ms : 60000 ,
90
90
} ,
@@ -135,7 +135,7 @@ fn store_bench(c: &mut Criterion) {
135
135
let num_activations: u32 = 8192 ;
136
136
let num_workers = 64 ;
137
137
138
- c. benchmark_group ( "bench_InflightActivationShard " )
138
+ c. benchmark_group ( "bench_InflightActivationStore_2_shards " )
139
139
. sample_size ( 256 )
140
140
. throughput ( criterion:: Throughput :: Elements ( num_activations. into ( ) ) )
141
141
. bench_function ( "get_pending_activation" , |b| {
@@ -144,15 +144,75 @@ fn store_bench(c: &mut Criterion) {
144
144
. build ( )
145
145
. unwrap ( ) ;
146
146
b. to_async ( runtime)
147
- . iter ( || get_pending_activations ( num_activations, num_workers) ) ;
147
+ . iter ( || get_pending_activations ( num_activations, num_workers, 2 ) ) ;
148
148
} )
149
149
. bench_function ( "set_status" , |b| {
150
150
let runtime = tokio:: runtime:: Builder :: new_multi_thread ( )
151
151
. enable_all ( )
152
152
. build ( )
153
153
. unwrap ( ) ;
154
154
b. to_async ( runtime)
155
- . iter ( || set_status ( num_activations, num_workers) ) ;
155
+ . iter ( || set_status ( num_activations, num_workers, 2 ) ) ;
156
+ } ) ;
157
+
158
+ c. benchmark_group ( "bench_InflightActivationStore_4_shards" )
159
+ . sample_size ( 256 )
160
+ . throughput ( criterion:: Throughput :: Elements ( num_activations. into ( ) ) )
161
+ . bench_function ( "get_pending_activation" , |b| {
162
+ let runtime = tokio:: runtime:: Builder :: new_multi_thread ( )
163
+ . enable_all ( )
164
+ . build ( )
165
+ . unwrap ( ) ;
166
+ b. to_async ( runtime)
167
+ . iter ( || get_pending_activations ( num_activations, num_workers, 4 ) ) ;
168
+ } )
169
+ . bench_function ( "set_status" , |b| {
170
+ let runtime = tokio:: runtime:: Builder :: new_multi_thread ( )
171
+ . enable_all ( )
172
+ . build ( )
173
+ . unwrap ( ) ;
174
+ b. to_async ( runtime)
175
+ . iter ( || set_status ( num_activations, num_workers, 4 ) ) ;
176
+ } ) ;
177
+
178
+ c. benchmark_group ( "bench_InflightActivationStore_8_shards" )
179
+ . sample_size ( 256 )
180
+ . throughput ( criterion:: Throughput :: Elements ( num_activations. into ( ) ) )
181
+ . bench_function ( "get_pending_activation" , |b| {
182
+ let runtime = tokio:: runtime:: Builder :: new_multi_thread ( )
183
+ . enable_all ( )
184
+ . build ( )
185
+ . unwrap ( ) ;
186
+ b. to_async ( runtime)
187
+ . iter ( || get_pending_activations ( num_activations, num_workers, 8 ) ) ;
188
+ } )
189
+ . bench_function ( "set_status" , |b| {
190
+ let runtime = tokio:: runtime:: Builder :: new_multi_thread ( )
191
+ . enable_all ( )
192
+ . build ( )
193
+ . unwrap ( ) ;
194
+ b. to_async ( runtime)
195
+ . iter ( || set_status ( num_activations, num_workers, 8 ) ) ;
196
+ } ) ;
197
+
198
+ c. benchmark_group ( "bench_InflightActivationStore_16_shards" )
199
+ . sample_size ( 256 )
200
+ . throughput ( criterion:: Throughput :: Elements ( num_activations. into ( ) ) )
201
+ . bench_function ( "get_pending_activation" , |b| {
202
+ let runtime = tokio:: runtime:: Builder :: new_multi_thread ( )
203
+ . enable_all ( )
204
+ . build ( )
205
+ . unwrap ( ) ;
206
+ b. to_async ( runtime)
207
+ . iter ( || get_pending_activations ( num_activations, num_workers, 16 ) ) ;
208
+ } )
209
+ . bench_function ( "set_status" , |b| {
210
+ let runtime = tokio:: runtime:: Builder :: new_multi_thread ( )
211
+ . enable_all ( )
212
+ . build ( )
213
+ . unwrap ( ) ;
214
+ b. to_async ( runtime)
215
+ . iter ( || set_status ( num_activations, num_workers, 16 ) ) ;
156
216
} ) ;
157
217
}
158
218
0 commit comments