What’s the Skinny on Hyper-V Dynamic Memory?

Back in Windows Server 2008 R2 SP1 Microsoft introduced the concept of Dynamic Memory with the end goal being, optimization of how the Hyper-V Host (Management OS) allocated memory to the guest virtual machines.  Think about it for a second…in a virtual infrastructure there’s a few required components. Network, Storage, Processor and Memory.  Which of those resources will you run out of first?  Memory!  In every environment I’ve come across over the past years Memory has always been the most constraining resource.  To compensate, hardware manufacturers have increased the amount of physical memory DIMMs in their boxes.  It’s a balance.  You cannot have too much physical memory because if that host needs to evacuate VMs to other hosts in the Failover Cluster well now you’re left with potentially not having enough resources to satisfy the requirements of the VMs.

 

Sizing memory for VMs and their Applications is often nothing more than a  “guessing” game.  Usually we’re left completely oversizing and setting memory much greater than what’s required.  Microsoft has set out to resolve this problem with the VM feature, Dynamic Memory.  Let’s take a look at the different components that make up Dynamic Memory.

 

Startup RAM:

Hyper-V allows you to set an initial startup RAM values.  With Dynamic Memory enabled startup memory should simply equal the amount of RAM required to boot the OS.  I usually set this value very low.

 

image

 

Minimum RAM:

With Dynamic Memory enabled (it’s just a checkbox!)  Now this is cool!  You can actually set the amount of minimum memory lower than the what the VM actually booted with.  So if I booted with 1024 MB RAM and now the machine is left idle for months and months, VM Sprawl at it’s best Smile Dynamically Hyper-V is intelligent enough to reclaim back the unused resource.  NICE!  The minimum amount of memory a guest VM can be set to is 512MB.

 

Maximum RAM:

We’ve all had those meetings where the App owner and App Vendor says we need 16GB of memory.  VM Admin, says yeah right – well…Dynamic Memory can help solve some of those challenges.  Max RAM value constrains the upper bounds of a VMs dynamic memory allocation.  In Hyper-V the most memory a VM can have allocated is 1TB.  If you choose to simply check the box for enabling Dynamic Memory and then don’t change the Max, it defaults to 1TB.

 

But wait – what if the Hyper-V Host (Management OS) doesn’t have enough memory to satisfy the requirements of the VMs!??!  Well for one, performance will be impacted and you’ll likely be getting calls!  Here comes the concept of Memory Pressure.  This is where our dear VM is requesting more memory resources than it can receive and the hypervisor cannot satisfy the requirements.  Time to either add another host to said Cluster or add more memory to said Host…

 

Happy virtualizing and be sure to follow me on Twitter @ClintWyckoff