A: Windows Server 2008 R2 SP1 introduced Dynamic Memory, which allowed memory to be added to a running virtual machine (VM) based on the memory currently being used by processes running in the guest OS. Memory could also be removed from a VM using a kernel mode mini-device driver balloon driver.
Using these two capabilities, the memory assigned to a VM could go up and down based on the VM's current needs, giving memory when needed, and removing and allocating to other VMs when not needed, allowing a higher density of VMs on a Hyper-V host. The amount the memory could go up and down was based on two values, Startup RAM and Maximum RAM, which were the amounts the VM was allocated at startup and the maximum amount that could be allocated to a VM, respectively.
Windows Server 2012 introduces a third configuration value, Minimum RAM, which, as the name suggests, is the minimum amount of RAM a VM can ever be allocated.
When a VM starts, it might need a certain amount of RAM, the Startup RAM, to be able to successfully boot and start services, for example, 1GB. However, after the VM has started, this amount of memory is no longer required.
This is when the Minimum RAM value is used. It allows memory to be removed from the VM down to the Minimum RAM value, such as 512MB (see screen shot below).
So, to summarize, these are the types of RAM a VM can use:
- Minimum RAM - minimum amount of RAM a VM can be allocated
- Startup RAM - amount of RAM a VM is given at startup
- Maximum RAM - maximum amount of RAM a VM can be allocated
The new minimum RAM capability introduces a potential problem. Consider the scenario below on a host that's fully utilized from a memory perspective.
- A VM has been running for a period of time and the amount of physical RAM allocated is set to its Minimum RAM value, 512MB, and the additional memory it was allocated when it started (Startup RAM of 1GB) has been taken by Hyper-V through the balloon driver process.
- The VM is restarted or the host is restarted.
- To restart, the VM needs 1GB of memory but it only has 512MB available; in this worse case scenario, the Hyper-V host has no spare memory and no memory can be reclaimed from other VMs running on the host.
This one-and-only scenario is where the new Smart Paging feature is utilized:
- The VM is being restarted (also caused by host restart).
- There is no available physical memory.
- No memory can be reclaimed from other VMs running on the host.
At this time a Smart Paging file is created for the VM in the location specified in the VM's configuration and is used by the VM as memory to complete startup. As soon as possible, that memory mapped to the Smart Paging will be ballooned out and the Smart Paging file no longer used and deleted. The target time to stop using the Smart Paging is as soon as possible and no longer than 10 minutes, as documented at Microsoft's website.
The Smart Paging feature is used only to provide reliable restart of VMs and isn't used in any other circumstance, including if a machine is being started from off state instead of being restarted, or any other memory overcommit scenario.