I'm attempting to understand something unexpected that I'm observing about memory ballooning's behavior and what that implies about its intended usage. I understand that memory ballooning is triggered based on the hypervisor host's RAM usage reaching a set threshold, with the default set to 80%. However, the host's RAM usage which is compared to that threshold includes the maximum RAM allocation of all running VMs...including the max for VMs with ballooning enabled, rather than current amount available to the VM (aka the max minus the current balloon size).
Doesn't that mean that the balloon inflating can never reduce the host's usage below the threshold? And then assuming the host memory pressure exceeded the threshold due to RAM allocated to VMs rather than other processes on the host, doesn't that mean that the VMs with ballooning enabled will always lose available memory until they reach their minimum? And that this ballooned memory will continue to be accounted in host RAM usage, even though it isn't actually available to or being used by anything?
If all that is true, then I don't understand what the intended usefulness of memory ballooning would be. In that scenario it isn't triggered by heavy transient RAM usage of one VM or another, only by the relatively fixed configured maximum for all running VMs. What kinds of scenarios is memory ballooning actually useful for, then? For example, is it only useful to accommodate for host RAM usage exceeding the threshold due to new VMs starting? But if so, I still don't understand why the balloon inflating and reducing available RAM to VMs with ballooning enabled does not then reduce host RAM usage. How else will host usage drop below the threshold...another VM stopping?
To give a contrived but concrete example for discussion purposes, consider a PVE host with 128GiB of RAM and the following VMs configured:
It seems like I must have some part of this wrong because that behavior seems pointless, but I can't identify what I have wrong. Could someone please find my error and explain? Thank you.
Doesn't that mean that the balloon inflating can never reduce the host's usage below the threshold? And then assuming the host memory pressure exceeded the threshold due to RAM allocated to VMs rather than other processes on the host, doesn't that mean that the VMs with ballooning enabled will always lose available memory until they reach their minimum? And that this ballooned memory will continue to be accounted in host RAM usage, even though it isn't actually available to or being used by anything?
If all that is true, then I don't understand what the intended usefulness of memory ballooning would be. In that scenario it isn't triggered by heavy transient RAM usage of one VM or another, only by the relatively fixed configured maximum for all running VMs. What kinds of scenarios is memory ballooning actually useful for, then? For example, is it only useful to accommodate for host RAM usage exceeding the threshold due to new VMs starting? But if so, I still don't understand why the balloon inflating and reducing available RAM to VMs with ballooning enabled does not then reduce host RAM usage. How else will host usage drop below the threshold...another VM stopping?
To give a contrived but concrete example for discussion purposes, consider a PVE host with 128GiB of RAM and the following VMs configured:
- VM 100 - running, 64 GiB, ballooning enabled, minimum set to 32 GiB
- VM 101 - running, 16 GiB, ballooning disabled
- VM 102 - stopped, 32 GiB, ballooning disabled
It seems like I must have some part of this wrong because that behavior seems pointless, but I can't identify what I have wrong. Could someone please find my error and explain? Thank you.
Last edited: