From 20248c443ba537896e7c101cc425ab8ae6ead463 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 17 Jun 2019 11:12:48 +0200 Subject: [PATCH] Use fewer threads for snapshotting (#10752) * Use fewer threads for snapshotting When taking a snapshot the current default number of threads is equal to half the number of **logical** CPUs in the system. On HT enabled CPUs this value seems a bit high, e.g. 6 snapshotting threads on a 6/12 core/hyperthread CPU. Maybe a better default value is half the number of physical cores? * fix test --- ethcore/src/snapshot/mod.rs | 2 +- parity/configuration.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ethcore/src/snapshot/mod.rs b/ethcore/src/snapshot/mod.rs index 84905f580..d2fa115db 100644 --- a/ethcore/src/snapshot/mod.rs +++ b/ethcore/src/snapshot/mod.rs @@ -107,7 +107,7 @@ impl Default for SnapshotConfiguration { fn default() -> Self { SnapshotConfiguration { no_periodic: false, - processing_threads: ::std::cmp::max(1, num_cpus::get() / 2), + processing_threads: ::std::cmp::max(1, num_cpus::get_physical() / 2), } } } diff --git a/parity/configuration.rs b/parity/configuration.rs index e5c950b5c..0d6c2d86f 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -934,7 +934,7 @@ impl Configuration { no_periodic: self.args.flag_no_periodic_snapshot, processing_threads: match self.args.arg_snapshot_threads { Some(threads) if threads > 0 => threads, - _ => ::std::cmp::max(1, num_cpus::get() / 2), + _ => ::std::cmp::max(1, num_cpus::get_physical() / 2), }, };