Tip

Best swap file locations

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

    Requires Free Membership to View

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 first published in November 2001

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
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
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.