Microsoft

Get IT Done: Tweak Windows 2000's memory subsystem for improved performance

Add RAM, optimize the paging file, and clean up startup from the registry to improve Windows 2000 performance.


There are many ways to tweak Windows 2000’s performance with no loss in required functionality. Unfortunately, it’s often hard to tell which tweaks will boost performance and which ones will crash your system.

I’ll try to clear up some common misconceptions about different techniques for squeezing the most performance out of a desktop system running Windows 2000. I’ll go over some hardware and software options for making this happen. If any of my suggestions could cause problems, I’ll make you aware of it, and you can determine whether or not the tweak is worth the risk.

Common—and generally safe—options
There are a few very quick and easy ways to increase the performance of a Windows 2000 system. What works very well for one user may not work at all for another, however.

Add RAM
This is almost always safe, and almost always results in increased system performance, albeit only up to a certain point. This is probably self-explanatory. The end result of adding RAM to a system is that the paging file won’t be used as much, which directly improves performance on systems where paging file usage is moderate to high.

Adding RAM
Adding RAM is one of the easiest ways to boost system performance, but the law of diminishing returns applies—the more RAM that you add, the less the performance improvement will be over small increments. Consider that, eventually, adding more RAM will simply result in a plateau on a system performance graph.

The paging file: Size and location DO matter
The paging file has been around since the inception of Windows. It’s the mechanism by which a computer is able to make use of disk space to temporarily displace the contents of the RAM in order to make room for something else. This displacement, called “swapping,” occurs when more information needs to be added to RAM because there is no room available. This is a normal process for the operating system, but in situations where you’re simply trying to do too much, the system has to constantly swap information back and forth between the disk and RAM. This condition is called “thrashing.” When that happens, it’s time to add more RAM.

There are some things that you can do to make the paging system more efficient even when it’s working as intended.

First, make sure that the file resides on the fastest disk or array in your system. Since RAM is faster than disk access, using the fastest disk helps make the swapping process more efficient.

Second, placing the paging file on a disk separate from the operating system tends to improve performance. Access to OS files is fairly regular, as is access to the paging file. Therefore, being able to access both sets of information at the same time is helpful.

Third, if your system has an array of SCSI disks in with striping enabled, it’s better to allow the paging file to be striped across multiple disks. In this way, the paging file can be updated in chunks and simultaneously on multiple disks, making the process faster.

Monitoring the performance of the paging file
It’s also important to make sure that you’ve correctly established the size of the paging file. By default, Windows 2000 uses a paging file that is 1.5 times the amount of RAM in the system. Like any default, this setting was made with certain uses in mind and can be changed to meet your needs. Locate the paging file settings by right-clicking My Computer, choosing Properties, and clicking the Performance Options button on the Advanced tab.

To use a performance counter that measures the maximum usage of the paging file, add a counter to the chart from the paging group called % Usage Peak and use the _Total instance from that counter, as shown in Figure A.

Figure A
Adding the paging file counter to monitor performance.


If you’d prefer to capture the counter information in a log file that you can examine later, right-click Counter Logs under Performance Logs and Alerts. Name the logging session, and add the appropriate counter to the list. Click Apply, and then close the window. On the Windows 2000 lab server that I used for this article, the highest value that I got in my example was 78.9 percent. This means that I was using 78.9 percent of my total paging file.

Calculating appropriate values for the initial size of the paging file is not an exact science, and it will vary with the system’s intended use. One formula that I’ve used is that the initial size should be the amount of RAM in your system and the maximum size 2.5 times that amount. For example, if your system has 256 MB of RAM, the initial paging file should be 256 MB, and the maximum would be set to 768 MB. If you need to adjust these numbers based on performance counter metrics, then do so.

And now for the good stuff
While adjusting the paging file and adding RAM are usually pretty safe tweaks, there are other memory tweaks that will result in increased system performance. Keep in mind that some of these tweaks can make things worse if they aren’t done correctly. Some of them involve modifying registry settings, which can cause the system to become unstable when they’re done incorrectly or carelessly. Thus, proceed with caution. It’s always wise to back up your system before changing anything in the registry.

Clean up the startup process
If you’ve used a Windows 2000 machine—Professional or Server—for any length of time, you may have experienced “startup hell,” as I like to call it. A good number of programs and utilities have a tendency to install small applications that start automatically at system boot. Some examples of these applications are the WinAmp agent and the FindFast utility, which comes with Microsoft Office. Many antivirus agents or desktop setting switching applications also start automatically at startup. While some of these programs are probably useful, others aren’t. All the nonessential programs are using up perfectly good RAM.

