mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-10-04 03:33:13 +00:00
fix #2413: pvestatd: read ballooning RAM usage target from node config
Currently, the automatic memory management (ballooning) performed by pvestatd targets 80% memory usage. Users have reported that this target is unnecessarily low on hosts with large amounts of RAM. Thus, read the target from the node config option `ballooning-target`. Also change the ballooning debug log output to include the target. Signed-off-by: Friedrich Weber <f.weber@proxmox.com> Tested-by: Stoiko Ivanov <s.ivanov@proxmox.com> Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com> Link: https://lore.kernel.org/r/20250312151506.128311-3-f.weber@proxmox.com
This commit is contained in:
parent
cca3eaded2
commit
c5f0aec546
@ -15,6 +15,7 @@ use PVE::CpuSet;
|
||||
use Filesys::Df;
|
||||
use PVE::INotify;
|
||||
use PVE::Network;
|
||||
use PVE::NodeConfig;
|
||||
use PVE::Cluster qw(cfs_read_file);
|
||||
use PVE::Storage;
|
||||
use PVE::QemuServer;
|
||||
@ -215,9 +216,12 @@ sub auto_balloning {
|
||||
#$hostmeminfo->{memtotal} = int(2*1024*1024*1024/0.8); # you can set this to test
|
||||
my $hostfreemem = $hostmeminfo->{memtotal} - $hostmeminfo->{memused};
|
||||
|
||||
# try to use ~80% host memory; goal is the change amount required to achieve that
|
||||
my $goal = int($hostmeminfo->{memtotal} * 0.8 - $hostmeminfo->{memused});
|
||||
$log->("host goal: $goal free: $hostfreemem total: $hostmeminfo->{memtotal}\n");
|
||||
# try to keep host memory usage at a certain percentage (= target), default is 80%
|
||||
my $config = PVE::NodeConfig::load_config($nodename);
|
||||
my $target = int($config->{'ballooning-target'} // 80);
|
||||
# goal is the change amount required to achieve that
|
||||
my $goal = int($hostmeminfo->{memtotal} * $target / 100 - $hostmeminfo->{memused});
|
||||
$log->("target: $target%% host goal: $goal free: $hostfreemem total: $hostmeminfo->{memtotal}\n");
|
||||
|
||||
my $maxchange = 100*1024*1024;
|
||||
my $res = PVE::AutoBalloon::compute_alg1($vmstatus, $goal, $maxchange);
|
||||
|
Loading…
Reference in New Issue
Block a user