Question about pagefile....
Posted 08 January 2006 - 10:59 PM
Posted 09 January 2006 - 12:12 AM
A program instruction on an Intel 386 or later CPU can address up to 4GB of memory, using its full 32 bits. This is normally far more than the RAM of the machine, so the hardware provides for programs to operate in terms of as much as they wish of this full 4GB space as Virtual Memory, those parts of the program and data which are currently active being loaded into Physical Random Access Memory (RAM). The processor itself then translates (‘maps’) the virtual addresses from an instruction into the correct physical equivalents, doing this on the fly as the instruction is executed. The processor manages the mapping in terms of pages of 4 Kilobytes each - a size that has implications for managing virtual memory by the system.
Why do I need page file optimization?
Optimizing your page file when you're running low on RAM is always a good idea.
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.
Can the Virtual Memory be turned off on a really large machine?
Strictly speaking Virtual Memory is always in operation and cannot be ‘turned off’. What is meant by such wording is ‘set the system to use no page file space at all’.
This would waste a lot of the RAM. The reason is that when programs ask for an allocation of Virtual memory space, they may ask for a great deal more than they ever actually bring into use - the total may easily run to hundreds of megabytes. These addresses have to be assigned to somewhere by the system. If there is a page file available, the system can assign them to it - if there is not, they have to be assigned to RAM, locking it out from any actual use.
Here are some basic rules you should follow:
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.
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 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.
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:
Windows 2000 and XP 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.
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.
Again click the Advanced tab and then in the Virtual Memory section click Change.
Now you can view and set the parameters you need.
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 big should my Pagefile be?
To have Windows choose the best paging file size, click System managed size. The recommended minimum size is equivalent to 1.5 times the amount of RAM on your system, and 3 times that figure for the maximum size. Example, if you have 256 MB of RAM, the minimum size would be 384, the maximum size would be 1152.
For best performance, do not set the initial size to less than the minimum recommended size under Total paging file size for all drives. The recommended size is equivalent to 1.5 times the amount of RAM on your system. Usually, you should leave the paging file at its recommended size, although you might increase its size if you routinely use programs that require a lot of memory.
To delete a paging file, set both initial size and maximum size to zero, or click No paging file. Microsoft strongly recommends that you do not disable or delete the paging file.
To determine your preferred pagefile size you should monitor your system and see how much RAM and virtual memory it uses. Do a baseline monitoring for a week or so (you can skip the baseline or shorten its duration if you know exactly how much pagefile you need) and see what was the largest amount of memory your system ever used. If you see it never gets close to the maximum amount of RAM you have installed – don't worry. Your pagefile is virtually left untouched (not exactly correct, because the system uses the pagefile for some internal operations and it should keep it at around 5%-10% usage on normal systems). If, on the other hand, you see your system uses more memory than it physically has, this means it uses some pagefile.
How much pagefile does your system use?
You should first find out how much memory you're using, and how much of it is on your disk.
Using System Monitor
One accurate way is by monitoring the %Usage Peak counter in the System Monitor tool (The peak usage of the pagefile instance in percent):
Open Performance console from the Administrative Tools. Click System Monitor and then point at the PLUS (+) sign.
In the Add Counters dialog box open the Performance Objects drop-down list. Look for the Paging File object.
When you click that object select the %Usage counter and click Add.
Look at the graph. Notice if it's steady or increasing in size (you might want to capture this data over a longer period of time - a week or more - by using the System Logs in the Performance Logs and Alerts sub-menu of the Performance console). Notice the Average counter.
Using Task Manager
Another (faster) way to find out is by using Task Manager:
Open Task Manager and go to the Performance Tab.
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.
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…
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.
Even when you set the values properly, some systems don't retain your settings. If this happens, perform the following steps:
Start regedt32.exe (not regedit.exe)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ControlSession Manager\Memory Management
Double-click PagingFiles. The entry will appear as
D:\pagefile.sys 700 700
The first value is the location; the second is the minimum size; and the third is the maximum size.
Ensure the values are correct and click OK.
Reboot the machine.
Remotely changing pagefile size and location:
You can also change the value of the pagefile remotely by manipulating registry values.
pagefile information is stored in the registry as a multi_string (so you HAVE to use regedt32.exe) and can be changed locally as follows:
Start the registry editor (regedt32.exe)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
Double click PagingFiles
There is one line for each pagefile, the format is:
<location> <initial size> <maximum size>
(e.g. C:\pagefile.sys 700 700)
Close the registry editor
Reboot the machine
To change on another machine you should use the resource kit REG.EXE utility but the command below will replace the current pagefile and will NOT check you have enough disk space so you may want to create a script that does check. Make sure the machine is rebooted after the change.
C:\> reg update "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PagingFiles"="<location> <initial size> <max size>" \\<remote machine>
C:\> reg update "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PagingFiles"="C:\pagefile.sys 700 700" \\london.nwtraders.msft
Make sure you test this before trying to use on live machines.
Problems with Virtual Memory
It may sometimes happen that the system give ‘out of memory’ messages on trying to load a program, or give a message about Virtual memory space being low. Possible causes of this are:
The setting for maximum size of the page file is too low, or there is not enough disk space free to expand it to that size.
The page file has become corrupt, possibly at a bad shut-down. In the Virtual memory settings, set to have no page file, exit, shut down the machine and reboot. Delete PAGEFILE.SYS (on each drive if more than just C:), set the page file up again and reboot to bring it into use.
The page file has been put on a different drive without leaving a minimal amount on C:.
There is trouble with third party software. In particular, if the message happens at shutdown, suspect a problem with Symantec's Norton Live update.
If it happens at boot and the machine has an Intel chipset, the message may be caused by an early version (before version 2.1) of Intel's ‘Application Accelerator’. Uninstall this and then get an up-to-date version from Intel's site.
Possibly there is trouble with the drivers for IDE hard disks; in Device Manager, remove the IDE ATA/ATAPI controllers (main controller) and reboot for Plug and Play to start over.
With an NTFS file system, the permissions for the root directory of the drive where the page file is must give ‘Full Control’ to SYSTEM. If not, there is likely to be a message at boot that the system is ‘unable to create a page file’.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users