|
As
Bert Smith explains, when it comes to
the Windows
XP pagefile,
it's not size that matters but what you do with it.
The
Windows pagefile, pagefile.sys, is absolutely crucial to Windows'
operation. It temporarily holds data that would otherwise be held in
memory in order to free RAM up for other applications. Pagefile.sys
is created when Windows XP is installed and is stored by default in
the root of the partition containing the operating system. Without
pagefile.sys, some software won't run, hardware can malfunction and
"out of memory" errors can appear on boot up.
If
it's too small, the problems mentioned above can occur and XP's
performance can become lethargic due to significant disk activity
(thrashing). If pagefile.sys is too large, it wastes disk space and
can cause file fragmentation.
Using
the NTFS file system, full control must be given to the system for
the root directory where pagefile.sys is located. If you don't, the
"unable to create a pagefile" message appears on boot up.
The
first step towards optimising your pagefile is to figure out how much
space it should occupy. There is vigorous debate about the size,
placement and the necessity of a pagefile. However, one size doesn't
fit all in this situation.
Log
on to your computer, making sure you have
‘administrator’,
and follow these steps to find the locations and sizes of your
pagefiles.
Go
to Control
Panel
> System ,
click on the Advanced
tab and under Performance,
click Settings.
On the Advanced
tab under Virtual
memory,
click Change
in Performance Options.
The Virtual Memory
dialog box opens with the details of the pagefiles on your system and
their locations. This is also the place to make changes to your
pagefile settings if you want to resize or move them to another disk.
OPTIMUM
SIZE
Opinions
differ widely for the pagefile size. Microsoft suggests that the
recommended minimum size of your pagefile should equal about one and
a half times the amount of your physical RAM
(http://support.microsoft.com/default.aspx?scid=kb;en-us;308417).
It also recommends that a maximum size is about four and a
half
times the quantity of the physical RAM you have installed. A system
with 512MB of RAM would therefore be around 768MB, with a maximum of
2,048MB. The default size of the virtual memory paging file Windows
creates during installation is one and a half times
the amount of RAM
on your computer.
Obviously,
a larger pagefile is required for the optimum performance of a system
that has plenty of RAM, but this is a contentious issue. In his
account of virtual memory, Microsoft MVP Alex Nichol states that the
file should be around two and a half times the amount of RAM you
have
installed (www.aumha.org/wins/a/xpvm.htm).
But what about those with large amounts of RAM
(1GB and
above)?
Few applications call for 1GB of RAM, so surely a machine with a huge
store of RAM can get away with a tiny pagefile (or none at all)?
Afraid not! Some applications refuse to launch if there's no pagefile
present on the disk.
Some
experts recommend setting the pagefile to be dynamically sized, but
this can slow the disk system down and lead to extra file
fragmentation. Others recommend setting the maximum and
minimum sizes
to the same number, so Windows is locked into using a pagefile of a
specific size. Unfortunately, Microsoft has suggested that this
hampers rather than improves performance
(www.microsoft.com/WindowsXP/expertzone/columns/mcfedries/03junel6.asp).
TASK
MANAGER
The
best way to choose your pagefile size is by doing a little digging.
XP's Task Manager
is useful for finding the optimum size for your pagefiles. To do
this, load up the applications you usually have running at any one
time, adding one or two more for good measure. Right-click the Task
Bar, select Task
Manager and then choose
the Performance
tab. There are four number boxes at the bottom of the window,
labelled Totals,
Physical
Memory,
Commit
Charge
and Kernel Memory.
Keeping the Commit
Charge
peak well below the value of the installed RAM reduces the need for
the pagefile and makes additional RAM available for the system cache.
<Keep
an eye on the difference between the Commit
Charge and Physical
Memory totals. This
should be as large
as possible. This box also displays the amount of pagefile usage. If
this is a single, flat line, then the system is accessing the
pagefile minimally and your system is fine as it is. A deeper, more
thorough test involves building your own pagefile monitor.
CUSTOM
CONSOLE
It's
easy to create a
custom pagefile monitor that can run over several days to log data,
enabling you to optimise your pagefile. There's also a free Visual
Basic program available from Microsoft MVP Doug Knox's Web site,
www.dougknox.com/xp/utils/xp_pagefilemon.htm.
To
build your own, follow
these basic steps. Click on the Start
menu and open the Run
box. Type
mmc into
the box and click OK. From the MMC console, click File
> Add/Remove Snap-In > Add and
the ActiveX
Wizard will
open. Select ActiveX
Component
> Add >
Next and set the
Control category drop
down
menu to
All
Categories. Under Control
Type,
select System Monitor
Control
> Next.
At this point you'll be prompted to name your monitor: "Pagefile Monitor"
is a sensible
choice. After you've named
it, click Finish
> Close
> OK.
Now
you have a snap-in
which you can add counters to and monitor. In the right-hand pane of
the console, click the +
sign in the top
row to open the Add
Counters
dialog box.
From here, choose Select
counters
from
computer. Under the Performance
object heading, select all counters and select instances from the
list. Click Add
> Close.
This is all
you need to do to create the monitor. From here you can drag a
shortcut of the snap-in to the desktop to launch the monitor.
Before
using it, fire up
the apps you usually run, plus one or two that you only use
occasionally. To log the data your Paging
File
Monitor collects, right-click the top bar on the
right-hand
page, select Properties,
choose Source
and check the Log files radio button. Text file comma delimited (csv)
is a convenient file type. Ensure the log has started before
continuing.
After
a few days, open
the log file with Notepad or Excel. Look for the highest value shown
on the far right of each log, and round it up to the nearest whole
number. Get the average for all the logs — they're in
percentages.
To
obtain a suggested
initial page size value, divide your average by 100 and multiply it
by the size of your current pagefile in megabytes. To be on the safe
side, and to prevent running out of virtual memory, add approximately
40% to the value of your calculated figure to work out the ideal
pagefile size.
 |
| Power
tools: If
you scratch
Windows'
surface,
secret utilities like MMC snap-ins enable you to construct useful tools.
|
PLACING
THE
PAGEFILE
Consider
whether you want
a small kernel or complete memory dump formed in the event of a
system crash. If you do, a pagefile must be created on the partition
where Windows XP is installed. A pagefile of fixed size is useful for
this purpose. Using the utility dmpchk.exe from the XP installation
disc, analysis of memory.dmp can reveal the system state at the time
of the crash. However, the results can be difficult to interpret and
don't reveal the events leading up to the time of the crash.
Splitting
a pagefile
among multiple physical hard drives improves performance.
But don't
split it on multiple partitions on the same physical h
ard drive where
Windows is installed. Windows
uses a pagefile more aggressively if it's not located on the
same physical hard drive as the XP
installation. If you do this, make sure that thesecond
hard drive is at
least equal in performance. If you have only one hard drive,
place
the pagefile on the partition where Windows is installed. For the
maximum size of your pagefile, try twice the initial size and monitor
its performance for a week or so using your custom Pagefile Monitor.
Try to keep the peak usage under 80%. This leaves a suitable safety
margin for periods of unusually heavy use. A bit of experimentation
is well worth the time and trouble.
DEFRAGGING
PAGEFILES
XP's
built-in disk
defragmenter is a cut-down version of Executive Software's Diskeeper
and has some severe limitations — for one, it can't even
defrag
a pagefile. A small performance gain can be obtained if the pagefile
is defragmented, so having a dedicated drive/partition for the
pagefile is attractive.
Some
commercial
applications, like Defrag for Windows, can defrag the pagefile, but
make sure you back it up before doing so. A fragmented pagefile
substantially hampers performance, so it's a good idea to defrag them
at least once a month. While paying special attention to your
pagefile isn't the be-all and end-all of memory tweaking, sensible
and considered settings will ensure your machine can run at full tilt
when the going gets tough.
|