* [PATCH proxmox-mail-forward 1/2] pve-notify-worker: limit number of worker threads to 2
@ 2026-11-23 10:52 Lukas Wagner
2026-11-23 10:52 ` [PATCH proxmox-mail-forward 2/2] pve-notify-worker: cargo: only enable required tokio features Lukas Wagner
0 siblings, 1 reply; 2+ messages in thread
From: Lukas Wagner @ 2026-11-23 10:52 UTC (permalink / raw)
To: pve-devel
proxmox_async::runtime::main uses tokio's default multi-threaded
runtime, which spawns one worker thread per CPU core. That is wasteful
for pve-notify-worker, which spends most of its time sleeping between
polls of the notification queue.
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
pve-notify-worker/src/main.rs | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/pve-notify-worker/src/main.rs b/pve-notify-worker/src/main.rs
index 5f13b25..120b142 100644
--- a/pve-notify-worker/src/main.rs
+++ b/pve-notify-worker/src/main.rs
@@ -29,7 +29,15 @@ fn main() -> Result<(), Error> {
.journald()
.init()?;
- proxmox_async::runtime::main(run())
+ let runtime = proxmox_async::runtime::get_runtime_with_builder(|| {
+ let mut builder = tokio::runtime::Builder::new_multi_thread();
+ builder.enable_all();
+ builder.worker_threads(2);
+
+ builder
+ });
+
+ runtime.block_on(run())
}
async fn run() -> Result<(), Error> {
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH proxmox-mail-forward 2/2] pve-notify-worker: cargo: only enable required tokio features
2026-11-23 10:52 [PATCH proxmox-mail-forward 1/2] pve-notify-worker: limit number of worker threads to 2 Lukas Wagner
@ 2026-11-23 10:52 ` Lukas Wagner
0 siblings, 0 replies; 2+ messages in thread
From: Lukas Wagner @ 2026-11-23 10:52 UTC (permalink / raw)
To: pve-devel
The binary itself only needs 'rt-multi-thread' to build its runtime.
The other features it relies on, such as timers and signal handling,
are enabled by proxmox-notify and proxmox-daemon, so there is no need
to pull in all of tokio.
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
pve-notify-worker/Cargo.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pve-notify-worker/Cargo.toml b/pve-notify-worker/Cargo.toml
index 61738e9..7e6d2b0 100644
--- a/pve-notify-worker/Cargo.toml
+++ b/pve-notify-worker/Cargo.toml
@@ -10,7 +10,7 @@ homepage.workspace = true
[dependencies]
anyhow.workspace = true
futures.workspace = true
-tokio = { workspace = true, features = [ "full" ] }
+tokio = { workspace = true, features = [ "rt-multi-thread" ] }
tracing.workspace = true
common.workspace = true
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-23 10:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 10:52 [PATCH proxmox-mail-forward 1/2] pve-notify-worker: limit number of worker threads to 2 Lukas Wagner
2026-11-23 10:52 ` [PATCH proxmox-mail-forward 2/2] pve-notify-worker: cargo: only enable required tokio features Lukas Wagner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.