public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Daniel Kral" <d.kral@proxmox.com>
To: "Proxmox VE development discussion" <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH ha-manager v2 8/8] implement static service stats cache
Date: Thu, 23 Oct 2025 18:19:48 +0200	[thread overview]
Message-ID: <DDPU6Z6V1J58.1DF04LARQ37WE@proxmox.com> (raw)
In-Reply-To: <20251020164540.517231-13-d.kral@proxmox.com>

On Mon Oct 20, 2025 at 6:45 PM CEST, Daniel Kral wrote:
> @@ -502,6 +504,39 @@ sub get_datacenter_settings {
>      };
>  }
>  
> +sub get_static_service_stats {
> +    my ($self, $id) = @_;
> +
> +    # undef if update_static_service_stats(...) failed before
> +    return undef if !defined($self->{static_service_stats});
> +
> +    return $self->{static_service_stats}->{$id};
> +}
> +
> +sub update_static_service_stats {
> +    my ($self) = @_;
> +
> +    my $properties = ['cores', 'cpulimit', 'memory', 'sockets', 'vcpus'];
> +    my $service_stats = eval {
> +        my $stats = PVE::Cluster::get_guest_config_properties($properties);
> +
> +        # get_guest_config_properties(...) doesn't add guests which do not
> +        # specify any of the given properties, but we need to make a distinction
> +        # between "not cached" and "not specified" here
> +        my $vmlist = PVE::Cluster::get_vmlist();
> +        for my $id (keys %$vmlist) {

I'm sorry, this is obviously wrong, it should be

    my $vmlist = PVE::Cluster::get_vmlist() // {};
    my $idlist = $vmlist->{ids} // {};
    for my $id (keys %$idlist) {

here. This will only result in performance degradation as all guests
without any of the given guest config $properties specified will then
fallback to reading their guest config directly.

If nothing else comes up until Tuesday I'll send a v3 or a follow up.

@Fiona, can I still apply your R-b then?

> +            next if defined($stats->{$id});
> +
> +            $stats->{$id} = {};
> +        }
> +
> +        return $stats;
> +    };
> +    $self->log('warning', "unable to update static service stats cache - $@") if $@;
> +
> +    $self->{static_service_stats} = $service_stats;
> +}



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


      parent reply	other threads:[~2025-10-23 16:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-20 16:45 [pve-devel] [PATCH ha-manager/perl-rs/proxmox/qemu-server v2 00/12] Granular online_node_usage accounting Daniel Kral
2025-10-20 16:45 ` [pve-devel] [PATCH qemu-server v2 1/1] config: only fetch necessary default values in get_derived_property helper Daniel Kral
2025-10-21 11:47   ` [pve-devel] applied: " Fiona Ebner
2025-10-20 16:45 ` [pve-devel] [PATCH proxmox v2 1/1] resource-scheduling: change score_nodes_to_start_service signature Daniel Kral
2025-10-21 12:14   ` Fiona Ebner
2025-10-20 16:45 ` [pve-devel] [PATCH perl-rs v2 1/2] pve-rs: resource_scheduling: allow granular usage changes Daniel Kral
2025-10-20 16:45 ` [pve-devel] [PATCH perl-rs v2 2/2] test: resource_scheduling: use score_nodes helper to imitate HA Manager Daniel Kral
2025-10-21 12:14   ` Fiona Ebner
2025-10-20 16:45 ` [pve-devel] [PATCH ha-manager v2 1/8] manager: remove redundant recompute_online_node_usage from next_state_recovery Daniel Kral
2025-10-20 16:45 ` [pve-devel] [PATCH ha-manager v2 2/8] manager: remove redundant add_service_usage_to_node " Daniel Kral
2025-10-20 16:45 ` [pve-devel] [PATCH ha-manager v2 3/8] manager: remove redundant add_service_usage_to_node from next_state_started Daniel Kral
2025-10-20 16:45 ` [pve-devel] [PATCH ha-manager v2 4/8] rules: resource affinity: decouple get_resource_affinity helper from Usage class Daniel Kral
2025-10-21 13:02   ` Fiona Ebner
2025-10-23  8:20     ` Daniel Kral
2025-10-20 16:45 ` [pve-devel] [PATCH ha-manager v2 5/8] manager: make recompute_online_node_usage use add_service_usage helper Daniel Kral
2025-10-21 13:06   ` Fiona Ebner
2025-10-20 16:45 ` [pve-devel] [PATCH ha-manager v2 6/8] usage: allow granular changes to Usage implementations Daniel Kral
2025-10-20 16:45 ` [pve-devel] [PATCH ha-manager v2 7/8] manager: make online node usage computation granular Daniel Kral
2025-10-21 13:09   ` Fiona Ebner
2025-10-20 16:45 ` [pve-devel] [PATCH ha-manager v2 8/8] implement static service stats cache Daniel Kral
2025-10-21 13:23   ` Fiona Ebner
2025-10-23 16:19   ` Daniel Kral [this message]

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=DDPU6Z6V1J58.1DF04LARQ37WE@proxmox.com \
    --to=d.kral@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