Last week saw the release of Windows Server 2008 R2 Service Pack 1 and with it one of the feature’s I’ve been waiting for – Hyper-V Dynamic Memory. Until now if you were running a Hyper-V host with (for example) 16GB of RAM your guests could never exceed that amount, e.g. you could have 4 x 4GB, 2 x 4GB + 1 x 8GB, etc. but never more than 16GB in total.
With the addition of Dynamic Memory you can finally over-commit RAM enabling you to make better use of available resources, as with CPU usage you still need to balance your workloads carefully and it only really makes sense to combine workloads that have high memory pressures at different times otherwise you could end up with poor performance or experience system failures when memory is unavailable.
Please note that Dynamic Memory is configured on a host-by-host basis so nothing will change until you follow the process below, Microsoft have a really helpful TechNet page explaining how to configure Dynamic Memory but in a nutshell you should follow these steps…
Update both the Host and the Guest to Windows Server 2008 R2 SP1 then use Hyper-V Manager to connect to the Guest then choose Action >> Insert Integration Services Setup Disk and reinstall the integration components.
Shut down the Guest and in Hyper-V Manager right-click on the guest and pick Settings in the memory panel choose Dynamic then set the Startup RAM and Maximum RAM. There’s also a configurable buffer percentage (Hyper-V reserves this extra amount but will give it up under pressure). I’d leave it on the default 20% unless you’ve got a good reason not to.
Set a priority for this guest (e.g. you could set this higher for servers that could fail with too little memory).
Restart the guest and check in Hyper-V Manager…
Here you can see that I’ve exceeded my Startup memory of 2GB but only have a current demand of 1795MB and since there’s no memory pressure on the host the status shows as OK. If the host is unable to reserver the entire buffer amount (in my case 20%) the status will show as “Low” and if the host is unable to allocate any buffer it will show “Warning”.