Sizing The Windows Page File

A common question is how big should the Windows page file be?  In my opinion, as small as possible.

The Windows page file is analogous to the Linux swap file.  It's a file on the hard disk that serves as virtual memory.  If all running the applications won't fit inside physical RAM, Windows swaps out lesser-used segments of memory to the page file so it can make room for other applications.  But it's a relic from the days when computers had no where near the amount of RAM they have to today.

In practice, you never want to use the page file.  Why?  Because paging operations (swapping memory segments between physical RAM and the page file) is expensive.  Very expensive!  Disk I/O is orders of magnitude slower than physical RAM, and when Windows is doing a lot of paging operations, system performance takes a big hit.  It can slow the system to the point that the screen cursor needs minutes to respond when the mouse is moved.  And then the disk activity light and the power light are indistinguishable from each other — both shining with a steady glow.  Usually the only way to recover when this happens is a hard reboot of the system.

The problem is that the default for automatically allocating the page file hasn't changed since Windows NT Server 3.5.  It creates a page file that is 1.5 times the size of physical RAM.  A good value when servers had 512 MB of RAM, but extremely wasteful on a server with 16 GB of RAM.  That's a 24 GB page file!  And did I mention that the default location for the page file is the C drive?  With everything else that is vying for space on the C drive, the last thing you need is a gigantic file you never want to use.

You can have no page file, but this isn't a good idea.  There are a few rarely used things that Windows wants to keep in the page file, but these are never that big.  A good value for the page file is between 2 – 4 GB.  Resist the temptation to make it any bigger than 4 GB, regardless of what "best practices" say.  Remember, you never want to use the page file.  And you only ever need one page file.  Having multiple page files is even more wasteful than having a extremely large page file.  Don't do it!

Use a custom size for the page file and set the initial and maximum size to the same value.  If these values are not the same, then the page file will become fragmented as Windows shrinks and expands the page file.  You want to keep disk I/O operations for the page file to an absolute minimum, so let Windows create the page file once and keep it from constantly resizing it.

Posted in Windows.
All information in this blog is provided "AS IS" with no warranties and confers no rights.
The opinions expressed in this blog are mine alone and do not represent those of my employer.
Powered By PEER 1 Managed Hosting