Skip to content

Commit

Permalink
perf: increase threads in global pool (#11075)
Browse files Browse the repository at this point in the history
  • Loading branch information
fgimenez authored Sep 20, 2024
1 parent 5e1b494 commit 3416145
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/node/builder/src/launch/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ impl LaunchContext {
Err(err) => warn!(%err, "Failed to raise file descriptor limit"),
}

// Limit the global rayon thread pool, reserving 2 cores for the rest of the system.
// If the system has less than 2 cores, it will use 1 core.
// Limit the global rayon thread pool, reserving 1 core for the rest of the system.
// If the system only has 1 core the pool will use it.
let num_threads =
available_parallelism().map_or(0, |num| num.get().saturating_sub(2).max(1));
available_parallelism().map_or(0, |num| num.get().saturating_sub(1).max(1));
if let Err(err) = ThreadPoolBuilder::new()
.num_threads(num_threads)
.thread_name(|i| format!("reth-rayon-{i}"))
Expand Down

0 comments on commit 3416145

Please sign in to comment.