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 D3E171FF0B4 for ; Fri, 27 Nov 2026 10:54:20 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 753A6216F5; Fri, 27 Nov 2026 10:54:20 +0100 (CET) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 27 Nov 2026 10:54:16 +0100 Message-Id: Subject: Re: [PATCH proxmox-datacenter-manager 1/2] fix #7731: metric collection: fetch large PVE clusters node by node From: "Lukas Wagner" To: "Jakob Klocker" , X-Mailer: aerc 0.22.0-0-gc2f86b7abde3 References: <20261126160707.333024-1-j.klocker@proxmox.com> <20261126160707.333024-2-j.klocker@proxmox.com> In-Reply-To: <20261126160707.333024-2-j.klocker@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795773256908 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.034 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: ONEKVLOVK2KLSRIYK24TMCUVR4Y5AKU4 X-Message-ID-Hash: ONEKVLOVK2KLSRIYK24TMCUVR4Y5AKU4 X-MailFrom: l.wagner@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 Thu Nov 26, 2026 at 5:07 PM CET, Jakob Klocker wrote: > On larger clusters, a single cluster-wide /cluster/metrics/export > request can take longer than pveproxy's 30 second request timeout, as > the node handling it fetches the metrics of all other cluster members > one after another. The reporter [0] measured ~2m40s for a 25-node > cluster, so no metrics were collected for such clusters at all. > > For clusters with at least 3 nodes, request the metrics of each node > separately via the `node-list` parameter and merge the results. At > ~6.5 seconds per node with the full metric history, even a few nodes > can exceed the timeout. PVE versions without `node-list` reject the > parameter, so the cluster-wide request is used for those instead. > > Fetching the nodes in parallel through one cluster node turned out to > be unreliable. The export endpoint fetches the metrics of the requested > node with a blocking HTTP request (timeout 20s), so a node whose API > does not answer freezes the pveproxy worker handling that request for > 20 seconds. A worker handles its connections one at a time, and > parallel requests often end up on the same worker. pveproxy's 5 second > inactivity timeout expires during the freeze, so the other connections > on that worker are closed: responses are cut off or requests dropped. > On a 5-node test cluster with one node's API unreachable, this lost the > metrics of a healthy node in most runs. > > As metric collection runs in the background and has to be reliable > rather than fast, fetch the nodes one after another, so no request can > wait behind a blocked worker. Parallel fetching would become safe if > each node were queried directly at its own endpoint. > Looks mostly good so far from a first look. As discussed off-list already, I think this could be improved by extending the state file to have per-node timestamps for the most recent datapoint. Right now, there is a single timestamp that will be used for the starttime of the next request, meaning that an offline cluster node coming back online will not be backfilled with the still available history. One thing we dicussed was also the threshold used to switch to the per-node mode. Three nodes is a rather low limit, but given the measured data from the bug report it seems reasonable. It's so low that it *could* make sense to just always fetch per node, which would also fix the behavior decribed already for smaller setups (where a node coming back online would cause a gap in the metrics). And as you also mentioned, we need to investigate better methods for fetching metrics (such as directly importing the history from the product's RRD DB), but this is a much larger task.