Memory

Microsoft Platform Guide

Audience
Public
Source Type
Documentation

.

The topic of memory assignments for a VM is a constant source of debate between application owners and system administrators. “Right-sizing” the VM memory assignment should be an ongoing discussion between both IT silos, as VM-level memory telemetry rarely understands the nuances of the application stack and how it manages its memory footprint. A working understanding of the memory demands of the application are needed to understand the proper amount of memory that should be allocated to the VM. In-guest OS and/or application-level telemetry can sometimes be used to better gauge the memory usage patterns of the application.

In some workloads, such as burstable application servers that will demand a significant amount of RAM, Hyper-V allows for the use of “dynamic” memory assignments for the VM, as shown. This feature has both advantages and disadvantages, and these should be weighed carefully before deciding to enable this feature. For more information on the Dynamic Memory feature, read the older (but still applicable) Learn topic “Hyper-V Dynamic Memory Overview”.

Advantages of using Dynamic Memory include the following benefits:

  • Improved VM-level consolidation because the VM consumes only the amount of memory required for the workload (not necessarily the amount allocated).

  • Burstable workloads can then consume the RAM required at the time, even if it is greater than the amount allocated to the VM, which improves application-level performance.

However, with the pros always come the cons. Disadvantages of using Dynamic Memory include the following drawbacks:

  • A greater risk of physical memory overcommitment is present, which left uncontrolled can cause performance degradation on some or all of the VMs on the host.

  • Memory leaks in applications can cause runaway consumption rates and put the host into a memory pressured state if not carefully monitored and managed.

  • Some applications that manage (and possibly lock) their own memory footprint, such as Microsoft SQL Server, can have challenges with dynamic memory enabled.

Hyper-V Integration Services is required before Dynamic Memory can be enabled. More considerations on these pros and cons are presented by Microsoft in the blog post “When to use Hyper-V Dynamic Memory versus Runtime Memory Resize”.

The general rule of thumb when it comes to database workloads is to reserve the amount of memory it requires to ensure consistent, good, reliable performance. Reserving the memory allocation gives greater confidence to DBAs who wish to enable more advanced options such as “Lock Pages in Memory” or features like “Large Memory Pages” but who cannot have underlying host memory pressure states interfere with the usage of the features.