From 4bd676e22d41cb5f14653518e1c4a1928633504e Mon Sep 17 00:00:00 2001 From: yukang Date: Tue, 27 Feb 2024 14:57:22 +0800 Subject: [PATCH] tunning verify mgr cpu number to avoid high workload --- tx-pool/src/verify_mgr.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tx-pool/src/verify_mgr.rs b/tx-pool/src/verify_mgr.rs index b469da4833..560cb7596e 100644 --- a/tx-pool/src/verify_mgr.rs +++ b/tx-pool/src/verify_mgr.rs @@ -110,9 +110,9 @@ impl VerifyMgr { signal_exit: CancellationToken, ) -> Self { // `num_cpus::get()` will always return at least 1, - // minus 1 to avoid high workload on the system - // let worker_num = std::cmp::max(num_cpus::get() - 1, 1); - let workers: Vec<_> = (0..num_cpus::get()) + // don't use too many cpu cores to avoid high workload on the system + let worker_num = std::cmp::max(num_cpus::get() / 2, 1); + let workers: Vec<_> = (0..worker_num) .map({ let tasks = Arc::clone(&service.verify_queue); let signal_exit = signal_exit.clone();