About Memory Management

This topic describes factors affecting the amount of memory necessary to run Web or FTP sites efficiently and the counters you can use to evaluate their memory requirements. It includes the following sections:

RAM Usage

RAM is the memory space used by programs when they are running. Typically, when you start an application, the computer copies the necessary application files from the hard disk to RAM, and the application runs from RAM. RAM has much faster access time than the hard disk, so the less the computer accesses the hard disk, the faster applications can run. When IIS is running, it is using some portion of RAM, depending on a number of other factors, including:

When a request is received by IIS for a static file, a file handle is cached in RAM by IIS and the file is cached by Windows 2000. As subsequent requests are received for the same file, IIS uses the copy cached in RAM, rather than going back to the hard disk to retrieve the file again. This reduces the time IIS takes to fulfill a request and makes access faster for visitors. However, the amount of time a file is kept in cache is dependent on a number of other things.

As different files are requested from IIS, older cached files are purged to make room for the new files. This means that if you have a large number of files you are making available through IIS and you only have a small amount of RAM, access may be slowed because IIS must retrieve many files from the hard disk. If you are using other applications on the same computer that also use RAM, cached copies of files are pushed out of RAM to make room for the new files. IIS may be unable to maintain cached files in RAM. Again, the result is slower IIS access as files are brought from the hard disk.

ASP files are also cached in RAM and do not expire unless limits are placed on the number of files cached. For more information on setting limits on the number of ASP pages kept in cache, see Caching Applications.

Because large files take up more space in RAM than small files, requests for large files, such as audio or video files, may cause more turnover in cached files when the amount of available RAM is small. If the documents you are publishing are large, if you are publishing a large number of documents, or if you are running other RAM-intensive applications on the computer hosting IIS, you can improve system performance by adding RAM. However, if you have a very small number of files to publish and the files are relatively small in size, adding RAM does not improve computer performance.

You can also affect performance by adjusting the amount of memory that Windows 2000 allocates for file cache. If you are primarily using your server as a Web server, configure it as an application server, rather than the default setting of file server.

  1. On the desktop, open My Computer and select Network and Dial-up Connections.
  2. Right-click Local Area Connection and open its property sheet.
  3. Select File and Printer Sharing for Microsoft networks and select Properties.
  4. On the Server Optimization property sheet, select Maximize data throughput for network applications.

The counters listed below can be used to to view cache activity. When selecting the performance object, choose Internet Information Services Global.

The value of Cache Hits % should be as high as possible. A low value, particularly if it is accompanied by a high value of the % Disk Time counter of the Disk object, indicates that your server is not able to get enough of its files from cache. This is caused either by many different files being requested, or your cache is too small and needs to be enlarged. For more information about caching applications, see Configuring Applications.

Balancing Memory Use Against Response Speed

Generally, to increase request response speed you must dedicate memory or processor resources to individual connections, thereby reducing resources available for other applications during times when requests are not being received. Maximizing memory performance for all applications running on your server may mean slightly slower request responses for users visiting your site because memory and processor resources are not immediately available for the requests.

IIS asks you to set the estimated number of requests in a 24-hour period and then automatically adjusts to balance memory use against response time. When you change this estimate, IIS changes the number of sockets dedicated to listening for new requests. If the number is set just slightly higher than the actual number of connections, connection attempts are made faster. If the number is set much higher than the actual number of connection attempts, however, memory is wasted. For instructions on how to set the estimated number of connections, see Estimating Traffic.

In IIS 5.0, sites with different IP addresses but the same port number share the same set of sockets. Thus, creating multiple sites with different IP address but all using port 80 does not significantly increase the non-paged memory consumption of IIS. IIS uses these sockets flexibly among all of these sites, reducing its resource consumption. This socket pooling increases the ability of IIS 5.0 to host many more sites on the same hardware than was possible in IIS 4.0.

However, socket pooling causes IIS to listen on all IP addresses, which may present a possible security risk for secure domains with multiple networks. Also, both bandwidth throttling and performance adjustments will apply to all Web sites configured for the same port number. If you use bandwidth throttling or do other performance tuning on a per-site basis, you must disable socket pooling for the sites you want to throttle.

The default setting for IIS is to enable socket pooling, and in general this should not be modified. However, for sites that are mission critical and want their own dedicated socket pool, a metabase entry (MD_DISABLE_SOCKET_POOLING) can be set at /LM/W3SVC/X (where X is the number of the site) to revert back to the IIS 4.0 behavior. Socket pooling should be disabled at the site level only so that other non-critical sites can continue to take advantage of this new feature. This property can be set only by scripting and is not available in the IIS snap-in. For more information, see ADSI Changes for IIS 5.0.


© 1997-1999 Microsoft Corporation. All rights reserved.