Brian Jackson - Fotolia
Dynamic memory has been a staple feature of hypervisors, such as VMware ESXi and Microsoft Hyper-V, for many years now. Even so, the question of whether dynamic memory should be used is still debated, even to this day, especially when it comes to memory overcommitment. As you might expect, there are compelling arguments both for and against the use of dynamic memory.
For those who might not be familiar with the term, dynamic memory refers to the hypervisor's ability to dynamically allocate memory to a VM on an as-needed basis. If a VM requires additional memory, the hypervisor can provide that memory to the VM -- up to a limit that has been set by the administrator. Similarly, if a VM has more memory than it needs at a given moment, then the hypervisor can reclaim some of that memory and assign it to another VM.
The primary advantage to using dynamic memory is it is possible to increase the VM density. Under the right circumstances, dynamic memory makes it possible for a virtualization host to run more VMs.
The problem with memory overcommitment
Those who oppose dynamic memory use are quick to point out that the only way to use dynamic memory to achieve a higher VM density is to overcommit the host's memory. Memory overcommitment refers to the practice of setting an upper memory limit across all of a host's VMs that exceeds the total memory that is installed in the system. Needless to say, there are potential problems that can occur as a result of memory overcommitment.
Overcoming memory issues
It's worth noting the hypervisor vendors have already solved one of the big problems that has historically been associated with memory overcommitment -- boot failures. Many OSes consume more memory on startup than they do after the OS has been running for a few minutes and has had time to stabilize. With that in mind, imagine a situation in which a virtualization host is running at its maximum capacity, and dynamic memory is in use. Now, suppose an administrator needs to reboot a VM. In the past, the boot process would likely have failed, because the VM required more memory than what it had previously been using, and that memory was not available.
Thankfully, the hypervisor vendors have addressed this problem. Microsoft, for example, provides a Smart Paging file that allows a VM to overcome physical memory shortages during a reboot. Even so, other types of problems related to a VM's performance or stability can potentially occur as a result of inadequate memory during periods of high demand.
It's worth noting you can use dynamic memory without overcommitting a virtualization host's physical memory. However, the only advantage to doing so is it may improve your odds of keeping workloads online during a failover situation. When a host server fails, highly available VMs can be automatically migrated to another host, but only if that host has sufficient hardware resources available. If VMs are configured to use dynamic memory, then it may allow a host to receive more VMs during a failover situation than would otherwise be possible. In that type of situation, the destination host server could be overcommitted, even if the failed host was not.
Monitor application memory usage
Another common argument against the use of dynamic memory is there are some applications that will consume as much memory as possible. This may be by design, or it can stem from a memory leak. In either situation, dynamic memory use would be ineffective because the memory-hungry application would force the VM to claim as much memory as its configuration allows, thereby undermining the benefits of using dynamic memory.
So, the question remains: Should you use dynamic memory or not? Dynamic memory definitely has its place. When it's used carefully, it can increase a host server's VM density. Depending on the hypervisor that is being used, dynamic memory may also be beneficial during a failover situation. Even so, dynamic memory use may be problematic in certain situations in which physical memory has been overcommitted.
The good news is dynamic memory use doesn't have to be all or nothing. It's perfectly acceptable to enable dynamic memory on the VMs on which it will be most beneficial, while continuing to use a static memory configuration for other VMs.
How hypervisors use dynamic memory to increase VM performance
A look at Linux dynamic memory in Hyper-V 2012 R2
How does Hyper-V Dynamic Memory improve virtual server density?