From: "Dominik Rusovac" <d.rusovac@proxmox.com>
To: "Daniel Kral" <d.kral@proxmox.com>, <pve-devel@lists.proxmox.com>
Subject: Re: [PATCH proxmox v2 06/19] fix #7993: resource-scheduling: scheduler: add weights
Date: Thu, 19 Nov 2026 14:52:38 +0100 [thread overview]
Message-ID: <DMZ8JUJZZ8MM.185LSVQ0ZPXE0@proxmox.com> (raw)
In-Reply-To: <DMZ708HZS6D0.26KL5P0JR38QU@proxmox.com>
On Thu Nov 19, 2026 at 1:40 PM CET, Daniel Kral wrote:
> On Thu Nov 12, 2026 at 10:44 AM CET, Dominik Rusovac wrote:
>> CRS did not rebalance a cluster that was clearly imbalanced in CPU load
>> or memory usage alone, because the combined node load looked balanced
>> enough [0]
>>
>> add weights to the scheduler, so that callers can prioritize balancing
>> one resource over the other
>>
>> load imbalance computations and the bruteforce method use the weighted
>> node load
>>
>> for the TOPSIS methods, the weights replace the hardcoded criteria
>> weights from commit 2b325aa5 ("add pve_static module"). those favor
>> memory usage 5 times over CPU load. Scaling them with the weights
>> instead would make the weights relative to that built-in emphasis, so
>> 1:1 would effectively mean 1:5, which is undesirable. only the factor of
>> 2 between the criteria for the highest and the average usage of each
>> resource is kept, so custom weights of 1:5 reproduce the previous
>> criteria weights of 1:5 (average) and 2:10 (highest)
>>
>> the same weights are used for the TOPSIS criteria and the node load, so
>> the imbalance reported for the migrations ranked by TOPSIS is weighted
>> like the criteria that ranked them
>>
>> the weights default to 1:1. This changes the default ranking of the
>> TOPSIS methods (expected result of one affected test was adjusted), so
>> callers have to pass hardcoded legacy topsis weights to keep their
>> previous rankings. with these, the node load is weighted 1:5 as well and
>> the previous rankings are preserved, which is also being tested
>>
>> [0] https://bugzilla.proxmox.com/show_bug.cgi?id=7993
>>
>> Signed-off-by: Dominik Rusovac <d.rusovac@proxmox.com>
>> ---
>>
>> Notes:
>> new with changes regarding patch [0] in v1:
>> * add weights as field to Scheduler struct
>> * weigh the TOPSIS criteria directly with the weights, keeping the factor
>> of 2 between the highest and the average usage criteria of each resource
>> - weights of 1:5 reproduce the previous criteria weights 1, 2, 5, 10
>> - add LEGACY_TOPSIS_WEIGHTS for callers keeping the previous rankings
>> * fall back to previous TOPSIS ranking of migration candidates
>> * no longer expose score and keep ScoredMigration as is
>> * adjust one scheduler test's expected result
>> * test that legacy topsis weights preserve previous rankings
>>
>> [0] https://lore.proxmox.com/all/20261021085932.1196302-4-d.rusovac@proxmox.com/
>>
>> proxmox-resource-scheduling/src/pve_static.rs | 4 +-
>> proxmox-resource-scheduling/src/scheduler.rs | 105 ++++++++++++++----
>> .../tests/scheduler.rs | 64 ++++++++++-
>> 3 files changed, 149 insertions(+), 24 deletions(-)
[snip]
>> - const N_CRITERIA;
>> - static PVE_HA_TOPSIS_CRITERIA;
>> +/// Factor to compute the weight of the criterion for the highest usage of a resource relative to
>> +/// the criterion for the average usage of that resource. This keeps the ratio of the criteria
>> +/// weights introduced in commit 2b325aa5.
>
> nit: include the commit title here, i.e.
>
> 2b325aa5 ("add pve_static module")
>
ack
>> +///
>> +/// For more details see [`topsis_criteria`].
>> +const TOPSIS_HIGHEST_USAGE_FACTOR: f64 = 2.0;
>> +
>> +/// Weights that reproduce the TOPSIS criteria weights introduced in commit 2b325aa5 with
>
> here as well
>
ack
>> +/// [`topsis_criteria`].
>> +pub const LEGACY_TOPSIS_WEIGHTS: NodeStatsWeights = NodeStatsWeights {
>> + cpu_weight: 1.0,
>> + mem_weight: 5.0,
>> +};
>> +
>> +/// Returns the TOPSIS criteria for a [`PveTopsisAlternative`], weighted by `weights`.
>> +///
>> +/// The criteria for the average usage of each resource get the respective weight in `weights`,
>> +/// the criteria for the highest usage get [`TOPSIS_HIGHEST_USAGE_FACTOR`] times that weight.
>> +fn topsis_criteria(weights: &NodeStatsWeights) -> Result<topsis::Criteria<N_CRITERIA>, Error> {
>
> nit: topsis_criteria_from_weights() or make this a method of Scheduler,
> which is its only user
>
I had `topsis_criteria_from_weights` at some point, can go back to it
[snip]
>> fn new_empty_cluster_scheduler() -> Scheduler {
>> @@ -317,7 +317,7 @@ fn test_score_homogeneous_nodes_to_start_resource() -> Result<(), Error> {
>
> is the scheduler here intentionally not augmented with
>
> .with_weights(LEGACY_TOPSIS_WEIGHTS) ?
>
yes, the existing tests are meant to check the default (equal) weights,
while test_legacy_topsis_weights_keep_unweighted_rankings covers the
legacy weights
good catch tho, using the weights for the heterogeneous one is
inconsistent with that, will drop it there and adapt its expected
rankings in v3
>>
>> assert_eq!(
>> rank_nodes_to_start_resource(&scheduler, combined_resource_stats)?,
>> - vec!["node2", "node3", "node1"]
>> + vec!["node1", "node3", "node2"]
>> );
>>
>> Ok(())
>> @@ -325,7 +325,7 @@ fn test_score_homogeneous_nodes_to_start_resource() -> Result<(), Error> {
>>
>> #[test]
>> fn test_score_heterogeneous_nodes_to_start_resource() -> Result<(), Error> {
>> - let scheduler = new_heterogeneous_cluster_scheduler();
>> + let scheduler = new_heterogeneous_cluster_scheduler().with_weights(LEGACY_TOPSIS_WEIGHTS);
>>
will drop it here ^
[snip]
next prev parent reply other threads:[~2026-11-19 13:52 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 9:44 [RFC PATCH-SERIES cluster/ha-manager/manager/proxmox{,-perl-rs} v2 00/19] fix #7993: implement weighted crs load balancing Dominik Rusovac
2026-11-12 9:44 ` [PATCH proxmox v2 01/19] resource-scheduling: fix typos Dominik Rusovac
2026-11-19 12:27 ` Daniel Kral
2026-11-12 9:44 ` [PATCH proxmox v2 02/19] resource-scheduling: scheduler: refine score_* docs Dominik Rusovac
2026-11-19 12:27 ` Daniel Kral
2026-11-19 12:47 ` Dominik Rusovac
2026-11-12 9:44 ` [PATCH proxmox v2 03/19] resource-scheduling: scheduler: abstract post-migration stats logic Dominik Rusovac
2026-11-19 12:28 ` Daniel Kral
2026-11-19 12:47 ` Dominik Rusovac
2026-11-12 9:44 ` [PATCH proxmox v2 04/19] fix #7993: resource-scheduling: node: add weighted node load Dominik Rusovac
2026-11-19 12:28 ` Daniel Kral
2026-11-19 12:50 ` Dominik Rusovac
2026-11-12 9:44 ` [PATCH proxmox v2 05/19] resource-scheduling: scheduler: make imbalance with candidate public Dominik Rusovac
2026-11-19 12:41 ` Daniel Kral
2026-11-19 12:52 ` Dominik Rusovac
2026-11-12 9:44 ` [PATCH proxmox v2 06/19] fix #7993: resource-scheduling: scheduler: add weights Dominik Rusovac
2026-11-19 12:40 ` Daniel Kral
2026-11-19 13:52 ` Dominik Rusovac [this message]
2026-11-12 9:44 ` [PATCH proxmox v2 07/19] workspace,resource-scheduling: add proptest as dev-dependency Dominik Rusovac
2026-11-12 9:44 ` [PATCH proxmox v2 08/19] resource-scheduling: scheduler: add property tests for weights Dominik Rusovac
2026-11-12 9:44 ` [PATCH proxmox-perl-rs v2 09/19] fix #7993: pve-rs: resource-scheduling: add scheduler options Dominik Rusovac
2026-11-19 12:45 ` Daniel Kral
2026-11-19 13:28 ` Dominik Rusovac
2026-11-12 9:44 ` [PATCH pve-cluster v2 10/19] fix #7993: datacenter config: ad ha-{cpu,mem}-weight crs options Dominik Rusovac
2026-11-12 9:44 ` [PATCH pve-manager v2 11/19] ui: form: crs options: make fine-tuning options advanced Dominik Rusovac
2026-11-12 9:44 ` [PATCH pve-manager v2 12/19] fix #7993: ui: form: crs options: add weights Dominik Rusovac
2026-11-12 9:44 ` [PATCH pve-ha-manager v2 13/19] manager: remove obsolete argument Dominik Rusovac
2026-11-12 9:44 ` [PATCH pve-ha-manager v2 14/19] manager: rename update_crs_scheduler_mod to update_crs_settings Dominik Rusovac
2026-11-12 9:44 ` [PATCH pve-ha-manager v2 15/19] manager: factor out crs option update helper Dominik Rusovac
2026-11-12 9:44 ` [PATCH pve-ha-manager v2 16/19] manager: log changes to crs settings Dominik Rusovac
2026-11-12 9:44 ` [PATCH pve-ha-manager v2 17/19] sim: hardware: allow changing datacenter settings at runtime Dominik Rusovac
2026-11-12 9:44 ` [PATCH pve-ha-manager v2 18/19] fix #7993: manager,usage: use weights for static and dynamic mode Dominik Rusovac
2026-11-12 9:44 ` [PATCH pve-ha-manager v2 19/19] test: add automatic rebalancing test cases with weights Dominik Rusovac
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=DMZ8JUJZZ8MM.185LSVQ0ZPXE0@proxmox.com \
--to=d.rusovac@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.