Skip to content

Commit

Permalink
feat(config,cpu,proofs): change cpu and batching defaults (#2377)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
justprosh and folex authored Sep 17, 2024
1 parent 0215f90 commit da7f90e
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions crates/server-config/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,17 @@ pub fn default_bootstrap_nodes() -> Vec<Multiaddr> {
}

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<CoreRange> {
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"),
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit da7f90e

Please sign in to comment.