For those who read my blog posts and who don’t know how to reserve memory for the Hyper-V hosts this is a quick guide. This is not new, but today I had this situation and I want to share with you.
First off all I would like to explain what is a Hyper-V Dynamic Memory.
Dynamic Memory is a Hyper-V feature that helps you use physical memory more efficiently. With Dynamic Memory, Hyper-V treats as a shared resource that can be reallocated automatically among running virtual machines. Dynamic Memory adjusts the amount of memory available to a virtual machine, based on changes in memory demand and values that you specify. Here, I’m talking about Hyper-V Dynamic Memory feature in a Windows Server 2008 R2 (Hyper-V role) and Microsoft Hyper-V Server 2008 R2.
Before this feature was introduced, changing the amount of memory available to a virtual machine could be done only when the virtual machine was turned off. With Dynamic Memory, Hyper-V can provide a virtual machine with more or less memory dynamically in response to changes in the amount of memory required by the workloads or applications running in the virtual machine. Hyper-V can distribute memory more efficiently among the running virtual machines configured with Dynamic Memory.
Depending on factors as workload, this efficiency can make it possible to run more virtual machines at the same time on one physical server.
This is how it looks like when we open virtual machine properties through Virtual Machine Manager.
But, there is always a but…you could have a problem with memory on your Hyper-V host.
For example; You have a Hyper-V host with 48GB of RAM and 11 virtual machines with 4GB Static RAM assigned. You still have 4GB of RAM reserved for Hyper-V host, but when you have a Dynamic Memory environment, you could give each virtual machine 6GB of RAM. That RAM would be dynamically changed based on virtual machines needs. If virtual machines have a big load, they could grab all RAM leaving your Hyper-V host without RAM.
To avoid this problem you need to reserve RAM for the Hyper-V host. How to do that? Very simple. You need to add some registry values on your Hyper-V host.
Open registry and enter a new REG_DWORD value.
– HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization
– Add New—>DWORD (32-bit) Value
– Name it –> MemoryReserve
– Under Decimal specify the amount of RAM for the Hyper-V host in MB (recommend minimum 2GB of RAM) and restart the Hyper-V host.
My recommendation! Use Dynamic Memory environment only for irrelevant services, like testing environment. Do not use Dynamic Memory environment for your production VM’s.
That’s all for today! Have a nice weekend