Learn about the technologies behind the Internet with The TCP/IP Guide!
NOTE: Using robot software to mass-download the site degrades the server and is prohibited. See here for more.
Find The PC Guide helpful? Please consider a donation to The PC Guide Tip Jar. Visa/MC/Paypal accepted.
View over 750 of my fine art photos any time for free at DesktopScenes.com!

[ The PC Guide | System Optimization and Enhancement Guide | System Optimizations and Enhancements | Operating System Performance Optimization ]

Optimize Swap File Location on Your Hard Disk Volumes

The swap file is the file on your hard disk that is used for virtual memory paging. The swap file is very important because it is used in place of memory. The hard disk is much slower than regular memory so anything that can be done to increase the speed of the swap file translates to improved performance.

One way to improve swap file performance is to eliminate swap file resizing. Another way that is less well-known is to optimize the location of the swap file, both in terms of what disk volume is being used and where on the volume the file is. Here are some specific ideas; note that how much improvement you get with these ideas depends to some extent both on your system and how you use it:

  • Use A Second Hard Disk: One common optimization trick is to put the swap file on a second hard disk, or a hard disk that is different from the one that you boot or that contains most of your programs and files. The idea here is that the slowest part of hard disk access is moving the heads (seek time). If you put the swap file on a separate disk, the heads don't have to move back and forth between where the data files are and where the swap file is on the same disk.
  • Locate At the Front of the Disk: The physical beginning of any hard disk is the area that has the fastest data transfer, because of the use of multiple zone recording. If you put the swap file at the front of the disk, it should give better performance than putting it at the back. This is virtually impossible to do if you are leaving the swap file on the same disk as you have Windows installed into (because Windows itself will be at the front of the disk) but is easy to do if putting the swap file on its own hard disk.

Note: Remember that a hard disk can have several logical volumes. For example, if you divide a disk into two equal partitions, C: and D:, and put the swap file as the first file on D:, you aren't putting the swap file at the front of the disk because D: starts in the middle of the physical disk (C: is at the front.) This can still be a good move, however, see below.

  • Locate At the Geographical Center of the Disk: Another trick for minimizing average seek time is to locate the swap file near the geographical center of the hard disk. This may be preferred in a situation where data is used all around the hard disk, and where a second physical hard disk for the swap file is unavailable. By putting the swap file in the center of the disk, the average seek distance to the swap file from a random spot on the disk is minimized. The easy way to do this is to split the disk into two equal partitions and put the swap file as the first file on the second partition (i.e., exactly what I described in the note immediately above.)
  • Use a Dedicated Partition: In some cases making a special partition just for the swap file can be useful. The best way to do this is to create a small (60 MB or so usually) partition near the front of a second hard disk, and then put the swap file on it and nothing else. This offers several advantages. First, there is no chance of the file becoming fragmented at all. Second, you can hide this partition from view, and since it isn't being used by anything else, there is no chance of the swap file being accidentally deleted, for example. Finally, you can select a large cluster size for this dedicated partition (say 32 KB) to improve block transfer performance. See here for more.

Next: Optimize the Location of Important Files for Better Performance


Home  -  Search  -  Topics  -  Up

The PC Guide (http://www.PCGuide.com)
Site Version: 2.2.0 - Version Date: April 17, 2001
Copyright 1997-2004 Charles M. Kozierok. All Rights Reserved.

Not responsible for any loss resulting from the use of this site.
Please read the Site Guide before using this material.
Custom Search