Paused Hyper-V VMs Do Not Release RAM

Monday, October 26, 2009
Windows Server 2008 Hyper-V allows the administrator to pause a running Hyper-V virtual machine.  When a VM is paused, the VM system state is written to a file on the host server and the VM no longer will process operations.  This is similar to the sleep feature in other versions of Windows.

When the VM is resumed, Hyper-V will read this saved state information back into its working set and the VM will continue to function as it was when the VM was paused.  This is a very quick operation.

Pausing a VM is handy when you want to quickly and temporarily take a machine offline without shutting it down.  For example, you may want to test cluster failover or you may need to briefly free up main processor resources.

Be aware, however, that pausing a VM does not free up the RAM associated with the VM.  I've seen several customers make this mistake, thinking that they could essentially "over-subscribe" their Hyper-V host server by pausing running VMs to free up resources (RAM) and run other VMs.

When you pause a virtual machine, the RAM allocated to the paused VM is not released back to the host.  Take a look at the sample perfomance monitor screenshot below:

This perfmon example shows available megabytes free on a Windows Server 2008 Hyper-V host server with 8GB RAM.  RAM drops when a 4GB VM is started up, as expected.  The VM is then pause and the available megabytes free remains steady at about 3289MB free.  RAM utilization remains steady when the VM is resumed a short time later.  RAM is only released back to the Hyper-V host when the VM is powered off.

If you want to free up RAM from a running VM, you need to either turn off the VM or use the Hyper-V "Save" action.  Save is similar to the Windows hibernate feature, where both the system state and the RAM working set are written to disk files and then released to the host server.  When the VM is started, it will read these files back into memory and restore the VM to its previous state.

No comments:

Post a Comment

Thank you for your comment! It is my hope that you find the information here useful. Let others know if this post helped you out, or if you have a comment or further information.