Freigeben über


Virtual Machine RAM and Windows Server 2012 Hyper-V Dynamic Memory

With the introduction of Microsoft Hyper-V Dynamic Memory (DM), there’s been many discussions around DM configuration. Before Windows Server 2012 Hyper-V, the only options available in User Interface were Startup and Maximum RAM. You could however use another parameter called Minimum RAM (by default the same value as Startup RAM) but that needed to be configured using WMI.

Windows Server 2012 Hyper-V made it easier by including that option in VM’s Memory settings.

image

When you start a VM with Dynamic Memory enabled, guest Operating System running inside the VM only has the knowledge of RAM that has been allocated to it at the moment and this is normally equal or around the value of Startup RAM. You can verify this by looking at Installed Memory (RAM) value on the System’s page or Installed Physical Memory (RAM) value on the System Summary page when you launch msinfo32.exe

This number changes in an upward fashion until the next reboot, meaning that as VM’s memory pressure increases, Hyper-V will allocate more RAM to that VM increasing the above mentioned value. Now, for any reasons, if the VM’s memory pressure drops and Hyper-V balloons out part of that RAM from the VM, the value that guest OS has as the Installed RAM won’t decrease. Thus, User Interface and any WMI/PowerShell queries will show the maximum amount of RAM that has been allocated to that VM since the last reboot.

Here’s a PowerShell sample code that shows the RAM formatted in GB;

"{0:N0}" -f ((Get-WmiObject -Query "select * from WIN32_ComputerSystem").TotalPhysicalmemory/1GB)

 

Now, why do we use this?

There are many cases that applications or installer packages are looking for a minimum amount of RAM as a prerequisite. Some applications might not even launch unless the available RAM query return a satisfactory value. If you’ve ever tried to install Microsoft System Center 2012 components in a VM with Dynamic Memory enabled, you’ve probably seen the available RAM warning message in the prerequisite analyzer wizard. Not fulfilling that requirement won’t stop you from installing any System Center 2012 components though.

Startup RAM value will allow you to allocate that much RAM to the VM upon the start of VM and let guest OS sets the Installed RAM value accordingly. This RAM will be locked to the VM while it’s booting and the extra amount of RAM that isn’t needed by the VM will be available to Hyper-V as soon as VM’s guest OS and Hyper-V Integration Services within the guest OS are up and running. In most cases the actual physical RAM allocated to the VM could go down to the value of minimum RAM if there’s no memory pressure. This all depends on how fast your VM boots.

Off course, you can set the Startup RAM to same value as Maximum RAM for multiple VMs but you’ll need to be careful if the Maximum RAM’s too high and those VMs could start at the same time, some of them might not be able to boot, if the sum of the Maximum RAM values exceeds the total physical RAM available on the Hyper-V server. And yes, you can have the Startup delay action for those VMs and address this concern.

 image

 

In summary, Dynamic Memory Startup RAM value is a nifty useful dial that could assist you with optimizing your Private Cloud’s memory compute resource. It’s the best to understand the minimum RAM that needs to be reported by the OS as available Installed RAM and set the Startup Value respectfully and let Hyper-V Dynamic Memory does its magic and be efficient in RAM distribution amongst your VMs. So long…

 

More Info:

Scripting dynamic memory, part 5: changing minimum memory

Dynamic Memory Coming to Hyper-V Part 6…