Controlling Memory Usage
Updated: August 22, 2005
Applies To: Windows Server 2003, Windows Server 2003 with SP1
With memory, more is almost always better. However, just adding more RAM to your server does not optimize performance. You must first determine whether you are making good use of the memory that the server has.
The biggest performance gains with IIS occur when you resolve issues related to insufficient memory. Before changing your hardware configuration, rule out memory problems. Monitor memory first to verify that your server has enough memory, and then move on to other parts of your server environment. Problems caused by memory shortages can often appear to be problems in other parts of the system.
Minimum Memory Requirements for IIS 6.0
To run IIS 6.0 with the Windows Server 2003 operating system, a dedicated Web server must have a minimum of 128 MB of RAM. However, your server might require more RAM to handle the resource needs of custom applications. If your custom applications require large amounts of memory, provide 256 MB or more of RAM. Additional memory is particularly beneficial for e-commerce sites, sites with a lot of content, and sites with a high volume of traffic.
Memory Management and Memory Allocation in Windows Server 2003
In order to use memory most efficiently, the Windows Server 2003 memory system is largely self-tuning. Similarly, IIS 6.0 regulates the size of the IIS object cache. Therefore, the primary purpose of monitoring memory on a Windows Server 2003–based server running IIS 6.0 is not to adjust the size of each memory component, but rather to make sure that the system as a whole has enough memory and is using it efficiently.
The largest chunk of activity in Windows Server 2003 is a process. The physical RAM available to a process is known as its working set. If the needs of a process exceed its working set — that is, if the process is not able to store all its code and frequently used data in RAM — some of the information is stored elsewhere, usually on disk as virtual memory.
Storing information on disk, instead of in memory, increases disk activity, which slows down the server. Some memory contains information that is frequently used, and sending that data to disk instead of retaining it in memory can degrade performance.
In addition, a section of system memory, known as pool memory, is reserved for use by the operating system. Pool memory is either paged or nonpaged. Nonpaged pool is the section of pool memory that is not pageable. Data in a nonpaged pool is always stored in physical memory and never saved to the disk. This section usually reserved for device drivers or other critical system components that cannot wait for memory to be paged. Paged pool is the section of pool memory that can be managed in the same way as other virtual memory - that is, it is pageable in the inactive memory can reside on the disk, and the current or active memory can reside in physical memory.
Within each process, Windows Server 2003 uses threads to accomplish particular tasks. The memory occupied by threads is part of the working set of the process, except for some special threads that run in nonpageable memory. Threads that service connections in IIS 6.0, for example, cannot be paged.
This section tells how to monitor various aspects of overall server memory — available memory, paging, use of the file system cache, the size of paging files, the IIS working set, and disk I/O — and, based on your observations, how to optimize memory usage.