Forum Discussion
Hyper-V Ubuntu VM: Memory Demand Different at Hyper-V and OS Level
Hello all,
Looking for advice and insight for a strange problem we are experiencing.
We have a cluster of Windows Server 2025 hosts, on which we are using Hyper-V manager to run mostly Windows VMs. To access these VMs, we are using Apache Guacamole which is hosted on a Ubuntu VM on our cluster. We originally assigned 32GB memory to this VM.
Recently, we have noticed an increased memory demand for this VM at the Hyper-V level which prompted us to increase the assigned memory of the VM to 64GB. Despite this, the memory demand has continued rising despite no apparent change in the usage of Guacamole.
When logging into the VM and observing the memory usage here, the VM is using no where near the amount that is assigned. As shown in the attached images which were taken at the same time:
Memory Demand Hyper-V Level (And seems to be continuing to increase...):
Memory Demand OS Level:
This morning, the memory demand spiked to 95GB on Hyper-V but at OS level was only 12GB and we were forced to restart the VM. The biggest concern is where this discrepancy is coming from and the potential unnecessary disruptions that will be caused from having to restart/rebuild the VM.
Has anyone experienced this sort of issue before and found a fix?
Can anyone suggest how to debug this issue?
TIA
2 Replies
Your host screenshot shows Dynamic Memory disabled and 65,536 MB assigned. The guest shows about 2 GB of buff/cache and substantial available memory, so those captures do not substantiate a cache-only explanation for the larger demand figure.
A demand value is not the same observation as additional assigned RAM. At the next spike, record assigned memory and demand alongside the host's Memory\Available Mbytes counter and simultaneous guest available memory, swap use and process usage. Establish whether host or guest pressure accompanies the display before restarting the VM or reducing its allocation.
Please include the Ubuntu release, kernel version, host build and memory configuration. Microsoft's Ubuntu support matrix documents built-in integration services and version-specific Dynamic Memory support; it says not to install the separate Microsoft LIS download on Ubuntu.
The screenshots do not identify a leak or justify a 4–8 GB recommendation. Preserve synchronized measurements for support if the discrepancy continues.
- WinEndpointOpsIron Contributor
This pattern usually comes down to Linux page cache. Linux uses spare RAM as file cache and does not give it back until it is needed, and Hyper-V counts that cached memory as demand because the guest reports it as in use. So the host sees demand keep climbing toward whatever you assign, while a tool inside the VM that shows "used" (without cache) looks low. That also explains why going from 32 GB to 64 GB just moved the ceiling.
To confirm and fix it:
- Inside the VM, run free -h and look at buff/cache and the available column, not just used. If available is large and buff/cache is what is growing, it is cache, not a leak.
- As a one-time test, run sync and then echo 1 as root into /proc/sys/vm/drop_caches. If Hyper-V demand drops soon after, that proves it. Do not put this in a cron job, it is only a diagnostic.
- Check for a real leak anyway with ps aux --sort=-rss | head. Guacamole is guacd plus Tomcat/Java, so look at the Java heap and any large log files being written, since heavy logging fills the cache quickly.
- Right-size the VM. Guacamole for a cluster rarely needs 32 or 64 GB, and 4 to 8 GB is often plenty. A smaller fixed allocation (or Dynamic Memory with a sensible maximum) stops the VM from claiming a big share of the host for cache.
- Make sure the Hyper-V integration drivers are loaded in the guest (lsmod | grep hv_) so ballooning works when the host needs memory back.
If available stays high and cache is the cause, you can safely lower the assignment and the demand number will follow.