From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 4C2181FF0B3 for ; Thu, 26 Nov 2026 17:09:08 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 0BBA421684; Thu, 26 Nov 2026 17:09:08 +0100 (CET) From: Jakob Klocker To: pdm-devel@lists.proxmox.com Subject: [PATCH proxmox-datacenter-manager 0/2] fix #7731: metric collection: fetch large PVE clusters node by node Date: Thu, 26 Nov 2026 17:07:05 +0100 Message-ID: <20261126160707.333024-1-j.klocker@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795709343517 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.946 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: UNEB6NNQFAB4OLJA5VVBBKQPCVK77PKD X-Message-ID-Hash: UNEB6NNQFAB4OLJA5VVBBKQPCVK77PKD X-MailFrom: j.klocker@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On larger PVE clusters, metric collection fails completely: the cluster-wide /cluster/metrics/export request makes the node handling it fetch the metrics of all other cluster members one after another, which can take longer than pveproxy's 30 second request timeout. The reporter measured ~2m40s for a 25 node cluster [0][1]. This series fetches the metrics of clusters with at least 3 nodes node by node, using the `node-list` parameter of the export endpoint. Every request then only covers a single node and stays below the timeout. PVE versions without `node-list` fall back to the cluster-wide request. The nodes are fetched sequentially. A parallel version was implemented and tested first, but turned out to be unreliable: a node whose API does not answer blocks the pveproxy worker on the endpoint for 20 seconds, and other requests that end up on the same worker are cut off. The first patch describes this in detail. As metric collection runs in the background, reliability was preferred over speed. Testing: Tested on a 5-node PVE 9.2 cluster (10 containers per node), a 2-node cluster and a single PVE 8 node: - 5 nodes: one request per node, strictly one after another (checked with temporary log lines and the pveproxy access log). - 2 nodes: unchanged, a single cluster-wide request. - Node powered off: answered immediately with an empty result, all other nodes are collected as usual. - Node API unreachable (pveproxy stopped, packets dropped): ~20s longer, as before, without losing any other node. With parallel requests, a healthy node was lost in ~3 of 5 runs. - PVE 8 without `node-list`: the request is rejected and the cluster-wide fallback is used. Fetching node by node adds no measurable overhead: a full collection (full metric history, ~10.5 MB) took ~1.6s through PDM, the same as the previous single cluster-wide request. Possible follow-ups: - PVE: the export endpoint forwards the request to other nodes itself, using a blocking HTTP client (20s timeout), similar to what `proxyto` does for node-scoped endpoints. Unlike `proxyto`, which pveproxy handles asynchronously, this blocks the worker and affects all other connections on it. A node-scoped export endpoint using `proxyto` would avoid this and would allow fetching the nodes in parallel. - PDM: querying each node directly at its own endpoint with `local-only` would avoid the fan-out entirely and would allow fetching the nodes in parallel again. After some discussion with Lukas, I decided not to pursue any of these follow-ups for now, as a broader refactoring of metric collection might make more sense, for example, adding a mechanism to directly import a product's RRD database, including the entire history. [0] https://bugzilla.proxmox.com/show_bug.cgi?id=7731 [1] https://forum.proxmox.com/threads/getting-client-timeouts-in-pdm-system-log.184344/#post-858021 proxmox-datacenter-manager: Jakob Klocker (2): fix #7731: metric collection: fetch large PVE clusters node by node metric collection: add tests for fetching PVE clusters node by node .../remote_collection_task.rs | 376 ++++++++++++++++-- 1 file changed, 352 insertions(+), 24 deletions(-) Summary over all repositories: 1 files changed, 352 insertions(+), 24 deletions(-) -- Generated by murpp 0.12.0