cache and other memory consumers that use otherwise available memory behind the
scenes.
To avoid this memory starvation and provide extra memory for caches, Dynamic
Memory provides some memory beyond a virtual machine’s instantaneous demand,
up to the Maximum RAM setting (that is, Hyper-V will never assign more than
Maximum RAM). By default, this amount is 20 percent of demand. When the virtual
machine has less than this available memory percentage, then more memory is added
if physically available in the Hyper-V host to bring the virtual machine back to the
desired percentage of available memory. The memory buffer can be changed to a
desired amount based on the needs of the virtual machine, and it can be modified
while the virtual machine is running.
The other slider is used to set a priority of memory allocation in times when there is
not enough physical RAM available to meet all of the desired amounts for the VMs.
Just as with CPU allocation, a VM with a higher memory priority will receive
additional memory before VMs of a lower priority.
One aspect of Dynamic Memory that makes it special in terms of its memory
optimization technique is how the decision to add or remove memory is made. I used
the word intelligently earlier because Dynamic Memory does not just give more
memory to a virtual machine if its free memory is low, but rather it’s based on how
much memory the workload needs. Figure 2.15 shows part of a Task Manager view of
a Windows Server 2008 R2 server that has 8GB of RAM. At first glance, this virtual
machine has only 4MB of free memory, so it would seem to need more. But this is not
the case.