Hyper-V Dynamic Memory Pros and Cons | Best Practice
When using virtual machines, memory is easy to be consumed fast. How to reduce memory consumption? In Hyper-V, enabling Dynamic Memory is an efficient solution to reclaim the unused memory to the required virtual machines automatically.
Why do you need Hyper-V Dynamic Memory
Hyper-V Dynamic Memory was originally introduced in Windows Server 2008 R2 with SP1. It is designed to automatically balance the amount of physical memory occupied by virtual machines running on a server, improving the reliability of restart operations. Administrators can automatically adjust the amount of physical memory for virtual machines based on the application priority, thus optimizing application performance and memory space.
In older versions of Hyper-V, you could only specify a fixed size of physical memory for virtual machines. But virtual machine requires more memory at startup than its steady state, so two scenarios often occurred. One is that the allocated memory is exhausted and the virtual machine needs to be shut down and resized. The other is that the virtual machine is allocated too much memory than it actually needs, which cannot be reclaimed after booting, resulting in wasted resources.
Now let's discuss Hyper-V Dynamic Memory pros and cons further.
Hyper-V Dynamic Memory advantages and disadvantages
Hyper-V Dynamic Memory offers various advantages and disadvantages. If you want to know if it is suitable for you, please read this section carefully.
Advantages of Hyper-V Dynamic Memory
1. Improves the reliability of start-up operations. In Windows Server 2012, Smart Paging was introduced to ensure the reliable virtual machine restart operations.
2. Improve resource utilization. Dynamic memory makes full use of memory resources by automatically reclaiming free or low-load VM memory and allocating it to Hyper-V VMs that requires more memory.
3. Reduce hardware spending. Allocating memory to each virtual machine accurately reduces the waste of resources on hardware, thus saving costs.
Disadvantages of Hyper-V Dynamic Memory
Hyper-V Dynamic Memory also has drawbacks that can negatively impact VM memory performance.
1. When Hyper-V Dynamic Memory is enabled, issues with database applications may occur. It is recommended that you use applications that are compatible with Hyper-V Dynamic Memory to avoid any performance issues.
2. When the VM is running or paused, you cannot resize the maximum and the minimum memory amount as well as modify the VM startup memory amount.
3. Risk of overprovisioning computer physical memory in case you don’t keep track of memory allocation within your virtual environment.
Best practice to use Dynamic Memory in Hyper-V
After learning Hyper-V Dynamic Memory pros and cons, you may have made your own decision. Hyper-V Dynamic Memory was integrated into Windows Server 2008 R2 Service Pack 1. If you want to use Hyper-V Dynamic Memory to improve virtual machine memory performance, please refer to the following practice.
Enable Hyper-V Integration Services
In order to use Hyper-V Dynamic Memory correctly, you need to first enable Hyper-V Integration Services. Since the release of Windows Server 2016, you can install and update Hyper-V integration services via Windows Update. Hyper-V integration service must be enabled in the host and guests. The steps are as follows.
1. Open Hyper-V Manager, then click Action >> Insert Integration Services Setup Disk.
2. In guest virtual machine, select the DVD drive with the installation files. Right-click the DVD drive and select Install Hyper-V Integration Services.
3. The installation/upgrade of Hyper-V Integration Services will begin. Reboot your client/server.
4. Access to Hyper-V Manager Summary to check the version of Hyper-V Integration Services.
Configure Hyper-V Dynamic Memory
Power-off your virtual machine before enabling Hyper-V Dynamic Memory.
1. Open Hyper-V Manager, select the virtual machine you want to configure. Then click Settings.
2. In the opened wizard, select Memory. You will see the multiple components such as RAM, Minimum RAM, Minimum RAM, Memory Buffer and Memory Weight. Let’s clear these components first, and configure them as you need.
Startup RAM: It is the minimum amount of physical memory that the VM can use at startup. It’s recommended to set up Strat RAM high enough to ensure the VM starts quickly.
Minimum RAM: It’s the minimum amount of physical memory that should be assigned to the VM after it has started. You can reclaim the free and unused memory to the required VM until the minimum RAM value is reached (32 MB). When the virtual machine is running or paused, it’s impossible to increase the minimum memory, but you can decrease it.
Maximum RAM: It’s the maximum amount of physical memory that the VM can use. The range of Minimum RAM is from the assigned Startup RAM to 1 TB (1,048,576 MB). When the virtual machine is running or paused, it’s impossible to decrease the minimum memory, but you can increase it.
Memory Buffer: It is a portion of physical memory which is set aside for the VM based on its memory needs. By default, the memory buffer value amounts to 20% but it can be set up to be as low as 5% and as high as 2000%. You can change the memory buffer value at any point, even while the VM is running.
There is a formula to calculate the memory buffer.
Amount of memory buffer = how much memory the virtual machine actually needs / (memory buffer value / 100).
Memory Weight: It determines the priority of the selected VM compared to other VMs on this host. In a production environment, some virtual machines have heavy workloads than others, so these virtual machines requiring higher performance should have a higher priority of additional memory than other general virtual machines.
One of the disadvantages of Hyper-V Dynamic Memory is that you need to monitor the memory usage constantly, otherwise it will overprovision RAM and completely run out of memory. You can use native monitoring tools or third-party software. For example, you can check the VM memory state through the host in Hyper-V Manager or the guest VM in Task Manager.
In addition, facing a large amount of enterprise data that needs to be backed up, try to choose a proper backup method that saves storage space. For example, flexible backup solution and automatic clean-up plan can effectively reduce the need for storage devices, thus reducing costs and time.
Memory saving way to backup Hyper-V virtual machine
AOMEI Cyber Backup is a professional backup software for virtual machines. It offers resilient backup strategies that can flexibly track the Hyper-V changed data. It allows you to schedule the backup and set up a cleanup policy to automatically delete unwanted backups. More benefits are as following.
Easy-to-use: Add all the VMs to the central console for backup and manage agentlessly. You can complete any operation via simple clicks.
Flexible backups: Easily backup entire virtual machine with full backup and offers incremental and differential backups for changed data.
Automate VM backup: Schedule tasks to backup unlimited virtual machines automatically and protect virtual machine continuously even though the VM is running.
Fast recovery: Instantly recover the whole VM to its precious state or restore it to another host without any complicated configuration and reinstallation.
*You can choose to install this VM backup software on either Windows or Linux system.
1. Click Backup Task >> Create New Task to start scheduling automatic backups (for example VMware ESXi Backup).
2. Select virtual machines and the destination to store the backups such as network or local location. For example, enter a NAS address and verify the identification to backup VMs to NAS.
3. On Schedule window, for example, select full backup and incremental backup method, then set the backup frequency as weekly.
4. On Backup Cleanup window, specify the retention policy for each backup and choose to always retain the First full backup.
5. Click Start Backup.
We have discussed the Hyper-V Dynamic Memory pros and cons in this article. To put it simply, using dynamic memory correct can reduce memory consumption and costs, but it also has the cons of memory performance. Please make choice according to your own needs.