public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH proxmox-mail-forward 1/2] pve-notify-worker: limit number of worker threads to 2
Date: Mon, 23 Nov 2026 11:52:35 +0100	[thread overview]
Message-ID: <20261123105236.212117-1-l.wagner@proxmox.com> (raw)

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





             reply	other threads:[~2026-11-23 10:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 10:52 Lukas Wagner [this message]
2026-11-23 10:52 ` [PATCH proxmox-mail-forward 2/2] pve-notify-worker: cargo: only enable required tokio features Lukas Wagner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261123105236.212117-1-l.wagner@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal