Windows Server How-To
How To Use Smart Paging in Hyper-V
The feature is all about allocating relocating dynamic memory that might be going to waste
As someone who has written three books on Hyper-V, I tend to get a lot of Hyper-V-related questions from readers. Some of the most common questions that I get are related to Hyper-V's smart paging feature.
A lot of people seem to have the misconception that smart paging is related to the Windows Pagefile. In actuality, the Windows Pagefile and the Smart Paging File are very different from one another.
The Windows Pagefile is a legacy operating system component that is left over from the days when physical memory was really expensive. The idea was that hard disk storage space could be used to compensate for shortages of physical RAM. Today the Windows Pagefile is also used to accommodate crash dump information.
Hyper-V's Smart Paging File is different. In order to understand what the Smart Paging File is and what it does, you have to understand a little bit about Hyper-V's dynamic memory feature.
Dynamic memory is a feature that is designed to compensate for a host server's physical memory limitations. Rather than assigning a static amount of memory to a virtual machine, the virtual machine uses the memory that it needs within the limits set by the administrator. The idea behind this concept is that using dynamic memory reduces memory consumption, therefore allowing the host to handle a greater number of virtual machines. If for instance a VM is assigned 4GB of RAM, but only needs 3.5GB, then half a gigabyte of memory is being wasted. That half a gigabyte could be better used on another virtual machine.
If you look at Figure 1, you can see the dynamic memory settings for a virtual machine. As you can see in the figure, dynamic memory is not enabled by default. If you want a virtual machine to use memory dynamically then the dynamic memory feature must be enabled.
As you look at the figure above, there are three settings that you need to pay attention to. The first of these settings is the startup RAM. In this particular figure, dynamic memory is not being used, so the startup RAM value represents the amount of memory that is being statically assigned to the virtual machine. If dynamic memory were enabled however, then the startup RAM value would reflect the amount of memory that is initially assigned to the virtual machine before the dynamic memory feature increases or decreases the memory consumption.
The other two settings to make note of are the minimum RAM and the maximum RAM settings. As the names imply, these settings reflect the least and most physical memory that will ever be allocated to the virtual machine.
So what does all of this have to do with the Smart Paging File? Well, here is the really important part. Notice in the figure above that the startup RAM and the minimum RAM are two separate values. This means that if a virtual machine is not using all of the memory that it was initially allocated then some of that memory can be released.
So why not set the startup RAM and the minimum RAM to the same amount of memory? There are two reasons. First, some operating systems perform a check to make sure that a certain amount of memory is present. Second, the boot process is resource intensive. Some operating systems consume more memory at boot time than they do when the system is idle.
Because a virtual machine might release some of its physical memory after the boot process has completed, the host server's physical memory can become over committed. This means that the virtual machines collectively use more startup RAM than what is physically installed in the host. You can get away with this if all of the virtual machines are booted at different times and are configured to release unused memory after booting, but it becomes a problem if a VM is rebooted.
Imagine that a host has been over committed and each VM is using the bare minimum amount of memory. Now imagine that one of the VMs is rebooted. Upon reboot, the VM will try to claim the startup RAM, which is not available because the memory is overcommitted. This is where the Smart Paging File comes into play. Rather than allowing the VM boot to fail, the Smart Paging File is used to make up for shortages in RAM. Unlike the Windows Pagefile however, the Smart Paging File is only used by the boot process. It is not used for routine memory paging operations.
As you can see in Figure 2, Hyper-V allows you to configure the Smart Paging File's location. The Smart Paging file is stored with the VM by default, but can be redirected to another location if necessary.
Normally the default location is fine, but if the VM resides on an SSD array, you might consider placing the Smart Paging File onto a less expensive storage location.
Brien Posey is a 19-time Microsoft MVP with decades of IT experience. As a freelance writer, Posey has written thousands of articles and contributed to several dozen books on a wide variety of IT topics. Prior to going freelance, Posey was a CIO for a national chain of hospitals and health care facilities. He has also served as a network administrator for some of the country's largest insurance companies and for the Department of Defense at Fort Knox. In addition to his continued work in IT, Posey has spent the last several years actively training as a commercial scientist-astronaut candidate in preparation to fly on a mission to study polar mesospheric clouds from space. You can follow his spaceflight training on his Web site.