|
|
Stability and Performance - Taking Control of the Swap File
< previous
You can take control of your Virtual Memory/Swapfile. This is the disk space Windows allocates for storing recently used data and instructions. It is called a "swap" file because it is used for swapping data and instructions in and out of RAM, as a way of keeping RAM clear for the next set of data and instructions. The problem is that the disk drive gets kept very busy in the whole process, and the disk drive is much slower than RAM.
On its own, Windows creates what's called a dynamic swap file: the file grows and shrinks as needed. In fact, if your hard drive has ever suddenly come to life with a long burst of activity that has no apparent cause, it's probably Windows automatically adjusting the size of your swap file.
Trouble is, growing and shrinking the swap file takes time and CPU cycles, and prevents your hard drive from doing anything else until the resizing is complete. And as a swap file grows, piecemeal, it can end up scattered in several locations across your hard drive. Combined, the extra housekeeping needed to monitor and manage the size of the file and the time lost in dealing with swap file fragments can make Windows seem sluggish.
The answer is to set a minimum size for the swapfile. When you do so, the swapfile no longer uses whatever free space that is available on the drive. It specifically looks for a chunk of free space that is the size of the minimum specified. In doing so, that size will be contiguous, meaning all in one piece. AND, since it is in one piece, it can not be fragmented.
With a large-enough, unfragmented (contiguous) swap file, Windows can spend its time using the swap file instead of managing it. Windows (for prefectly good reasons) does not by default use a fixed size for the swap file. This is because it does want to run the risk of your not having enough space left on your hard disk drive to meet the requirements of a minimum swap file size, and it cannot guess how big it will need to be. However, it you are confident that you are always going to have plenty of disk space to spare then you can afford to set a minimum and maximum size for the swapfile.
The only reliable method for determining the correct minimum and maximum size settings is to use System Monitor, and look at the Memory Monitor. Let System Monitor run in the background all day while you do your work, open multiple programs, browse the net, etc. Then at the end of day check to see the peak value of your swapfile. You can check the peak by clicking on the relevant graph and looking at the bottom of the System Monitor which will show your peak value. This will be the setting for your min value. (You may need to convert from bytes or kilobytes to megabytes.)
Also, if you have more than one hard drive, and one is faster than another, then set your swap file on the faster drive. If you have your second drive on the secondary IDE controller this strategy is even more effective.
You can set the swap file zize in Windows 98 by right clicking on the "My Computer" icon, selecting the "Performance" tab, and then clicking on the "Virtual Memory" button. This will allow you to alter the settings.
If this does not work you can edit the settings in the system.ini file. Go to Start | Run | msconfig | OK | System.ini | [386Enh] | Edit | and add the line "MinPagingFileSize=your chosen value in kilobytes" without the quotes. (128MB, for example is 131072 Kb, so enter "MinPagingFileSize=131072"). You can also click on "New" and enter a maximum value, e.g. "MaxPagingFileSize=262144" which means a maximum value of 256MB. There is debate about the merits of setting a maximum value.
There are some risks in this whole process and you may need to experiment for a while to get the right settings. Also, if you ever copy a hard drive's contents or the directory that contains the swapfile using Windows Explorer, be sure NOT to copy the swapfile. If you do, most likely Windows will crash.
There is another area of tweaking you can do - namely, managing the VCache
next >
|
alasdairbroun.org.uk
is hand-crafted* using
pure organic html
with CSS and SSI,
and is hosted on a
Unix Server running
Apache/1.3.29
*except for various
special features such as
newsfeeds, blogs, chat, etc.
|