rt: set worker thread count
use at least 2 but at most 4 worker threads Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
b8cb8723bd
commit
53d40ceeab
@ -12,9 +12,10 @@ homepage = "https://www.proxmox.com"
|
|||||||
exclude = [ "build", "debian" ]
|
exclude = [ "build", "debian" ]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bitflags = "1.2"
|
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
|
bitflags = "1.2"
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
nix = "0.24"
|
nix = "0.24"
|
||||||
|
num_cpus = "1"
|
||||||
tokio = { version = "1.0", features = [ "rt-multi-thread", "io-util", "net" ] }
|
tokio = { version = "1.0", features = [ "rt-multi-thread", "io-util", "net" ] }
|
||||||
|
@ -101,7 +101,13 @@ fn main() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let rt = tokio::runtime::Runtime::new().expect("failed to spawn tokio runtime");
|
let cpus = num_cpus::get();
|
||||||
|
|
||||||
|
let rt = tokio::runtime::Builder::new_multi_thread()
|
||||||
|
.enable_all()
|
||||||
|
.worker_threads(cpus.max(2).min(4))
|
||||||
|
.build()
|
||||||
|
.expect("failed to spawn tokio runtime");
|
||||||
|
|
||||||
if let Err(err) = rt.block_on(do_main(use_sd_notify, path)) {
|
if let Err(err) = rt.block_on(do_main(use_sd_notify, path)) {
|
||||||
eprintln!("error: {}", err);
|
eprintln!("error: {}", err);
|
||||||
|
Loading…
Reference in New Issue
Block a user