Paul Gregory | 14 March 2013
With the release of Hyper-V 3.0 Microsoft made some changes in improve Virtual Machine memory management which will allow increased density but can cause problems in some scenarios.
The new features within dynamic memory allows
the setting of a Startup RAM value as well as the Minimum value we
had in Windows Server 2008R2 SP1 as well as the addition of a
feature called Smart Paging. With dynamic memory in Windows Server
2008R2 SP1 the minimum memory value could cause problems and
administrators had to make a decision.
The problem was in some situations in order to get the VM to book quickly the minimum memory needed to be set quiet high but once the VM stabilised the memory requirement for the VM was quite low. You can see this with Domain Controllers. If the minimum memory was set to 1.5GB the VM would book quickly but then it would settle down and need less than 0.5GB, so memory was being wasted.
Large application services could be much worse. To resolve this in V3.0 we now have a Startup RAM value. This is the memory the VM is powered on with. Once the VM is up and running if the Hyper-V host comes under memory pressures it will remove 'spare' memory from the VM's. This will entail removing all the required unused memory from VM's down to their minimum value, if possible, to generate the free memory needed. This now introduces another problem.
What if I have a VM which has a Startup RAM of 10GB and a Minimum of 1GB and due to memory pressures the VM memory has been claimed back by Hyper-V and the VM only has 1GB of RAM allocated?
Due to the provisioning of VM services the host only has 2-3GB's free. If this VM was rebooted it would not start because 10GB of RAM is not available in the host. In this one scenario (VM-Restart), Hyper-V will perform the following actions once the VM tries to restart to free up 10GB of RAM:
- Try to reclaim memory from other Dynamic Memory VM's.
If this fails enable Smart Paging for the VM.
Smart Paging will allocate diskspace on the Host to be used as a RAM swapfile for the VM's memory. This swapfile is stored, by default, in the same directory structure as the VM's files. This swapfile will only be big enough to provide the missing memory. Once the VM has booted, stabilised and the Integration services have initialized Hyper-V will reclaim memory from the VM so the swapfile is no longer required.
Therefore the Smart Paging is only used to support the VM-Restart, is it not used to support the VM during normal operations. Also Smart Paging does not come into effect during VM boot from cold. So be careful if you choose to shut a VM down instead of restarting it!
Please watch this video to see this feature in action, attend a training course on Windows Server 2012 or attend our well received QA Authored Updating Hyper-V 3.0 skills course @QATraining
Follow me on Twitter or see my YouTube channel