The dynamic memory debate in Microsoft Hyper-V rages on

As someone who spends a lot of time writing about Microsoft Hyper-V, I tend to get a lot of questions from readers. One of the questions that come up the most often is whether or not dynamic memory should be used in production environments. Not surprisingly, dynamic memory has been the subject of numerous debates.

The primary advantage to using dynamic memory in Hyper-V is that doing so allows Hyper-V to provision your virtual machines with the amount of memory that they need at a given moment (within the threshold boundaries that you set). Without dynamic memory, an administrator is forced to statically allocate memory to their virtual machines, and in many cases, the virtual machine does not actually need quite as much memory as it has been given. This means that some of the system resources are being wasted. Because dynamic memory cuts down on waste, a Hyper-V server’s memory can be used more efficiently, thereby leading to a greater potential virtual machine density and a lower overall cost.

Arguments against dynamic memory

Of course, critics are quick to point out that using dynamic memory is not without its risks. For one thing, using dynamic memory makes it possible to overprovision a Hyper-V server’s physical memory. Unless an administrator exercises care to keep track of how memory has been allocated, there is a risk of running low on physical memory. When this happens, virtual machines may not be able to access enough memory to satisfy the current demands of the virtual machine’s workload.

The other argument that is commonly made against the use of dynamic memory in Hyper-V is that some applications experience problems when virtual machine memory is managed dynamically. This can be especially true for database applications, because the application may assume that is going to have complete control over all of the server’s memory.

Thankfully, this particular issue is starting to become less problematic. Virtualization has been around long enough that application vendors will often tell you when an application should not be used in conjunction with dynamic memory.

So should you use dynamic memory for your Hyper-V virtual machines or not? Some administrators argue that the risks of overprovisioning outweigh any potential benefits of using dynamic memory. Others claim that dynamic memory should always be used unless a workload can be proven to be incompatible with dynamic memory.

In case you’re wondering, I personally do not use dynamic memory in my own Hyper-V environment. I don’t have anything against dynamic memory use, it’s just that I am the type of person who is likely to accidentally overprovision memory use — and not realize it until bad things happen. Hence, my decision not to use dynamic memory has nothing to do with Hyper-V’s capabilities but instead relates to my own shortcomings. Statically allocating memory to my virtual machines means that there is one last thing that I have to think about. Besides, I don’t have enough virtual machines in my environment to have to worry about virtual machine density or memory shortages.

I don’t have anything against dynamic memory use, it’s just that I am the type of person who is likely to accidentally overprovision memory use — and not realize it until bad things happen.

Dynamic — to a point

One of the lesser publicized reasons why some administrators shy away from using dynamic memory is because dynamic memory is sometimes only dynamic to a point. Let me show you what I mean.

If you take a look at the figure below, you can see that Windows Server 2012 R2 Hyper-V required you to provide three pieces of information when setting up dynamic memory. You had to tell Hyper-V what the minimum amount and the maximum amount of memory were that the VM should ever have to use, and you also had to specify the amount of memory that should be allocated to the VM at startup.

dynamic memory

Administrators would often guess on these values (especially the startup value), and make adjustments over time based on the workload’s needs. Often times, however, these adjustments required virtual machines to be taken offline. If you look at the figure below, for example, you can see that Hyper-V indicates that some settings cannot be changed because the VM is running. I am able to adjust the minimum amount of memory, but in this case, I can only decrease it. Hyper-V will not allow me to set a higher minimum RAM value while the VM is running.

dynamic memory

If, on the other hand, I configure the virtual machine to use a static memory assignment rather than dynamic memory, I am completely locked out of making any sort of change while the VM is running. You can see in the figure below that all of the memory related values are grayed out.

dynamic memory

Dynamic memory in Windows Server 2016 Hyper-V

In Windows Server 2016 Hyper-V, dynamic memory works the same way that it did in Windows Server 2012 R2. You can still make adjustments to a running virtual machine’s memory allocation, but the same limitations apply as what I showed you earlier. However, Microsoft has made a change that impacts virtual machines that are configured with static memory allocations. Now, you can make on-demand changes to the memory that is allocated to such a VM. Notice in the figure below that the RAM field is not grayed out, even though the virtual machine is running. For the sake of clarification, this value cannot be changed while the VM is running if the VM has been configured to use dynamic memory.

dynamic memory

Microsoft’s decision to allow on-the-fly memory adjustments for Hyper-V virtual machines that use static memory allocation isn’t going to do anything to settle the debate as to whether it is better to use dynamic memory or static memory. Even so, it does lend a little bit of flexibility to those of us who do not use dynamic memory, because we can now make memory allocation changes without shutting down the VM.

Featured image: Shutterstock

Leave a Comment

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top