Hyper-V Dynamic Memory Tips and Tricks

One of the great additions of Windows 2008 R2 SP1 was the introduction of Dynamic Memory (DM) support for virtual machines. Since memory is generally the limiting factor on most Hyper-V stock deployments, Dynamic Memory can help to significantly increase VM density in many cases, especially those where you always configure a VM’s memory based on the “recommended configuration” from a vendor, only to find that the server generally uses about 40-50% of that memory.

Dynamic memory is very simple to use. You just go into the VM settings and flip the radio button from “Static” to “Dynamic”, and then you can adjust “Startup RAM”, “Maximum RAM”, and “Memory Buffer”. Rather than go into those details here, I’ll simply reference this guide.

The main things I want to point out from a “FAQs, Tips, and Tricks” perspective is that there are a few cases where you might encounter unexpected behavior:

  1. Software Installation Doesn’t Meet Minimum Memory Requirements
  2. Applications that perform their own memory management
  3. Windows 2008 Standard and Web Edition
  4. Available memory in the parent partition

Software Installation Minimum Memory Requirements

Because of the way Hyper-V sets up the “Startup RAM” on a VM, one scenario that you run into on occasion is that software won’t install because the prereq checker doesn’t think it has enough memory to complete the installation (since Windows doesn’t allocate the memory until it’s needed). The quickest and easiest way around this issue is to crank the memory buffer up from Hyper-V settings to something like 200%, then run the installer, and then setting the memory buffer back down to the default. This quick workaround doesn’t require a reboot, and takes less than 10 seconds. Your other options are to temporarily disable DM or artificially use up some extra memory in the guest, but I find the first option to be the quickest and easiest.

Applications that perform their own memory management

You’ll find over time that some applications and some databases (e.g. Oracle and SQL) don’t necessarily seem to perform the way you might expect once you enable DM. Generally, this behavior stems from the fact that memory is configured from within the app or DB, so the app will just keep pushing until it finds it can’t get any more memory or it reaches the max level that’s been set.

In such applications, you can leave DM enabled and receive some benefit, but you want to go in and adjust the in-guest memory settings to line up with the Hyper-V settings. For example, let’s say you have a multi-instance SQL server on a VM. By doing a bit of testing, you find that a particular database can perform fine with 1 GB of RAM, but the left to its own devices, the SQL instance will consume 3 GB of RAM. In this case, turning on DM doesn’t necessarily have the desired effect from an “optimal usage” perspective. In this case, you’ll want to go into each instance and configure a memory cap. Once you have SQL capped appropriately, the OS will continue to use what it needs from a DM perspective, and all will play nicely.

Windows 2008 Standard and Web Edition

Windows 2008 Standard Edition and Web Server edition require a special hotfix to enable Dynamic Memory. For some reason, as of the time of this writing, it’s still a bit of a pain to get this hotfix. You have to contact Microsoft Customer Support Services (CSS) rather than download it directly, but it’s worth the headache if still have quite a few Windows 2008 Standard VMs deployed.

Available memory in the parent partition

In our testing, we found some scenarios where, when under heavy load, the parent partition may become starved of resources, and havoc began to ensue. This generally happens if you have “extras” running in the guest. Such extras could include, Antivirus, System Center agents (OM, VMM, DPM), Hardware Monitoring (OpenManage), et cetera. If you have a lot of this stuff, you might find that you need to up the memory reserves in the parent partition. For more information on this topic, see the “Troubleshooting” section here

Hopefully, these tips will help you find your way to a successful deployment with Dynamic Memory and Hyper-V. Have any questions? Feel free to contact me directly, or leave a comment below.

Good Luck, and Happy Virtualizing!

Janssen

Resources:

Hyper-V Dynamic Memory Configuration Guide

Implementing and Configuring Dynamic Memory

Dynamic Memory with SQL Server

Leave a Reply

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