Home | Networking | Computer HWare/SWare | NOS: Unix/Linux | Favorites | Contact Me | RCC Home

Virtual Memory Optimization

The most common way that inadequate RAM expresses itself is through excessive use of the paging file. The performance danger is a condition known as thrashing where the running applications require more system memory than there is RAM, and so memory pages are furiously paged back and forth from the system paging file to try to meet all the demands. When this happens, virtually every memory access by an application requires that a memory page be brought back into RAM from the paging file (and some pages moved back to the paging file), which causes extreme performance problems. Thrashing is the biggest performance-killer you can have!

Sometimes a lot of disk access by an application can cause what appears to be thrashing, when it is really just a lot of disk reads and writes and everything is actually normal. Before concluding that a system is thrashing, you need to look at some performance information. Using System Monitor, examine the counters for Page-Ins and Page-Outs, which indicates the number of pages being paged in and out of the swap file. If these numbers are relatively low and are more "bursty" than steady, then the problem may not be thrashing. You can also compare Page-Ins and Page-Outs with Disk Reads and Disk Writes to see what percentage of disk activity is due to application file reads and writes vs. page file activity.

The terms page file and swap file are synonymous in Windows 98, and you will often see both terms used interchangeably. This is technically incorrect: Windows 98 uses paging and a page file exclusively and does not perform swapping or use a swap file. The term swapping and swap file is actually a hold-over from Windows 3.1, which used swapping of 64 KB pieces of memory for its virtual memory rather than the paging of 4 KB pages of memory that Windows 98 actually uses.

There are only a few ways to deal with thrashing when it occurs:

  • Increase the amount of RAM in the system to eliminate the cause of thrashing
  • Reduce the amount of RAM needed by reconfiguring the applications, removing unneeded system services (like network protocols that aren't being used), or running fewer applications at a time
  • Try to optimize the paging file's activity

To optimize a paging file's settings, use the Performance tab of the System control panel and click the Virtual Memory button. This activates the Virtual Memory dialog box.

To optimize the settings for virtual memory, use these tips:

  • Relocate the virtual memory file to the most active partition of the least active physical disk. You choose the least active physical disk to ensure that the disk heads on the disk are freest to work with the paging file, and you choose the most active partition on that disk to ensure that the disk heads are most often in the general vicinity (partition) of the physical location of the swap file
  • Make sure that the swap file location isn't conflicting with the location where an application is reading and writing files. To optimize a system for a particular application, the optimal situation is to have Windows itself on its own disk drive, the application and its data files on their own disk drive, and the paging file on its own disk drive. If you only have two disks instead of three, locate Windows and the paging file on one disk, and the application and its data on the second disk. If you have one hard disk partitioned into many partitions, they you'll probably have the best luck with Windows, its paging file, and the application and its data files all on a single partition.
  • Periodically check System Monitor to see how large the Swap File In Use counter reads. Set the Minimum setting on the Virtual Memory dialog box to be equal to or greater than the largest Swap File In Use size you've seen. This ensures that the system never has to waste time increasing the size of the paging file as system demands increase
  • While not a performance-improving setting, make absolutely sure that the Maximum setting in the Virtual Memory dialog box leaves adequate room for the heaviest-possible virtual memory needs
  • If you relocate the paging file to another disk, make sure you completely defragment the disk before relocating the paging file; this ensures that the resulting paging file is as defragmented as possible when it is created


Home | Networking | Computer HWare/SWare | NOS: Unix/Linux | Favorites | Contact Me | RCC Home