Proxmox reports RAM usage and memory ballooning

SysMik

Member
Feb 8, 2023
8
0
6
Hello,


I have a few questions about memory ballooning and how Proxmox reports RAM usage.

When a VM has ballooning enabled, for example with a minimum of 4096 MB and a maximum of 8192 MB, is the 4096 MB difference essentially the amount of RAM that Proxmox can reclaim from the VM?
Should the 4096 MB minimum be understood as a guaranteed amount of RAM reserved for the VM, rather than as a guarantee that the VM will be able to grow back up to 8192 MB when it needs it?
In other words, if the Proxmox host is under memory pressure, is it possible for the VM to remain at around 4096 MB and not be able to increase its memory usage above that, even if it is configured with 8192 MB as its maximum?

Also, how does the Proxmox host determine how much RAM a guest is actually using?
I believe this is related to memory ballooning, but what happens when ballooning is not enabled? What mechanism does Proxmox use to determine the guest's memory usage?
For example, Proxmox reports that one of my VMs is using 4 GB of RAM, while from inside the VM, I can see that only about 3 GB is actually being used.
So, what exactly does the "Memory usage" value reported by Proxmox represent, and why can it differ from the memory usage reported inside the guest?

Regards,
SysMik
 
Hi!
When a VM has ballooning enabled, for example with a minimum of 4096 MB and a maximum of 8192 MB, is the 4096 MB difference essentially the amount of RAM that Proxmox can reclaim from the VM?
Yes, exactly.
Should the 4096 MB minimum be understood as a guaranteed amount of RAM reserved for the VM, rather than as a guarantee that the VM will be able to grow back up to 8192 MB when it needs it?
Yes. Proxmox VE will ensure that the VM has the minimum amount of RAM available, but there is no guarantee that it will get back to the maximum amount of RAM. However, if the host's memory usage is below the 80% threshold (configurable per node), the host will dynamically add memory to the guest to hit the maximum.

In other words, if the Proxmox host is under memory pressure, is it possible for the VM to remain at around 4096 MB and not be able to increase its memory usage above that, even if it is configured with 8192 MB as its maximum?
If the host is above its 80% target, it will claim memory from guests until they have reached the specified minimum from ballooning. So yes, it could be the case that it stays at the minimum if the memory pressure is high and only adds additional memory again after dropping below the threshold.

Note, however, that all of this takes some time. So use caution when overprovisioning memory, as a sudden increase in memory demand from the guest does not mean that it will get that additional memory in time.

Also, how does the Proxmox host determine how much RAM a guest is actually using?
I believe this is related to memory ballooning, but what happens when ballooning is not enabled? What mechanism does Proxmox use to determine the guest's memory usage?
If ballooning is not enabled, there is no communication channel from the host to the guest to get the guest's view of the memory usage. The behavior here has actually changed in PVE 9. A previous reply in another forum post describes it in more detail, but essentially it checks the PSS memory usage for the processes that belong to a VM. The host's view of the memory usage is always fetched in PVE 9 as well and if the guest's internal memory usage info could not be gathered, the Host memory usage and Memory usage fields in the guest's summary will be identical.

If ballooning is enabled, you'll see the guest's internal view as Memory usage as it is reported through the ballooning device.

You can find additional details here.
 
Last edited:
  • Like
Reactions: leesteken
Hello Michael,

Thanks a lot for the detailed explanation!
That clears things up for me, especially regarding how ballooning works and how Proxmox calculates memory usage.
Really appreciate you taking the time to answer all my questions!

Best Regards,
Mikael