diff --git a/backend/telemetry_core/src/main.rs b/backend/telemetry_core/src/main.rs index 03320f6..3adc41a 100644 --- a/backend/telemetry_core/src/main.rs +++ b/backend/telemetry_core/src/main.rs @@ -62,7 +62,7 @@ struct Opts { /// Number of worker threads to spawn. Defaults to the number of CPUs on the machine. /// If "0" is given, use the number of CPUs available on the machine. #[structopt(long)] - num_cpus: Option, + worker_threads: Option, } fn main() { @@ -75,13 +75,13 @@ fn main() { log::info!("Starting Telemetry Core version: {}", VERSION); - let num_cpus_to_use = opts.num_cpus + let worker_threads = opts.worker_threads .and_then(|n| if n == 0 { None } else { Some(n) }) .unwrap_or_else(|| num_cpus::get()); tokio::runtime::Builder::new_multi_thread() .enable_all() - .worker_threads(num_cpus_to_use) + .worker_threads(worker_threads) .build() .unwrap() .block_on(async { diff --git a/backend/telemetry_core/tests/soak_tests.rs b/backend/telemetry_core/tests/soak_tests.rs index b1dab79..96c4e78 100644 --- a/backend/telemetry_core/tests/soak_tests.rs +++ b/backend/telemetry_core/tests/soak_tests.rs @@ -76,11 +76,11 @@ async fn run_soak_test(opts: SoakTestOpts) { let mut server = start_server( true, CoreOpts { - num_cpus: opts.num_core_cpus, + worker_threads: opts.core_worker_threads, ..Default::default() }, ShardOpts { - num_cpus: opts.num_shard_cpus, + worker_threads: opts.shard_worker_threads, ..Default::default() }, ).await; @@ -259,11 +259,11 @@ async fn run_realistic_soak_test(opts: SoakTestOpts) { let mut server = start_server( true, CoreOpts { - num_cpus: opts.num_core_cpus, + worker_threads: opts.core_worker_threads, ..Default::default() }, ShardOpts { - num_cpus: opts.num_shard_cpus, + worker_threads: opts.shard_worker_threads, ..Default::default() }, ).await; @@ -394,10 +394,10 @@ struct SoakTestOpts { nodes: usize, /// Number of worker threads the core will use #[structopt(long)] - num_core_cpus: Option, + core_worker_threads: Option, /// Number of worker threads each shard will use #[structopt(long)] - num_shard_cpus: Option, + shard_worker_threads: Option, } /// Get soak test args from an envvar and parse them via structopt. diff --git a/backend/telemetry_shard/src/main.rs b/backend/telemetry_shard/src/main.rs index 43159bd..abcdc30 100644 --- a/backend/telemetry_shard/src/main.rs +++ b/backend/telemetry_shard/src/main.rs @@ -83,7 +83,7 @@ struct Opts { /// Number of worker threads to spawn. Defaults to the number of CPUs on the machine. /// If "0" is given, use the number of CPUs available on the machine. #[structopt(long)] - num_cpus: Option, + worker_threads: Option, } fn main() { @@ -96,13 +96,13 @@ fn main() { log::info!("Starting Telemetry Shard version: {}", VERSION); - let num_cpus_to_use = opts.num_cpus + let worker_threads = opts.worker_threads .and_then(|n| if n == 0 { None } else { Some(n) }) .unwrap_or_else(|| num_cpus::get()); tokio::runtime::Builder::new_multi_thread() .enable_all() - .worker_threads(num_cpus_to_use) + .worker_threads(worker_threads) .build() .unwrap() .block_on(async { diff --git a/backend/test_utils/src/workspace/start_server.rs b/backend/test_utils/src/workspace/start_server.rs index a51d0ed..7630bda 100644 --- a/backend/test_utils/src/workspace/start_server.rs +++ b/backend/test_utils/src/workspace/start_server.rs @@ -20,14 +20,14 @@ use crate::server::{self, Command, Server}; /// Additional options to pass to the core command. pub struct CoreOpts { pub feed_timeout: Option, - pub num_cpus: Option, + pub worker_threads: Option, } impl Default for CoreOpts { fn default() -> Self { Self { feed_timeout: None, - num_cpus: None + worker_threads: None } } } @@ -37,7 +37,7 @@ pub struct ShardOpts { pub max_nodes_per_connection: Option, pub max_node_data_per_second: Option, pub node_block_seconds: Option, - pub num_cpus: Option, + pub worker_threads: Option, } impl Default for ShardOpts { @@ -46,7 +46,7 @@ impl Default for ShardOpts { max_nodes_per_connection: None, max_node_data_per_second: None, node_block_seconds: None, - num_cpus: None + worker_threads: None } } } @@ -120,9 +120,9 @@ pub async fn start_server( .arg("--node-block-seconds") .arg(val.to_string()); } - if let Some(val) = shard_opts.num_cpus { + if let Some(val) = shard_opts.worker_threads { shard_command = shard_command - .arg("--num-cpus") + .arg("--worker-threads") .arg(val.to_string()); } @@ -138,8 +138,8 @@ pub async fn start_server( if let Some(val) = core_opts.feed_timeout { core_command = core_command.arg("--feed-timeout").arg(val.to_string()); } - if let Some(val) = core_opts.num_cpus { - core_command = core_command.arg("--num-cpus").arg(val.to_string()); + if let Some(val) = core_opts.worker_threads { + core_command = core_command.arg("--worker-threads").arg(val.to_string()); } // Star the server