Skip to content

Commit

Permalink
tunning verify mgr cpu number to avoid high workload
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Feb 27, 2024
1 parent ee04830 commit 4bd676e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tx-pool/src/verify_mgr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 4bd676e

Please sign in to comment.