File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
quickwit/quickwit-control-plane/src/indexing_scheduler Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ mod scheduling;
1818use std:: cmp:: Ordering ;
1919use std:: fmt;
2020use std:: num:: NonZeroU32 ;
21- use std:: sync:: Arc ;
21+ use std:: sync:: { Arc , OnceLock } ;
2222use std:: time:: { Duration , Instant } ;
2323
2424use fnv:: { FnvHashMap , FnvHashSet } ;
@@ -177,10 +177,21 @@ fn compute_load_per_shard(shard_entries: &[&ShardEntry]) -> NonZeroU32 {
177177 const MIN_CPU_LOAD_PER_SHARD : u32 = 50u32 ;
178178 NonZeroU32 :: new ( ( num_cpu_millis as u32 ) . max ( MIN_CPU_LOAD_PER_SHARD ) ) . unwrap ( )
179179 } else {
180- NonZeroU32 :: new ( PIPELINE_FULL_CAPACITY . cpu_millis ( ) / 4 ) . unwrap ( )
180+ get_default_load_per_shard ( )
181181 }
182182}
183183
184+ fn get_default_load_per_shard ( ) -> NonZeroU32 {
185+ static DEFAULT_LOAD_PER_SHARD : OnceLock < NonZeroU32 > = OnceLock :: new ( ) ;
186+ * DEFAULT_LOAD_PER_SHARD . get_or_init ( || {
187+ let default_load_per_shard = quickwit_common:: get_from_env (
188+ "QW_DEFAULT_LOAD_PER_SHARD" ,
189+ PIPELINE_FULL_CAPACITY . cpu_millis ( ) / 4 ,
190+ ) ;
191+ NonZeroU32 :: new ( default_load_per_shard) . unwrap ( )
192+ } )
193+ }
194+
184195fn get_sources_to_schedule ( model : & ControlPlaneModel ) -> Vec < SourceToSchedule > {
185196 let mut sources = Vec :: new ( ) ;
186197
You can’t perform that action at this time.
0 commit comments