Unfortunately, cleaning out this stuff is not quite as simple as just cleaning out the contents of the startup folder on the Start menu. Cleaning out this menu is only the first step. Startup programs are also stored in many areas of the registry as well as in the WIN.INI [Load] and [Run] sections. The areas of the registry to check for startup programs are:
  • [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run]
  • [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce]
  • [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices]
  • [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce]
  • [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit]
  • [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce]
  • [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServices]
  • [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce]
  • [HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows]

Note
Not all of these registry keys will exist on every system. The “local machine” (or HKLM) registry keys refer to programs that are started every time the system is booted, while the “current user” (or HKCU) keys are loaded when a particular user logs on.

To remove a program that starts up at system boot or user logon, just right-click the particular key and choose Delete from the shortcut menu. Figure B shows a sample screen shot from a Windows 2000 Server’s [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run] registry key.

Figure B
A Windows 2000 Run registry key.


I recommend keeping a record of the items that you remove from any of these keys in the event that you mistakenly remove something that your system requires.

Other registry settings
In addition to removing extraneous startup items from the registry, there are other things you can do to squeeze the memory subsystem and make it more efficient.

The DisablePagingExecutive registry key is the first of two keys that I’ll mention in this article. By default, this key is set to 0 (off) in Windows 2000, which means that Executive Paging is enabled. Executive files are operating system, and some application, programs. Out of the box, these programs are paged out of system RAM, just like any other program. However, if you need the OS to be more responsive, you can change this registry value to 1, which will disable this feature and force these programs to stay in RAM rather than be paged. The result will be a more responsive system, assuming that you have adequate RAM to hold the OS in memory. The full key for this option is:
  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\ DisablePagingExecutive.

  • Potential problems with Citrix MetaFrame XP
    There have been a few recorded instances where this performance tweak has caused problems with Citrix MetaFrame XP. If you’re running MetaFrame XP on Windows 2000, and you’re having trouble with system hangs, check the value of this registry key to make sure that it is off.

    Changing the value of the LargeSystemCache key from 0 to 1 causes Windows 2000 to allocate all but 4 MB of system memory to the file system cache. Basically, this means that the kernel can run in memory, greatly improving its speed. The 4 MB of memory left is used for disk caching, but additional memory is automatically allocated if more is needed. Generally, this improves performance, but in some intensive applications it can have a negative impact on performance. The full location of this registry key is:
  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\ LargeSystemCache

  • Use available utilities
    There are easier ways to see what’s being loaded at system startup. Mike Lin’s Startup Control Panel utility is a must-have for any Windows administrator, and it works on most versions of Windows, including 2000 and XP. My Windows 2000 Servers are fairly optimized, and I’ve already cleaned out the startup registry keys, so showing you a screen shot from one of my servers would be uninformative. Instead, I’ve installed Startup Control Panel on my Windows XP desktop, which has quite a bit of stuff installed, just to give you an idea of what this utility can do (Figure C).

    Figure C
    Startup Control Panel showing the contents of the Run key under HKLM.


    Note
    Startup Control Panel is not necessary on Windows XP as the OS includes the “msconfig” command.

    Some common tips that don’t work
    As important as it is to introduce tweaks that improve system performance, it’s equally important to discuss some commonly suggested tips that don’t work or that are dangerous.

    Removing the OS/2 and POSIX subsystems
    Windows 2000 is POSIX compliant, which makes it suitable for use in a government installation, and it includes OS/2 compatibility in order to work with older applications for that operating system. All of the code is in the OS and ready for use, and it can be easily disabled. In relation to the memory subsystem, however, the system performance impact of removing or disabling these subsystems is zero. Each subsystem is called and loaded only when an application that requires the compatibility layer is started. This means that the code is not in RAM when there are no OS/2 or POSIX applications running and therefore having no impact on the system. At worst, the code for these compatibility layers uses up some disk space. As such, I don’t recommend removing them from the operating system, as disk space is relatively cheap.

    Tip
    If you do decide to remove these subsystems anyway, keep in mind that Windows 2000 includes Windows File Protection, which you’ll have to disable before you can properly remove the files that handle them.

    BIOS tweaks
    If you run other operating systems besides Windows 2000, you can make changes to the system BIOS that will improve system performance. With Windows 2000, many of these tweaks are useless as the BIOS is separated from the OS kernel via the hardware abstraction layer (HAL) and is not directly called after the initial phase of the bootstrap process. Consequently, these changes will do nothing to improve system performance but can, in some instances, destabilize the system.

    Wrap up
    This list is by no means complete, nor is it intended to be. Rather, it’s a list of suggestions that you can analyze to see if they are appropriate for your environment. Be careful with some of these tweaks as they can create problems. I always recommend a complete back up of the system if you aren’t sure about something. If you want to further improve system performance, consider getting rid of superfluous programs and services by carefully examining the services list to see what each one does.

     

    Editor's Picks