mirror of
https://git.proxmox.com/git/pve-installer
synced 2025-08-15 07:05:58 +00:00
run env: always reduce max ARC size for systems with low memory
Reduce the maximum ARC size to 10% of total memory instead of the default 50% not only for PVE, but always if the system has less than 2 GiB, or less than 4 GiB for PMG, i.e. less than the recommended minimum memory we document. We might want to fine-tune this further in the future, e.g. so that PMG and PDM won't use 50% of memory even if they got more memory installed. As they both are not IO-heavy, thus a big ARC won't gain one that much, but as memory is mainly used for the base system there, unlike PVE where it's mainly for virtual guests, it might make sense to use something like 25% there for a better trade-of. Anyway, that's something that needs closer evaluation, so not relevant for now. Adapt the tests accordingly. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
91be6a71d5
commit
f357ae3d07
@ -330,9 +330,15 @@ our $ZFS_ARC_SYSMEM_PERCENTAGE = 0.1; # use 10% of available system memory by de
|
||||
# Calculates the default upper limit for the ZFS ARC size.
|
||||
# Returns the default ZFS maximum ARC size in MiB.
|
||||
sub default_zfs_arc_max {
|
||||
# For products other the PVE, just let ZFS decide on its own. Setting `0`
|
||||
# causes the installer to skip writing the `zfs_arc_max` module parameter.
|
||||
return 0 if Proxmox::Install::ISOEnv::get('product') ne 'pve';
|
||||
my $product = Proxmox::Install::ISOEnv::get('product');
|
||||
my $total_memory = get('total_memory');
|
||||
|
||||
# By default limit PVE and low-memory systems, for all others let ZFS decide on its own by
|
||||
# returning `0`, which causes the installer to skip writing the `zfs_arc_max` module parameter.
|
||||
if ($product ne 'pve') {
|
||||
return 0 if $total_memory >= 2048 && $product ne 'pmg';
|
||||
return 0 if $total_memory >= 4096; # PMG's base memory requirement is much higer
|
||||
}
|
||||
|
||||
my $default_mib = get('total_memory') * $ZFS_ARC_SYSMEM_PERCENTAGE;
|
||||
my $rounded_mib = int(sprintf('%.0f', $default_mib));
|
||||
|
@ -45,15 +45,15 @@ while (my ($total_mem, $expected) = each %default_tests) {
|
||||
"$expected MiB should be zfs_arc_max for PVE with $total_mem MiB system memory");
|
||||
|
||||
mock_product('pbs');
|
||||
is(Proxmox::Install::RunEnv::default_zfs_arc_max(), 0,
|
||||
is(Proxmox::Install::RunEnv::default_zfs_arc_max(), $total_mem < 2048 ? $expected : 0,
|
||||
"zfs_arc_max should default to `0` for PBS with $total_mem MiB system memory");
|
||||
|
||||
mock_product('pmg');
|
||||
is(Proxmox::Install::RunEnv::default_zfs_arc_max(), 0,
|
||||
is(Proxmox::Install::RunEnv::default_zfs_arc_max(), $total_mem < 4096 ? $expected : 0,
|
||||
"zfs_arc_max should default to `0` for PMG with $total_mem MiB system memory");
|
||||
|
||||
mock_product('pdm');
|
||||
is(Proxmox::Install::RunEnv::default_zfs_arc_max(), 0,
|
||||
is(Proxmox::Install::RunEnv::default_zfs_arc_max(), $total_mem < 2048 ? $expected : 0,
|
||||
"zfs_arc_max should default to `0` for PDM with $total_mem MiB system memory");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user