I believe in Hyper-V!

How to reserve a memory for the Hyper-V host and what is a Hyper-V Dynamic Memory

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.

dynamicmemory

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.

2

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 Smile

6 Responses to “How to reserve a memory for the Hyper-V host and what is a Hyper-V Dynamic Memory

  1. CypherBit

    Could you please explain in detail why the recommendation of only using it for testing VMs. I actually haven’t enabled Dynamic Memory on any of my machines, but am seriously considerning and haven’t come across any similar recomendations (apart for Exchange).

  2. Gordon

    Your blog is very much helpful.

  3. Maki

    It was a inspiring post and it has a significant meaning and thanks for sharing the information

  4. Jim Sperry

    Thank you for the insight and registry hack. In class the instructor says to not use dynamic memory but when asked why there is no real explanation. I feel it is more out of not being informed and staying safe. Actually it sounds like class is a good place to work with it but to know in the production environment to stay with fixed. I have used it with out any noticeable drawback. On my home lab host it will be most helpful as it will allow me to have more machines running when required. I was setting a WDS server and when it came to that selection I decided to educate myself a bit and find your insight helpful.

Leave a Reply

Your email address will not be published. Required fields are marked *