When a hard page fault occurs, the virtual memory manager has, in essence, stolen some RAM;
that is, it has trimmed the working set of another process to fulfill the currently running
process's request. Occasionally, paging that results from hard page faults is acceptable, but if
this type of paging occurs excessively over a period of time, system resources become unbalanced and
a memory bottleneck forms.
To determine whether your system is paging, use Perfmon to observe the relationship of the
metrics shown in Table 1. One strong indicator of a memory bottleneck is that the Pages/sec counter
is high (greater than 50) and growing compared with your baseline. NT Server sets aside a minimum
amount of RAM for kernel resources that are never paged to disk; the average NT Server will not let
its last 4MB of RAM be paged (similar to the SVR4 UNIX minfree/lotsfree memory thresholds). If
the Available bytes counter is also decreasing to the minimum NT Server goal of 4MB and the disk
drives that house the Pagefile.sys files are busy (marked by an increase in %Disk Time, Disk
bytes/sec, and increased Average Disk Queue Length), you have undoubtedly identified a memory
bottleneck.
Maximize Throughput for Network Applications. The second option for tuning NT
Server's memory strategy is Maximize Throughput for Network Applications. When you select this
option, NT Server allocates less RAM for the file system cache so that running applications can have
access to more RAM. With this option, you get into applications tuning. When you configure
applications such as SQL Server or Microsoft Exchange, you can tune them to use specified amounts of
RAM for areas such as buffers for disk I/O and database cache.
Knowing what is running on your system is particularly important here: If you allocate too much
memory for each application in a multi-application environment, excessive paging can turn into
thrashing, and you will have one slow system. Thrashing is the state when all active
processes and file system cache requests become so great that they overwhelm the system's RAM. When
this condition occurs, requests for RAM create hard page faults at an astounding rate, and the
virtual memory manager begins stealing pages from one process just to fulfill the request of another
process. On a busy system, the increased workload of the virtual memory manager consumes more disk
resources as the use of the Pagefile.sys increase. The server then wastes CPU cycles on memory
management functions instead of servicing productive processes. Thrashing can quickly consume an
inordinate amount of system resources and typically increases users' response times considerably.
You can accept some paging or even continuous paging if the response times to the end user are
reasonable. You can use tools such as third-party remote terminal emulation and remote workstation
emulation from third-party companies to test system loading in conditions that emulate your
environment. This testing provides informative measurements in areas such as user response times and
overall system throughput.
Additional Memory Tuning
You can improve the system's memory/paging performance when loads are heavy by spreading the
paging file across two disks. This modification improves the overall paging file read/write
rates, because more disks are available to process the paging file workload.
During installation, NT Server creates one Pagefile.sys file on the root (C) drive. To spread
the load, review the disk metrics you have gathered with Perfmon and select two disks that are under
the lightest load. Then, as Screen 5 shows, from Control Panel, System, Performance, select Virtual
Memory and create two new paging files, one on each disk. After the new paging file systems are in
place, remove the default Pagefile.sys on the root disk.
As a guide to determining the Pagefile.sys sizes on the new disks, use Perfmon to monitor the
%usage and % peak usage counters of Paging file. Usually you will create
pagefiles that are the same size on both disks, with initial sizes of at least the value shown for
%usage and a maximum of at least the value for % peak usage.
Sizing the Pagefile.sys correctly ensures that NT Server does not waste cycles creating larger
Pagefile.sys files. If possible, dedicate two disk drives to the task of containing the paging file
systems. This approach guarantees that no other application or process will contend with NT Server
when the system needs the paging file system.
If the system begins to page to an unacceptable degree, use Perfmon and Task Manager to isolate
the applications or processes that are draining excessive memory and tune down the memory allocated
to them (if possible). If the application source code is available, you can work with the developers
to improve overall memory performance. When all tuning efforts fail to improve user response times
as a result of lack of memory, place more memory into the system or distribute memory-intensive
applications to the appropriate number of additional servers.
Knowledge Is Power
When you know which processes are running, what the processes do, and how to reallocate memory
to fit your needs, you're getting the most out of your computing power. Next month, I discuss tuning
the other components of NT Server: disk I/O, network I/O, and CPU.