Skip to content

Commit aa419d3

Browse files
committed
fix: worker amount is not affected by containerd
1 parent b5c97cd commit aa419d3

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

pulsebeam/src/main.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ use tokio_util::sync::CancellationToken;
55
#[global_allocator]
66
static GLOBAL: MiMalloc = MiMalloc;
77

8-
use std::net::{IpAddr, SocketAddr};
8+
use std::{
9+
net::{IpAddr, SocketAddr},
10+
num::NonZeroUsize,
11+
};
912

1013
use pulsebeam::node;
1114
use systemstat::{IpAddr as SysIpAddr, Platform, System};
@@ -20,13 +23,7 @@ fn main() {
2023
.pretty()
2124
.init();
2225

23-
let logical_cpus = num_cpus::get();
24-
let physical_cpus = num_cpus::get_physical();
25-
// Compute optimal worker threads for CPU-bound SFU tasks
26-
let workers = logical_cpus.min(physical_cpus);
27-
28-
tracing::info!("detected logical CPUs: {}", logical_cpus);
29-
tracing::info!("detected physical CPUs: {}", physical_cpus);
26+
let workers = std::thread::available_parallelism().map_or(1, NonZeroUsize::get);
3027
tracing::info!("using {} worker threads", workers);
3128

3229
let rt = tokio::runtime::Builder::new_multi_thread()

0 commit comments

Comments
 (0)