laurentio
8th March 2009, 05:47 PM
What is the paging file?
The paging file (Pagefile.sys) is a hidden file on your computer's hard disk that Windows XP uses as if it were random access memory (RAM).
The paging file and physical memory make up virtual memory. By default, Windows stores the paging file on the boot partition (the partition that contains the operating system and its support files). The default paging file size is equal to 1.5 times the total RAM. However, this default configuration may not be optimal in all cases. This article discusses how to configure the paging file for system optimization and recovery.
Why do I need page file optimization?
Optimizing your page file when you're running low on RAM is always a good idea. When all physical RAM in a computer is in use, Windows starts using the hard disk as if it were additional RAM. This is why we have a Pagefile (also called the swap file). Because RAM memory is a lot more faster than the hard disk, whenever the computer begins to use the Pagefile to relieve memory pressure, we begin to experience a drastic performance degradation. One of the most effective things you can do to improve performance is ensure that there is enough RAM available to avoid frequent paging (swapping) of memory contents between disk and RAM.
This means that the actual limit on the memory used by all applications is the amount of RAM installed plus the maximum size of the Pagefile.
How much swap space do you need? That depends the amount of RAM you have and the programs you use. The rule of the thumb is 1.5 times the amount of system memory, unless you have too much load on your system.
How to optimize the Windows 2000/XP/2003 virtual memory (pagefile)?
Here are some basic rules you should follow:
First and most important - Add more RAM. No, you do NOT need to put in 4GB of RAM, but if your computer constantly utilizes X MB of memory, then make sure you have at least X MB of RAM available for it, and preferably more. There is no point in overloading a computer with graphic applications and limiting it to 256MB of RAM. While the applications will probably work, your performance will be lowered to the ground. Adding enough RAM will ensure that all the required memory used will indeed be used from the RAM, and not supplemented from the Pagefile.
Move the Pagefile off the disk that holds your system and boot partitions to another fast and dedicated hard disk. If you do put the file elsewhere, you should leave a small amount on C: - an initial size of 2MB with a Maximum of 50 is suitable - so it can be used in emergency. Without this, the system is inclined to ignore the settings and either have no page file at all (and complain) or make a very large one indeed on the C: drive.
Format the partition where the page file is placed with NTFS and a 4kb cluster size (which is in fact the default setting for an NTFS partition).
Have the initial size be at least 1.5 times bigger than the amount of physical RAM. Do NOT make the Pagefile smaller than the amount of physical RAM you've got installed on your system.
Make its initial size as big as the maximum size. Although this will cause the Pagefile to occupy more HD space, we do not want it to start off small, then having to constantly grow on the HD. Writing large files (and the Pagefile is indeed large) to the HD will cause a lot of disk activity that will cause performance degradation. Also, since the Pagefile only grows in increments, you will probably cause Pagefile fragmentation, adding more overhead to the already stressed HD.
Do not place multiple paging files on different partitions on the same physical disk drive.
If you have a RAID-0 (Stripe Set) array, use it to store the Pagefile.
Avoid putting a paging file on a fault-tolerant drive, such as a mirrored volume (RAID-1) or a RAID-5 volume. Paging files do not need fault-tolerance, and some fault-tolerant systems suffer from slow data writes because they write data to multiple locations.
If you use Windows XP and Fast User Switching, there are special considerations: When a user is not active, there will need to be space available in the page file to ‘roll out’ his or her work: therefore, the page file will need to be larger. Only experiment in a real situation will establish how big, but a start point might be an initial size equal to half the size of RAM for each user logged in.
If you can spare an extra Hard Disk (preferably a fast one) or if you have some free HD space on your system (again, preferably on a fast HD, and NOT on the HD that's holding the SYSTEM or DATA partitions) I'd suggest you use it for the sole purpose of the Pagefile. Remember that using another partition on the same SYSTEM or DATA HD will not improve your system's performance at all. To do that you'll need a separate fast HD, preferably connected to a different controller.
You can also improve performance by spreading your page file across multiple physical disks, don't worry about the relative speeds of the hard drives Windows 2000/XP/2003 automatically selects the fastest drive to page memory to.
When creating page files, don't confuse hard drives with partitions. You shouldn't create page files on multiple partitions on the same hard drive. This set-up degrades system performance significantly because when Windows NT writes to these page files, the disk arm of the hard drive is forced to swing back and forth across the disk rather than being able to stay in the general area of the single page file. For those with IDE hard drives, it is recommended to place the page file on separate IDE channels.
Example:
Let's say we have 512MB of RAM and we decided to create a Pagefile of 768MB:
In Windows 2000 go to My Computer, right click it and then choose Properties, go to the Advanced tab, click Performance Options, then click Change. Now you can view and set the parameters you need:
http://support.bicestercomputers.co.uk/attachment.php?attachmentid=133&stc=1&d=1236533652
Notice how Windows 2000/XP/2003 place the Pagefile on the boot partition (I know it says "system" in the image, but still they reference it as the "boot" partition. In this case it's both), the one the OS is installed on (in this case C:\). Windows 2000/XP/2003 also make the Pagefile's initial size 1.5 times the size of the physical memory (RAM) installed. The maximum size is 3 times your RAM. Windows NT used a different calculation here.
http://support.bicestercomputers.co.uk/attachment.php?attachmentid=134&stc=1&d=1236533643
You can write your settings in the initial and maximum boxes, and then click Set. You'll have to reboot in order for the changes to take place. Note that you have to specify the *same* amount for both values. This will keep your Pagefile from resizing, fragmenting and eventually slowing itself down.
You can also divide the Pagefile between your physical disks (not partitions!) to speed up its performance. Select the required disk from the Drive list, write the sizes in the initial and maximum boxes, and then click Set. Repeat this for all the required drives.
In Windows XP go to My Computer, right click it and then choose Properties, go to the Advanced tab, click Performance Options, then click Settings.
http://support.bicestercomputers.co.uk/attachment.php?attachmentid=135&stc=1&d=1236533799
Again click the Advanced tab and then in the Virtual Memory section click Change.
http://support.bicestercomputers.co.uk/attachment.php?attachmentid=136&stc=1&d=1236533799
Now you can view and set the parameters you need.
http://support.bicestercomputers.co.uk/attachment.php?attachmentid=137&stc=1&d=1236533799
Under Drive [Volume Label], click the drive that contains the paging file you want to change.
Under Paging file size for selected drive, click Custom size, type a new paging file size in megabytes (MB) in the Initial size (MB) or Maximum size (MB) box, and then click Set.
If you decrease the size of either the initial or maximum paging file settings, you must restart your computer to see the effects of those changes. When you increase the paging file size, you typically do not need to restart your computer.
How much Pagefile does your system use?
Find Pagefile size using Task Manager in Windows:
A quick way to find out is by using Task Manager:
Open Task Manager and go to the Performance Tab.
http://support.bicestercomputers.co.uk/attachment.php?attachmentid=138&stc=1&d=1236534095
Notice the Physical Memory section. Look at the Total figures: 785904 K (that's the amount of installed RAM).
How much RAM is available? 372924 K – more than half of the installed RAM. You're doing ok for now.
How much memory is your system committed to? Look at the Commit Charge section, at the Total figures: 429604 K.
What was the largest amount of memory your system has ever committed itself to since the last boot? Look at the Peak figures: 453168 K. This means that you're running close to your peak, and although your system has peaked to around 450000 K, it's still far from using up its RAM. You're ok for now.
Bill James MS MVP has a convenient tool, ‘WinXP-2K_Pagefile’, for monitoring the actual usage of the Page file, which can be downloaded here (http://billsway.com/notes_public/WinXP_Tweaks). A compiled Visual Basic version is available from Doug Knox's site (http://www.dougknox.com/xp/utils/xp_pagefilemon.htm) which may be more convenient for some users. The value seen for ‘Peak Usage’ over several days makes a good guide for setting the Initial size economically. If the above mentioned files are not any more to be downloaded from the developers sites please check the existing attachments of this post.
Now, since our system automatically sets its initial Pagefile size to 1.5 times the amount of RAM, you're using 1152 MB or hard disk space on a Pagefile that's not even used (Remember? You're not even close to using ALL you RAM…) Seems like a lot of space to waste. You can safely lower the Pagefile size to around 700 MB, and you can safely assume you'll never even touch it. The only drawback it losing the ability to create a dump file in case your system BSODs on you…
I've taken another snapshot, this time of a Windows XP computer:
http://support.bicestercomputers.co.uk/attachment.php?attachmentid=139&stc=1&d=1236534291
Here the Peak was 758064 K, which is ALMOST all the RAM you have. You cannot tell if this was a one-time surge, or something you should expect all the time (here you do need a baseline to tell). You can only say that right now you're safe because you're only using 192992 K or memory out of 785904 K you have. But if you do see that the peak is something that always happens to you, you should set your Pagefile to the minimum of 1.5 times the RAM (which is in fact the default setting).
By the way, you can also see the current amount of memory used by looking at the lower right corner of Task Manager, where it says Commit Charge: 188M / 1426M.
This next snapshot is of a Windows Server 2003 which is having big problems.
http://support.bicestercomputers.co.uk/attachment.php?attachmentid=140&stc=1&d=1236534283
Had this been your computer, then you could have had problems on your system. Here you're using 530MB out of 934MB of memory you have (made of RAM + Pagefile). This means your system is relying on the Pagefile to operate. Here you must add more RAM ASAP, or at least configure the Pagefile for optimum use.
Looking for more optimization tools or hints? Click here
The paging file (Pagefile.sys) is a hidden file on your computer's hard disk that Windows XP uses as if it were random access memory (RAM).
The paging file and physical memory make up virtual memory. By default, Windows stores the paging file on the boot partition (the partition that contains the operating system and its support files). The default paging file size is equal to 1.5 times the total RAM. However, this default configuration may not be optimal in all cases. This article discusses how to configure the paging file for system optimization and recovery.
Why do I need page file optimization?
Optimizing your page file when you're running low on RAM is always a good idea. When all physical RAM in a computer is in use, Windows starts using the hard disk as if it were additional RAM. This is why we have a Pagefile (also called the swap file). Because RAM memory is a lot more faster than the hard disk, whenever the computer begins to use the Pagefile to relieve memory pressure, we begin to experience a drastic performance degradation. One of the most effective things you can do to improve performance is ensure that there is enough RAM available to avoid frequent paging (swapping) of memory contents between disk and RAM.
This means that the actual limit on the memory used by all applications is the amount of RAM installed plus the maximum size of the Pagefile.
How much swap space do you need? That depends the amount of RAM you have and the programs you use. The rule of the thumb is 1.5 times the amount of system memory, unless you have too much load on your system.
How to optimize the Windows 2000/XP/2003 virtual memory (pagefile)?
Here are some basic rules you should follow:
First and most important - Add more RAM. No, you do NOT need to put in 4GB of RAM, but if your computer constantly utilizes X MB of memory, then make sure you have at least X MB of RAM available for it, and preferably more. There is no point in overloading a computer with graphic applications and limiting it to 256MB of RAM. While the applications will probably work, your performance will be lowered to the ground. Adding enough RAM will ensure that all the required memory used will indeed be used from the RAM, and not supplemented from the Pagefile.
Move the Pagefile off the disk that holds your system and boot partitions to another fast and dedicated hard disk. If you do put the file elsewhere, you should leave a small amount on C: - an initial size of 2MB with a Maximum of 50 is suitable - so it can be used in emergency. Without this, the system is inclined to ignore the settings and either have no page file at all (and complain) or make a very large one indeed on the C: drive.
Format the partition where the page file is placed with NTFS and a 4kb cluster size (which is in fact the default setting for an NTFS partition).
Have the initial size be at least 1.5 times bigger than the amount of physical RAM. Do NOT make the Pagefile smaller than the amount of physical RAM you've got installed on your system.
Make its initial size as big as the maximum size. Although this will cause the Pagefile to occupy more HD space, we do not want it to start off small, then having to constantly grow on the HD. Writing large files (and the Pagefile is indeed large) to the HD will cause a lot of disk activity that will cause performance degradation. Also, since the Pagefile only grows in increments, you will probably cause Pagefile fragmentation, adding more overhead to the already stressed HD.
Do not place multiple paging files on different partitions on the same physical disk drive.
If you have a RAID-0 (Stripe Set) array, use it to store the Pagefile.
Avoid putting a paging file on a fault-tolerant drive, such as a mirrored volume (RAID-1) or a RAID-5 volume. Paging files do not need fault-tolerance, and some fault-tolerant systems suffer from slow data writes because they write data to multiple locations.
If you use Windows XP and Fast User Switching, there are special considerations: When a user is not active, there will need to be space available in the page file to ‘roll out’ his or her work: therefore, the page file will need to be larger. Only experiment in a real situation will establish how big, but a start point might be an initial size equal to half the size of RAM for each user logged in.
If you can spare an extra Hard Disk (preferably a fast one) or if you have some free HD space on your system (again, preferably on a fast HD, and NOT on the HD that's holding the SYSTEM or DATA partitions) I'd suggest you use it for the sole purpose of the Pagefile. Remember that using another partition on the same SYSTEM or DATA HD will not improve your system's performance at all. To do that you'll need a separate fast HD, preferably connected to a different controller.
You can also improve performance by spreading your page file across multiple physical disks, don't worry about the relative speeds of the hard drives Windows 2000/XP/2003 automatically selects the fastest drive to page memory to.
When creating page files, don't confuse hard drives with partitions. You shouldn't create page files on multiple partitions on the same hard drive. This set-up degrades system performance significantly because when Windows NT writes to these page files, the disk arm of the hard drive is forced to swing back and forth across the disk rather than being able to stay in the general area of the single page file. For those with IDE hard drives, it is recommended to place the page file on separate IDE channels.
Example:
Let's say we have 512MB of RAM and we decided to create a Pagefile of 768MB:
In Windows 2000 go to My Computer, right click it and then choose Properties, go to the Advanced tab, click Performance Options, then click Change. Now you can view and set the parameters you need:
http://support.bicestercomputers.co.uk/attachment.php?attachmentid=133&stc=1&d=1236533652
Notice how Windows 2000/XP/2003 place the Pagefile on the boot partition (I know it says "system" in the image, but still they reference it as the "boot" partition. In this case it's both), the one the OS is installed on (in this case C:\). Windows 2000/XP/2003 also make the Pagefile's initial size 1.5 times the size of the physical memory (RAM) installed. The maximum size is 3 times your RAM. Windows NT used a different calculation here.
http://support.bicestercomputers.co.uk/attachment.php?attachmentid=134&stc=1&d=1236533643
You can write your settings in the initial and maximum boxes, and then click Set. You'll have to reboot in order for the changes to take place. Note that you have to specify the *same* amount for both values. This will keep your Pagefile from resizing, fragmenting and eventually slowing itself down.
You can also divide the Pagefile between your physical disks (not partitions!) to speed up its performance. Select the required disk from the Drive list, write the sizes in the initial and maximum boxes, and then click Set. Repeat this for all the required drives.
In Windows XP go to My Computer, right click it and then choose Properties, go to the Advanced tab, click Performance Options, then click Settings.
http://support.bicestercomputers.co.uk/attachment.php?attachmentid=135&stc=1&d=1236533799
Again click the Advanced tab and then in the Virtual Memory section click Change.
http://support.bicestercomputers.co.uk/attachment.php?attachmentid=136&stc=1&d=1236533799
Now you can view and set the parameters you need.
http://support.bicestercomputers.co.uk/attachment.php?attachmentid=137&stc=1&d=1236533799
Under Drive [Volume Label], click the drive that contains the paging file you want to change.
Under Paging file size for selected drive, click Custom size, type a new paging file size in megabytes (MB) in the Initial size (MB) or Maximum size (MB) box, and then click Set.
If you decrease the size of either the initial or maximum paging file settings, you must restart your computer to see the effects of those changes. When you increase the paging file size, you typically do not need to restart your computer.
How much Pagefile does your system use?
Find Pagefile size using Task Manager in Windows:
A quick way to find out is by using Task Manager:
Open Task Manager and go to the Performance Tab.
http://support.bicestercomputers.co.uk/attachment.php?attachmentid=138&stc=1&d=1236534095
Notice the Physical Memory section. Look at the Total figures: 785904 K (that's the amount of installed RAM).
How much RAM is available? 372924 K – more than half of the installed RAM. You're doing ok for now.
How much memory is your system committed to? Look at the Commit Charge section, at the Total figures: 429604 K.
What was the largest amount of memory your system has ever committed itself to since the last boot? Look at the Peak figures: 453168 K. This means that you're running close to your peak, and although your system has peaked to around 450000 K, it's still far from using up its RAM. You're ok for now.
Bill James MS MVP has a convenient tool, ‘WinXP-2K_Pagefile’, for monitoring the actual usage of the Page file, which can be downloaded here (http://billsway.com/notes_public/WinXP_Tweaks). A compiled Visual Basic version is available from Doug Knox's site (http://www.dougknox.com/xp/utils/xp_pagefilemon.htm) which may be more convenient for some users. The value seen for ‘Peak Usage’ over several days makes a good guide for setting the Initial size economically. If the above mentioned files are not any more to be downloaded from the developers sites please check the existing attachments of this post.
Now, since our system automatically sets its initial Pagefile size to 1.5 times the amount of RAM, you're using 1152 MB or hard disk space on a Pagefile that's not even used (Remember? You're not even close to using ALL you RAM…) Seems like a lot of space to waste. You can safely lower the Pagefile size to around 700 MB, and you can safely assume you'll never even touch it. The only drawback it losing the ability to create a dump file in case your system BSODs on you…
I've taken another snapshot, this time of a Windows XP computer:
http://support.bicestercomputers.co.uk/attachment.php?attachmentid=139&stc=1&d=1236534291
Here the Peak was 758064 K, which is ALMOST all the RAM you have. You cannot tell if this was a one-time surge, or something you should expect all the time (here you do need a baseline to tell). You can only say that right now you're safe because you're only using 192992 K or memory out of 785904 K you have. But if you do see that the peak is something that always happens to you, you should set your Pagefile to the minimum of 1.5 times the RAM (which is in fact the default setting).
By the way, you can also see the current amount of memory used by looking at the lower right corner of Task Manager, where it says Commit Charge: 188M / 1426M.
This next snapshot is of a Windows Server 2003 which is having big problems.
http://support.bicestercomputers.co.uk/attachment.php?attachmentid=140&stc=1&d=1236534283
Had this been your computer, then you could have had problems on your system. Here you're using 530MB out of 934MB of memory you have (made of RAM + Pagefile). This means your system is relying on the Pagefile to operate. Here you must add more RAM ASAP, or at least configure the Pagefile for optimum use.
Looking for more optimization tools or hints? Click here