From da7f90ef9aceca29db4f9b469bfbe7020f746251 Mon Sep 17 00:00:00 2001 From: Aleksey Proshutinskiy Date: Tue, 17 Sep 2024 16:20:45 +0300 Subject: [PATCH] feat(config,cpu,proofs): change cpu and batching defaults (#2377) * feat(defaults): change cpu and batching defaults default_min_batch_count=5 default_max_batch_count=30 default_max_proof_batch_size=128 default_system_cpu_count=1 default_cpus_range=1-total # we always leave 1 core to OS * Update crates/server-config/src/defaults.rs Co-authored-by: folex <0xdxdy@gmail.com> * Update crates/server-config/src/defaults.rs Co-authored-by: folex <0xdxdy@gmail.com> * fix: suggestions --------- Co-authored-by: folex <0xdxdy@gmail.com> --- crates/server-config/src/defaults.rs | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/crates/server-config/src/defaults.rs b/crates/server-config/src/defaults.rs index d0d3244d3e..59fa30272c 100644 --- a/crates/server-config/src/defaults.rs +++ b/crates/server-config/src/defaults.rs @@ -66,21 +66,17 @@ pub fn default_bootstrap_nodes() -> Vec { } pub fn default_system_cpu_count() -> usize { - let total = num_cpus::get_physical(); - match total { - x if x > 32 => 3, - x if x > 7 => 2, - _ => 1, - } + // always use 1 core for Nox's and CCP's system threads + // we use a simple constant here to make the behaviour as predictable as possible + 1 } pub fn default_cpus_range() -> Option { let total = num_cpus::get_physical(); - let left = match total { - // Leave 1 core to OS if there's 8+ cores - c if c >= 8 => 1, - _ => 0, - }; + + // always leave 0th core to OS + // we use a simple constant here to make the behaviour as predictable as possible + let left = 1; Some( CoreRange::try_from(Vec::from_iter(left..total).as_slice()) .expect("Cpu range can't be empty"), @@ -281,15 +277,18 @@ pub fn default_proof_poll_period() -> Duration { } pub fn default_min_batch_count() -> usize { - 1 + // Wait for at least 5 proofs before sending the tx to reduce TPS + 5 } pub fn default_max_batch_count() -> usize { - 4 + // 30 is the default minimal proof count per CU on the mainnet + 30 } pub fn default_max_proof_batch_size() -> usize { - 2 + // 128 is the average CU number on a single machine + 128 } pub fn default_epoch_end_window() -> Duration {