Today I will share with you my best practices for configuring the paging file in Windows Server 2008 and 2012.
Paging file seems to be a very popular subject, as we get questions about it all the time. Many customers are configuring the paging file incorrectly, based on outdated rules-of-thumb that are no longer apply to modern operating systems like Windows Server 2008 and above.
Memory, Paging and Paging file
Let’s start with the basics: Windows memory management is based on Virtual Memory, where each process has its own private virtual address space. Windows will move the least used memory pages to a hidden file called the page file, when approaching a low memory condition.
The Page file is a special file used by Windows to store modified pages, and the process of moving pages from RAM to the Page file is called “Paging”.
Page files have two primary roles:
- Physical extensions of RAM that store modified data
- Record information about the state of the system in case of a system crashes
I will explain the size requirements for each role.
Physical extensions of RAM
If your server exhausted all available RAM and you don’t have a page file, applications will crash or hang because Windows is unable to allocate more memory. Even worse, In some cases Windows itself can become unstable.
Windows Commit Limit, also known as system commit, is the sum of current paging files’ size and the physical memory that Windows can use to allocate memory. For example: If you have a 16 GB RAM and a 16 GB paging file, then your commit limit is 32 GB.
The Commit Limit can be increased by either changing the current paging files` size, adding new paging files or by adding more RAM.
Crash dump size
On business-critical servers it’s recommended to configure the server to capture memory dumps for analysis. Windows is using the paging file as a placeholder for memory dumps, meaning that Windows is writing the crash dump first in the page file, and then the SMSS process copies it to a different memory dump file.
This have an effect on the page file size, because it needs to accommodate all the information Windows recording during a crash, more on this later.
Sizing the paging file
The old rules of thumb (Page file size = RAM * 1.5 or RAM * 2) makes no sense in modern systems, where the logic should be: the more RAM you have, the less you need paging file.
So, how should you size your Page File?
Well, we don’t have a magical value that will fit any system and any workload. It really depends on the specific workload and the type of server.
When sizing the page file we need to consider our applications memory needs and crash dump settings.
How To Optimize Your Paging File
Now that you have a good understanding of the context and rules to optimize the paging file, it’s time to actually dig into the settings themselves. It’s up to you to decide what specific settings to use based on your specific configuration.
- First, open the start menu and then type performance into the search bar.
- Look for Adjust the appearance and performance of Windows under the settings category as you can see in the screenshot below.
- The Performance Options window should now open. Switch to the advanced tab.
- With the Advanced tab open, click on Change under the Virtual memory section.
- The Virtual Memory window will now open. All of the options are greyed out by default. So first we have to uncheck Automatically manage paging file size for all drives.
- Now you’ll see the following options open up for you to change.
- Each drive’s settings can be managed independently. Click on the desired drive in the window above to change its specific settings. Logical partitions will also show up as independent drives.
- Select custom size to specify your own minimum and maximum paging file size. Select No Paging File if you don’t want a particular drive to have one at all.
- The default automatic behavior is to have a minimum size 1.5 times the amount of actual RAM. We don’t recommend you choose a minimum size below this. Once you have set a particular drive the way you like it, remember to click Set to lock those choices in.