Problem solve Get help with specific problems with your technologies, process and projects.

Best swap file locations

Some advice for gaining better swap file performance.

Windows augments RAM memory by using a page file to swap out program segments that are not currently in use as...

a method of freeing up memory for programs and data that are running. The default location for the swap file is the system disk, usually your C: drive.

The disk activity to the page file is very sequential, and can benefit from being located on a drive with a large NTFS block size. The NTFS block size of the C: drive normally defaults to 4KB, and is not easily altered. The optimal configuration would be to have a dedicated hard drive with a large block size for the page file. In truth, a simple method of enhancing page file performance is to place it on the same physical drive as the operating system, but on a separate partition that can be easily formatted with a large block size.

The first step, prior to Windows installation, is to determine how much disk space to allocate for the page partition. I usually use half again to twice the amount of RAM in the system. For example, for a system with 1 GB of RAM -- I would probably set the page file to be 1500 MB (the maximum Windows will usually let you set it to is 4095 MB). To give room for growth, and to eliminate low disk-space messages in your log files -- make it at least 300MB larger than you expect to use. So -- for the sake of this example, the size would be 1.8 to 2.3 GB (lets call it 2 GB). If you expect to add more memory in the future -- allocate for it now.

For example, if you have a 9-GB boot drive, during Windows installation, allocate the first 7,000 MB for drive C:, and leave 2,000 MB un-partitioned space for later use as a swap partition. Perform the Windows installation, and get things configured more or less as you like.

Now go into the system-administration tool area, and use the computer management icon to get to the disk-management section. Change the CDROM drive to a drive letter such as Z:, and then create a primary partition (in this case Drive D:) using the remaining un-partitioned space. Format it with NTFS, and use a block size of 64 KB.

In My Computer, under the performance tab, create a page file on Drive D: with the minimum and maximum size set to the value you decided on earlier (ie; 1500 MB). Setting the minimum and maximum size of the file to the same value will reduce future page-file fragmentation considerably. Make sure you remove any swap file from your C: drive, and reboot the server. (This will prevent you from doing a system memory dump in the future, but few collect/analyze dumps anyway. If you do want your dumps, you might want to keep your page file on the C: drive.) But now, assuming that you have your page file on the D: drive, you have also considerably increased the disk space on the OS partition (C:), so you might want to consider defragmenting it.

There is an added bonus beyond improving the paging performance of your system. Any disk activity to drive D: indicates page file activity. Use Windows Performance Monitor to check disk transfers/sec for your D; drive. A few disk hits per second to the drive is normal, but hundreds of transfers per second indicates that you are under memory pressure, and need to add physical RAM (and increase the size of the pagefile -- hope you left enough space free for growth on the page partition).

Dale McAtee is a performance engineer for Hewlett-Packard Co.'s Server Division.

This was last published in November 2001

Dig Deeper on Windows File Management



Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.