Monday, December 18, 2006

Windows XP: Swap File (Virtual Memory) - Part 2

Last week I started a series on the Windows Virtual Memory feature, in the first part of the article I explained the swap (or paging) file. In this part of the article I am going to talk about how to optimize it.

Optimizing the Swap File
The default Windows VM settings will work fine for most people. Although, there are still a few ways to optimize the swap file, but in reality they will only offer small amounts of extra performance. So for most people the time required to make these changes might not be worth the effort.

For the real system performance fanatics, I will show you some ways to make your system work more efficiently.
  • Note: None of these changes should cause irreversible damage to your system, but I aways recommend that you have a good back up of your data before proceeding with system changes. Also as always proceed at your own risk.
To configure the Virtual Memory settings:
  • From the Start Menu, right-click on My Computer and select Properties
  • Click the Advanced tab, and press the Settings button in the Performance section.
  • Click on the Advanced tab again, then press the Change button.
Trick 1: The swap file can shrink or grow automatically, consider turning off this feature by setting the 'Initial size' and 'Maximum size' to an equal value in the VM dialog. This should prevent the system from wasting time by trying to manage the size of the swap file.
Note: The general rule of thumb for setting the size of the swap file is about 1.5-2 times the size of your physical RAM.
Trick 2: After turning off the automatic growth feature (in Trick 1), defragment swap file. This can be done using the Windows Defragment tool. This will make the file contiguous and prevent your computer from having to seek all over the hard drive to get the data it needs.

Trick 3: If you have multiple hard drives (and I don't mean multiple partitions on the same drive) installed on your computer. Consider moving the swap file to the non-system drive. This way the computer can access multiple drives at the same time.

Trick 4: If you have enough physical RAM installed on your computer (generally 2GB or more), you might want to consider turning off the VM feature. This will help your computer's performance because it doesn't have to manage the swap file. In the VM dialog, select the 'No paging file' radio button, and press the OK button.

4 comments:

  1. Larry Miller8:14 AM

    For the large majority of users the default settings will be optimum or so close as to make no difference.

    Trick1: The time required for Windows to manage the pagefile is virtually nil. With rare exceptions it will do a better job than you can. Unless you have a very specific need, and you understand what you are doing, leave these settingsa alone.

    Trick2: Almost useless.

    Trick3: Windows will not defragment the pagefile, but fragmentation is not a problem unless it reaches extreme levels, which is very rare.

    Trick 4: The pagefile was designed to enhance performance and it works. This will NOT disable virtual memory. Disabling it will unbalance the virtual memory system and impair performance.

    Remember: Windows designers understand memory management and the pagefile better than you do.

    Larry Miller
    Microsoft MCSA

    ReplyDelete
  2. Anonymous1:51 AM

    Of course, a Microsoft monkey would say that.

    Your response to trick 3 was in fact a response to trick 2. Moving a swap file to a separate physical disk WILL improve performance, is it is not contending with other disk I/O.

    The pagefile was designed to enhance performance in low memory systems, with large amounts of physical ram (more than your set of concurrent applications require), the pagefile becomes redundant except for the provision of core memory dumps in the event of a crash.

    Most users are interested in better performance, not core debugging :)

    ReplyDelete
  3. "None of these changes should cause irreversible damage to your system, but I aways recommend that you have a good back up of your data before proceeding with system changes. Also as always proceed at your own risk".

    Yes because the system itself is very delicate in terms of filing, swapping and generating. Having a back up of your files will let you retrieve files when you do system fixation. But one must be cautious by doing this delicate process.

    ReplyDelete
  4. You are more likely to improve swapping performance by disabling or uninstalling unnecessary processes or services that automatically start at boot time.

    ReplyDelete