From d50366711e81103fcd3da2023f6b9bcb367a1c87 Mon Sep 17 00:00:00 2001 From: Steven Czabaniuk Date: Thu, 29 Feb 2024 00:40:45 -0600 Subject: [PATCH] Bound the blockstore_process threadpool to a max of 24 threads --- ledger/src/blockstore_processor.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ledger/src/blockstore_processor.rs b/ledger/src/blockstore_processor.rs index 2e172870d6e5f7..ae70c8c015be99 100644 --- a/ledger/src/blockstore_processor.rs +++ b/ledger/src/blockstore_processor.rs @@ -86,11 +86,12 @@ struct ReplayEntry { starting_index: usize, } -// get_max_thread_count to match number of threads in the old code. -// see: https://github.com/solana-labs/solana/pull/24853 +// Max number of threads to allocate for executing transactions +const MAX_THREAD_POOL_SIZE: usize = 24; + lazy_static! { static ref PAR_THREAD_POOL: ThreadPool = rayon::ThreadPoolBuilder::new() - .num_threads(get_max_thread_count()) + .num_threads(get_max_thread_count().min(MAX_THREAD_POOL_SIZE)) .thread_name(|i| format!("solBstoreProc{i:02}")) .build() .unwrap();