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:
- 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.
More in Hyper-V
How to Install Hyper-V on Windows Server Core
Mar 16, 2022 | Michael Reinders
Microsoft Says There Will Be No Hyper-V Server 2022 Free Edition
Dec 13, 2021 | Michael Reinders
How to Stop an Unresponsive Hyper-V Virtual Machine
Jun 29, 2021 | Russell Smith
How to Enable Nested Virtualization in Hyper-V
Jun 28, 2021 | Russell Smith
Disaster Recovery with Azure Backup for SQL Server VMs
May 28, 2019 | Michael Otey
Leveraging Virtualization for Improved Availability and Disaster Recovery
Apr 29, 2019 | Michael Otey
Most popular on petri