Posey's Tips & Tricks

Should Hyper-V VMs Be Configured To Use a Pagefile?

Although the Windows operating system has changed substantially over the years, one of the options that has existed for decades is the option to use a pagefile.

In the early days of Windows, the pagefile helped make up for shortages in physical memory. Even today, the pagefile is enabled by default.

But should you be using a pagefile on a virtual machine (VM)? As is the case with so many other things in the world of IT, the answer is not a simple yes/no. So before I answer the question of whether or not the pagefile should be enabled, let's take a look at the corresponding setting.

In Windows 10, you can access the setting by right-clicking on the Start button and then choosing the System command. When the System screen appears, click on the About tab and then click System Info. When you arrive at the System screen, click on Advanced System Settings. This will open the System Properties sheet, and the Advanced tab will be automatically selected. Click on the Settings button found in the Performance section, and then click on the Advanced tab within the resulting Performance Options dialog box. Here you will find the pagefile setting, which is listed in Windows 10 as Virtual Memory. You can see what the setting looks like in Figure 1.

Figure 1: You can configure the pagefile by adjusting the virtual memory settings.

As you can see in Figure 2, Windows will automatically manage the paging file size for all of your drives by default. You do, however, have the option of changing the pagefile size or even disabling the pagefile completely.

Figure 2: You can adjust or disable the pagefile.

So let's get back to the original question: Should you disable the pagefile within a Hyper-V VM?

In making that decision, there are several different factors that you will need to consider. One such factor is the fact that the pagefile, when enabled, can consume quite a bit of storage space. The actual pagefile size varies from one system to the next, but the pagefile is usually multiple gigabytes in size. In the case of the system shown in Figure 2, for example, the pagefile is consuming over 4GB of space. Granted, 4GB isn't really all that large by today's standards, but if you have multiple VMs and they are all equipped with a multi-gigabyte pagefile, then those pagefiles could be collectively consuming a whole lot of space.

In most cases, storage consumption is one of the more minor considerations with regard to pagefile use. A bigger consideration is storage IOPS. Storage IOPS are often the resource that is in shortest supply on virtualization hosts. The available storage IOPS directly determine how many VMs a host will be able to accommodate and how well those VMs will perform.

With that said, consider the fact that the pagefile originally existed as a tool for overcoming memory shortages. Windows was able to move inactive pages out of physical memory and into the pagefile as a way of freeing up RAM for active processes. This process, which is sometimes called swapping, tended to be slow and resource-intensive.

Today, most machines are equipped with sufficient memory and swapping is therefore largely unnecessary. However, allocating an inadequate amount of RAM to a VM could cause it to resort to using the pagefile as a source of virtual memory. From a performance standpoint, it is best to give VMs the memory that they need.

Another thing to consider with regard to pagefile use is that Windows uses the pagefile during a crash dump situation. If you want Windows to create crash dump files following a system crash, then you are usually going to need to have the pagefile enabled. Starting with Windows 7, it became possible to create a dedicated dump file. A dump file is like a paging file, except that it is only used in a crash dump situation. A dump file does not act as virtual memory.

So should you disable the pagefile for Hyper-V VMs? Personally, I like to disable the pagefile so long as the VMs have plenty of memory and there are no applications that explicitly require a pagefile. It is worth noting, however, that you should not disable the pagefile on the Hyper-V host. According to Microsoft, Hyper-V hosts should be configured to use system managed pagefiles.

About the Author

Brien Posey is a 22-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.

Featured

comments powered by Disqus

Subscribe on YouTube

Upcoming Training Events

0 AM
Live! 360 Orlando
November 17-22, 2024
TechMentor @ Microsoft HQ
August 11-15, 2025