mirror of
https://git.proxmox.com/git/proxmox-resource-scheduling
synced 2025-10-04 17:11:19 +00:00
pve static: add one to avoid boosting tiny relative differences
Only the relative difference for values between different alternatives is relevant, meaning 0.002 vs 0.004 and 0.2 vs 0.4 will influence the scoring in the same way. This is not really desirable, because values closer to 1.0 indicate higher load and thus should influence the scoring more than differences that are actually tiny, but big when viewed as a relative difference. To avoid the issue, simply add 1.0 to all values. Like that, 1.002 vs 1.004 will also be small when viewed as a relative difference. Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
a6583c7e28
commit
40e3f47b8e
@ -104,11 +104,13 @@ pub fn score_nodes_to_start_service(
|
|||||||
squares_mem += new_mem.powi(2);
|
squares_mem += new_mem.powi(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add 1.0 to avoid boosting tiny differences: e.g. 0.004 is twice as much as 0.002, but
|
||||||
|
// 1.004 is only slightly more than 1.002.
|
||||||
PveTopsisAlternative {
|
PveTopsisAlternative {
|
||||||
average_cpu: (squares_cpu / len as f64).sqrt(),
|
average_cpu: 1.0 + (squares_cpu / len as f64).sqrt(),
|
||||||
highest_cpu,
|
highest_cpu: 1.0 + highest_cpu,
|
||||||
average_memory: (squares_mem / len as f64).sqrt(),
|
average_memory: 1.0 + (squares_mem / len as f64).sqrt(),
|
||||||
highest_memory: highest_mem,
|
highest_memory: 1.0 + highest_mem,
|
||||||
}
|
}
|
||||||
.into()
|
.into()
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user