Read on:
Beginners’ Guide for Microsoft Hyper-V: Overview of Hyper-V – Part 1
Beginners’ Guide for Microsoft Hyper-V: How to Install Microsoft Hyper-V Using Server Manager – Part 2
Beginners’ Guide for Microsoft Hyper-V: How to Install Microsoft Hyper-V with PowerShell – Part 3
Beginners Guide for Microsoft Hyper-V: How to Install Microsoft Hyper-V in Windows Server Core – Part 4
Beginners Guide for Microsoft Hyper-V: Remote Management of Hyper-V – Part 5
Beginners Guide for Microsoft Hyper-V: How to Install Hyper-V Server – Part 6
Beginner’s Guide for Microsoft Hyper-V: What is Azure Stack HCI – Part 7
Beginner’s Guide for Microsoft Hyper-V: Windows Admin Center Hyper-V Management – Part 8
Beginner’s Guide for Microsoft Hyper-V: Configuration of Hyper-V Networking Best Practices – Part 9
Beginner’s Guide for Microsoft Hyper-V: Hyper-V Storage Best Practices and Configuration – Part 10
Beginner’s Guide for Microsoft Hyper-V: How to build a Virtual Lab with Hyper-V – Part 11
Beginner’s Guide for Microsoft Hyper-V: Top 10 PowerShell Commands for Hyper-V – Part 12
Beginner’s Guide for Microsoft Hyper-V: How to Create a Hyper-V Virtual Machine – Part 13
Beginner’s Guide for Microsoft Hyper-V: Hyper-V Shared Storage for Beginners – Part 14
Beginner’s Guide for Microsoft Hyper-V: How to Create Hyper-V Cluster – Part 15
Beginner’s Guide for Microsoft Hyper-V: What is Non-Uniform Memory Access (NUMA) – Part 16
Hyper-V contains many different memory techniques to allow customers to get the most out of their host hardware and achieve very dense deployments. One of the memory features that provides exciting capabilities is Hyper-V Dynamic Memory. What is Hyper-V Dynamic Memory and how is it used?
An age-old problem
Memory configuration and consumption in a virtual machine is an age-old problem that admins have been fighting since virtualization became mainstream in the enterprise. For example, operating systems like Windows may require more memory during the startup process than when it reaches a steady state. This and other considerations lead administrators to assign extra memory to a virtual machine.
Historically, changing the memory allocated to a virtual machine is a power-off event. You can think of it like a physical machine. You can’t add memory to a workstation or Server that is running. Instead, you power it off, add the memory, and then power it back on. With traditional virtual machine technologies, this same process holds true. So, adjusting memory is a disruptive process.
What is Hyper-V Dynamic Memory?
Hyper-V Dynamic Memory helps to utilize host hardware more efficiently when you have virtual machines that fit specific characteristics and use cases. What are those?
Microsoft specifically mentions virtual machines that are idle or with minimal load. These could be pooled virtual machines in a Virtual Desktop Infrastructure (VDI) environment. These types of VMs sit unused until someone logs in and the VM resources are needed.
Hyper-V Dynamic Memory allows the Hyper-V host to more efficiently manage memory for workloads, increasing memory as needed. It also helps to improve the management workflow for Hyper-V admins to increase memory for Hyper-V virtual machines.
The feature allows the Hyper-V host to monitor the current memory demand inside the guest virtual machine and adjust the memory assigned based on the configured properties of the Dynamic Memory settings.
Typically, to increase the memory on a Hyper-V virtual machine, you would need to use the following process:
- Select the Hyper-V virtual machine in Hyper-V Manager
- Click the Shut Down option under the Action pane on the right
- Right-click your VM and select Settings
- Select the Memory section of the VM Settings
- Add the desired amount of additional memory to the RAM field
- Click Apply and then click OK
If this is a production-critical virtual machine, it would likely require a maintenance period for shutting down the VM, adding the memory, and starting it up again. One of the great benefits of the Hyper-V Dynamic Memory capability is that it allows essentially adding memory to a Hyper-V virtual machine without the need to shutdown the virtual machine. Let’s see how Dynamic Memory helps to alleviate this challenge.
Hyper-V Dynamic Memory Settings
The Hyper-V Dynamic Memory settings help to solve the challenges mentioned above. Note the following settings related to Hyper-V Dynamic Memory.
- Startup RAM – This is the minimum amount of memory with which a Hyper-V virtual machine will start. You should configure this memory amount to include the amount needed by the virtual machine to start up correctly, and it cannot be adjusted while the VM is running
- Minimum RAM – This value is the smallest amount of RAM you want this virtual machine to consume. The Hyper-V host will adjust the consumed memory of the VM only to include the minimum amount of memory if the workload running inside the virtual machine does not require more than the configured minimum RAM
- Maximum RAM – The maximum memory is the maximum memory amount that a Hyper-V virtual machine can consume. The Hyper-V host will incrementally increase memory as workload demand increases and will continue to add memory until it reaches the maximum memory, at which no more memory will be added to the virtual machine
- Memory buffer – As we described above, the Hyper-V host will incrementally add memory as workload demand increases. The incremental amount added is defined by the memory buffer. The percentage configured in this setting is the amount of incremental memory added to a virtual machine when memory is increased. The default configuration setting, as shown in the image below, is 20%. Generally, the 20% default will suffice in most environments
- Memory Weight – This setting controls the priority of a specific VM concerning the physical memory in cases of memory contention. This setting helps Hyper-V understand how to distribute memory resources across VM when there is not enough physical memory available on the Hyper-V host
Reliable restarts with Smart Paging
The minimum memory setting ensures the Hyper-V virtual machine will always have the amount of memory defined in this setting available to the virtual machine. If the amount configured for minimum memory is less than the amount configured for startup memory, Hyper-V uses something called Smart Paging.
The Smart Paging technique uses disk resources as a temporary memory alternative when more memory is required to restart a virtual machine than there is configured in the minimum memory setting. To clarify when Smart Paging kicks in, note the following:
- The VM is restarting and not coming up from a powered-off state
- There is no available physical memory
- No memory can be reclaimed from other virtual machines on the Hyper-V host
- It is not used when a virtual machine is in the process of failing over
Hyper-V Dynamic Memory and Virtual NUMA
You cannot use the Dynamic Memory feature and Virtual NUMA simultaneously. A virtual machine with Dynamic Memory enabled only has one virtual NUMA node available to it at all times and won’t be able to take advantage of any NUMA enhancements or NUMA-aware applications.
Wrapping Up
Hyper-V uses many different memory management techniques and capabilities to ensure virtual machines and production workloads have sufficient memory resources. Hyper-V Dynamic Memory is a mechanism to efficiently run dense populations of virtual machines on a Hyper-V host, such as a pooled VDI desktop configuration or when running many VMs that are idle or of low utilization.
It allows Hyper-V to reclaim memory as needed from virtual machines and provides settings to control the startup, minimum, and maximum RAM values. Hyper-V hosts can also incrementally increase the amount of memory for a specific VM to satisfy increased demand.
Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.