From 8bd138c3bd98dade236315456e4885ce917377d7 Mon Sep 17 00:00:00 2001 From: Alexey Proshutinskiy Date: Tue, 17 Sep 2024 15:31:51 +0300 Subject: [PATCH 1/4] 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 --- crates/server-config/src/defaults.rs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/crates/server-config/src/defaults.rs b/crates/server-config/src/defaults.rs index d0d3244d3e..23d6c754e5 100644 --- a/crates/server-config/src/defaults.rs +++ b/crates/server-config/src/defaults.rs @@ -66,21 +66,14 @@ 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, - } + 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, - }; + + // Leave 1 core to OS + let left = 1; Some( CoreRange::try_from(Vec::from_iter(left..total).as_slice()) .expect("Cpu range can't be empty"), @@ -281,15 +274,15 @@ pub fn default_proof_poll_period() -> Duration { } pub fn default_min_batch_count() -> usize { - 1 + 5 } pub fn default_max_batch_count() -> usize { - 4 + 30 } pub fn default_max_proof_batch_size() -> usize { - 2 + 128 } pub fn default_epoch_end_window() -> Duration { From e508cce3780a7c612f18bb9a1924bedd92f23ee5 Mon Sep 17 00:00:00 2001 From: Aleksey Proshutinskiy Date: Tue, 17 Sep 2024 15:35:32 +0300 Subject: [PATCH 2/4] Update crates/server-config/src/defaults.rs Co-authored-by: folex <0xdxdy@gmail.com> --- crates/server-config/src/defaults.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/server-config/src/defaults.rs b/crates/server-config/src/defaults.rs index 23d6c754e5..27477751c7 100644 --- a/crates/server-config/src/defaults.rs +++ b/crates/server-config/src/defaults.rs @@ -66,6 +66,8 @@ pub fn default_bootstrap_nodes() -> Vec { } pub fn default_system_cpu_count() -> usize { + // 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 } From 4491bf7d6f0d9f8264082a4eb53af6127e248dc0 Mon Sep 17 00:00:00 2001 From: Aleksey Proshutinskiy Date: Tue, 17 Sep 2024 15:42:17 +0300 Subject: [PATCH 3/4] Update crates/server-config/src/defaults.rs Co-authored-by: folex <0xdxdy@gmail.com> --- crates/server-config/src/defaults.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/server-config/src/defaults.rs b/crates/server-config/src/defaults.rs index 27477751c7..8736a7f75a 100644 --- a/crates/server-config/src/defaults.rs +++ b/crates/server-config/src/defaults.rs @@ -74,7 +74,8 @@ pub fn default_system_cpu_count() -> usize { pub fn default_cpus_range() -> Option { let total = num_cpus::get_physical(); - // Leave 1 core to OS + // 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()) From 1f4278edee12ec2b3a654d06854c243efdeab82e Mon Sep 17 00:00:00 2001 From: folex <0xdxdy@gmail.com> Date: Tue, 17 Sep 2024 15:45:11 +0300 Subject: [PATCH 4/4] fix: suggestions --- crates/server-config/src/defaults.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/server-config/src/defaults.rs b/crates/server-config/src/defaults.rs index 8736a7f75a..59fa30272c 100644 --- a/crates/server-config/src/defaults.rs +++ b/crates/server-config/src/defaults.rs @@ -277,14 +277,17 @@ pub fn default_proof_poll_period() -> Duration { } pub fn default_min_batch_count() -> usize { + // Wait for at least 5 proofs before sending the tx to reduce TPS 5 } pub fn default_max_batch_count() -> usize { + // 30 is the default minimal proof count per CU on the mainnet 30 } pub fn default_max_proof_batch_size() -> usize { + // 128 is the average CU number on a single machine 128 }