What Is Hyper-V Dynamic Memory?

Windows Server 2008 R2 (W2008 R2) SP1 introduced a feature to Hyper-V called Dynamic Memory. With this feature enabled a virtual machine optimize how is consumes memory from a host. With Dynamic Memory enabled you can increase the virtual machine to host ratio and reduce your overall cost of host acquisition and ownership.

Hyper-V Without Dynamic Memory

If you deploy Hyper-V virtual machines without Dynamic Memory enabled, each virtual machine will attempt to boot up and consume 100 percent of its configured RAM from the host. So, a virtual machine configured with 16 GB of RAM will consume all of that 16 GB, even it will average at 4 GB and only reach 16 GB at peak periods. Ninety percent of the time, 12 GB RAM will be wasted and unavailable to other virtual machines.

That was the way Hyper-V was before SP1 was released for W2008 R2 and Dynamic Memory was added to Hyper-V. After that we could configure a number of settings on a per virtual machine basis, assuming that both the guest OS and the services running in that virtual machine would support it. Before Windows Server 2012 R2 (WS2012 R2) Linux did not have support for Dynamic Memory (check this post on “Linux Virtual Machines on Hyper-V” for distribution, edition, and architecture specifics). The mailbox role of Microsoft Exchange does not support Dynamic Memory, and pre-2012 versions of SQL Server below the Enterprise edition cannot make use of it either.

Dynamic Memory Overview

With Dynamic Memory enabled, a virtual machine will boot up with a small amount of RAM, and will consume RAM as required from the host. In WS2012 and WS2012 R2 there are a number of settings that are configured on a per-virtual machine basis:

Sponsored Content

Passwords Haven’t Disappeared Yet

123456. Qwerty. Iloveyou. No, these are not exercises for people who are brand new to typing. Shockingly, they are among the most common passwords that end users choose in 2021. Research has found that the average business user must manually type out, or copy/paste, the credentials to 154 websites per month. We repeatedly got one question that surprised us: “Why would I ever trust a third party with control of my network?

  • Startup RAM: This is the amount of memory that a virtual machine is configured to start with. If a virtual machine has 1024 MB startup RAM then it will consume 1 GB RAM from the host upon startup. Note that when you log into the guest OS and run any performance tools, you will only see 1024 MB RAM until more RAM is assigned. For Windows, this should be at least 512 MB, but that should be enough to get your guest OS and essential services operational.
  • Minimum RAM: This is the amount of memory that a virtual machine can shrink down to. Note that Windows 8 and Windows Server 2012 (WS2012) need 512 MB to boot, but they can run on less than 300 MB when idle!
  • Maximum RAM: This defines how much RAM a virtual machine can expand to. This is 1 TB by default, but is normally set to a more realistic amount to avoid waste. Using the previous example of a virtual machine requiring 16 GB for peak usage, you would set it to 16384 MB if enabling Dynamic Memory.
  • Memory Buffer: This is a percentage of spare RAM that is assigned to the virtual machine. It is used to service instant demands for more RAM. A Windows guest OS will also use it for caching when memory is not under pressure.
  • Memory Weight: A slider defines the importance of this virtual machine. Virtual machines will a higher priority have a better chance of getting more RAM than virtual machines with a lower priority when there are limited resources available on the host.
Dynamic Memory settings in a Hyper-V virtual machine
Enabling Dynamic Memory in a Hyper-V virtual machine.

Strictly speaking, there are no-one-size-fits-all strategy for Dynamic Memory. For example, there is specialist guidance for SQL Server. A virtual machine that is running the Exchange mailbox role shouldn’t use Dynamic Memory. If you are deploying virtual machines by hand then you should tweak the setup. If you are using System Center Virtual Machine Manager (SCVMM or VMM), then you should have different hardware profiles and virtual machine templates to suit your needs.

In my environments I typically set the startup RAM to 1024 MB. That’s enough to install SQL Server; remember that a guest OS only sees what it starts up with unless more memory has been assigned. I’ll set minimum RAM for something small like 128 MB. Maximum RAM is set to whatever the peak demand is for the service or application that will run in the guest OS. And I normally leave memory buffer at 20 percent. However, I will change that to 5 percent for SQL Server VMs.

Be sure to check back here on Petri IT Knowledgebase, as I’ll write some more posts on Dynamic Memory over the coming weeks to explain in more depth how this Hyper-V feature works.

Related Topics:

Aidan Finn, Microsoft Most Valuable Professional (MVP), has been working in IT since 1996. He has worked as a consultant and administrator for the likes of Innofactor Norway, Amdahl DMR, Fujitsu, Barclays and Hypo Real Estate Bank International where he dealt with large and complex IT infrastructures and MicroWarehouse Ltd. where he worked with Microsoft partners in the small/medium business space.
Don't leave your business open to attack! Come learn how to protect your AD in this FREE masterclass!REGISTER NOW - Thursday, December 2, 2021 @ 1 pm ET

Active Directory (AD) is leveraged by over 90% of enterprises worldwide as the authentication and authorization hub of their IT infrastructure—but its inherent complexity leaves it prone to misconfigurations that can allow attackers to slip into your network and wreak havoc. 

Join this session with Microsoft MVP and MCT Sander Berkouwer, who will explore:

  • Whether you should upgrade your domain controllers to Windows Server
    2019 and beyond
  • Achieving mission impossible: updating DCs within 48 hours
  • How to disable legacy protocols and outdated compatibility options in
    Active Directory

Sponsored by: