More on Dynamic Memory
Face-off: Hyper-V Dynamic Memory vs. VMware memory overcommit
How Hyper-V Dynamic Memory improves your server consolidation plan
Grasping application memory requirements to optimize Dynamic Memory
Often, physical memory limits the number of virtual machines (VMs) that can reside on a single host. The Dynamic Memory feature, which first appeared in Windows Server 2008 R2 SP1, allowed Hyper-V shops to redistribute host memory in a way that made higher consolidation ratios possible.
Dynamic Memory had advantages over the static memory allocations in Hyper-V, but as a first generation feature, it was immature by definition. In Hyper-V 3.0, Dynamic Memory will feature a new minimum memory setting and second-level paging, which adds new flexibility to the virtualization platform and may improve consolidation ratios further for some virtual data centers.
The new Dynamic Memory: Complete with minimum memory
The minimum-memory setting is the biggest improvement to Dynamic Memory in Hyper-V 3.0. It’s a bit different than the startup-memory setting found in Windows Server 2008 R2 SP1, which represented the smallest amount of memory that you could assign to a virtual machine. The hypervisor allocated this memory to the virtual machine on startup – hence the name, startup memory.
Although the startup-memory setting generally worked well, it did have one drawback: Often, VMs need more memory to boot up than to operate, after all internal processes have stabilized.
This principal forms the basis for the minimum-memory setting. Minimum memory represents the smallest amount of memory you will ever assign to the virtual machine. This amount is typically less than the startup memory, and therefore allows some of the VM’s memory to be reclaimed once the startup process is complete.
Mitigating physical memory shortages with second-level paging
The concepts of minimum memory and startup memory seem straightforward, but implementing the features proved to be quite an ordeal for Microsoft. There has always been a big problem with Dynamic Memory: If you assign more memory than is physically available in a host, the hypervisor may not be able to provide a VM with enough memory at times.
Physical memory shortages typically result in performance problems, but when you introduce the concept of minimum memory, a physical-memory shortage becomes catastrophic. To see why, imagine you are running virtual machines on a Hyper-V 3.0 host. Let’s also assume that each VM is operating with minimum memory and that all of the host’s physical memory is consumed. This situation isn’t necessarily problematic, as the virtual machines should run indefinitely using their assigned memory.
Issues arise when you need to reboot a virtual machine. Remember that VMs typically require more memory to start up than they require to operate. Therefore, if you restart a virtual machine and all of the server’s physical memory has been allocated, the host server will not have sufficient memory to start the virtual machine.
To prevent such a scenario, Hyper-V 3.0 will enable second-level paging when necessary. Paging uses physical disk space in the place of physical memory to compensate for a memory shortage. Paging, however, suffers from poor performance because disk-access speeds are much slower than memory-access speeds.
Hyper-V 3.0 uses second-level paging only sparingly because of this potential performance issue. For example, the hypervisor uses paging when you restart a VM if no physical memory is available or memory cannot be reclaimed from another virtual machine. It never uses paging as a way to power on a virtual machine that was previously turned off. Furthermore, Hyper-V 3.0 only uses paging to facilitate the restart. Once the VM is running and has stabilized, the hypervisor automatically disables paging.
As you can see, the minimum-memory setting in Hyper-V 3.0’s Dynamic Memory feature uses host memory more judiciously, making it possible to achieve a higher rate of virtual machine consolidation. As an extra bonus, this setting also allows you to increase a virtual machine’s maximum memory or decrease its minimum memory while the VM is running.