public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: Daniel Kral <d.kral@proxmox.com>,
	Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH ha-manager 1/9] implement static service stats cache
Date: Fri, 17 Oct 2025 12:02:50 +0200	[thread overview]
Message-ID: <55218253-d4cf-4846-8d9f-9fc8610a094a@proxmox.com> (raw)
In-Reply-To: <DDJUG5YKH96F.2H9FAGCGRML1A@proxmox.com>

Am 16.10.25 um 5:15 PM schrieb Daniel Kral:
> On Thu Oct 16, 2025 at 1:12 PM CEST, Fiona Ebner wrote:
>> Am 30.09.25 um 4:21 PM schrieb Daniel Kral:
>>> @@ -497,6 +499,25 @@ 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} // {};
>>
>> Can't returning '{}' when nothing is there lead to issues down the line?
>> If we return undef instead, it's consistent with not having anything
>> cached and the caller will fall back to loading the config.
> 
> This return value type definitely needs improvement and/or better
> documentation, but an undef $self->{static_service_stats}->{$id} value
> indicates that it should fallback to the default value as none of the
> properties requested by get_guest_config_properties(...) was included in
> that particular guest config, e.g. no 'cores', 'sockets', and 'memory'
> properties defined in a VM config.
> When $self->{static_service_stats} itself is undef, then the static
> cache couldn't be queried for some reason.

Okay, so get_guest_config_properties() only includes guests that do have
one of the queried properties explicitly set in its result. Thus, we
cannot distinguish between the cache being created at a time when a
guest did not exist yet or a guest with none of the queried properties
explicitly set. If returning {} as a fallback, we get the wrong values
in the former case, if returning undef as a fallback, we just have to
explicitly load the config in the latter case. There probably are not
many setups with many guests without any of the queried properties
explicitly set, so that is unlikely to hurt performance in practice.


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


  reply	other threads:[~2025-10-17 10:02 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-30 14:19 [pve-devel] [RFC ha-manager/perl-rs/proxmox/qemu-server 00/12] Granular online_node_usage accounting Daniel Kral
2025-09-30 14:19 ` [pve-devel] [PATCH qemu-server 1/1] config: only fetch necessary default values in get_derived_property helper Daniel Kral
2025-10-15 14:31   ` Fiona Ebner
2025-10-16  9:07     ` Daniel Kral
2025-09-30 14:19 ` [pve-devel] [PATCH proxmox 1/1] resource-scheduling: change score_nodes_to_start_service signature Daniel Kral
2025-09-30 14:19 ` [pve-devel] [PATCH perl-rs 1/1] pve-rs: resource_scheduling: allow granular usage changes Daniel Kral
2025-10-16 10:32   ` Fiona Ebner
2025-10-16 15:34     ` Daniel Kral
2025-10-17 10:55       ` Fiona Ebner
2025-09-30 14:19 ` [pve-devel] [PATCH ha-manager 1/9] implement static service stats cache Daniel Kral
2025-10-16 11:12   ` Fiona Ebner
2025-10-16 15:15     ` Daniel Kral
2025-10-17 10:02       ` Fiona Ebner [this message]
2025-10-17 10:08         ` Fiona Ebner
2025-10-17 16:18           ` Daniel Kral
2025-09-30 14:19 ` [pve-devel] [PATCH ha-manager 2/9] manager: remove redundant recompute_online_node_usage from next_state_recovery Daniel Kral
2025-10-16 11:25   ` Fiona Ebner
2025-09-30 14:19 ` [pve-devel] [PATCH ha-manager 3/9] manager: remove redundant add_service_usage_to_node " Daniel Kral
2025-10-16 11:33   ` Fiona Ebner
2025-09-30 14:19 ` [pve-devel] [PATCH ha-manager 4/9] manager: remove redundant add_service_usage_to_node from next_state_started Daniel Kral
2025-10-16 11:39   ` Fiona Ebner
2025-09-30 14:19 ` [pve-devel] [PATCH ha-manager 5/9] rules: resource affinity: decouple get_resource_affinity helper from Usage class Daniel Kral
2025-10-17 11:14   ` Fiona Ebner
2025-10-17 15:46     ` Daniel Kral
2025-10-20 15:18       ` Fiona Ebner
2025-09-30 14:19 ` [pve-devel] [PATCH ha-manager 6/9] manager: make recompute_online_node_usage use get_service_nodes helper Daniel Kral
2025-10-17 11:25   ` Fiona Ebner
2025-09-30 14:19 ` [pve-devel] [PATCH ha-manager 7/9] usage: allow granular changes to Usage implementations Daniel Kral
2025-10-17 11:57   ` Fiona Ebner
2025-09-30 14:19 ` [pve-devel] [PATCH ha-manager 8/9] manager: make online node usage computation granular Daniel Kral
2025-10-17 12:32   ` Fiona Ebner
2025-10-17 16:07     ` Daniel Kral
2025-09-30 14:19 ` [pve-devel] [PATCH ha-manager 9/9] manager: make service node usage computation more granular Daniel Kral
2025-10-17 12:42   ` Fiona Ebner
2025-10-17 15:59     ` Daniel Kral
2025-10-20 16:50 ` [pve-devel] superseded: [RFC ha-manager/perl-rs/proxmox/qemu-server 00/12] Granular online_node_usage accounting Daniel Kral

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=55218253-d4cf-4846-8d9f-9fc8610a094a@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=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