Michael Stephenson and the Windows NT Server Performance Team
Microsoft Corporation
March 9, 1998
This document provides some general guidelines on how to optimize an Internet Information Server (IIS) 4.0 installation in a high-volume environment. It is designed for Web server system administrators who are familiar with administering Microsoft® Windows® NT and Microsoft IIS. Because every Web site is unique, Microsoft recommends that customers carefully plan, test, and monitor their Web sites, using both the tools in Windows NT Server and the various benchmarking suites available on the market today. This will ensure that content deployed on an IIS 4.0 Web site is optimized for the intended use.
Parameter | Settings | Impact |
---|---|---|
General Tuning Parameters | ||
Set Windows NT Server to AppServer. |
On the desktop, right-click Network Neighborhood and
select Properties.
On the Services tab, double-click the Server service. Make sure that Network Applications is selected. |
IIS 4.0 has grown in size, and page faults more under the File Server setting. The AppServer setting instructs Windows NT to trim the file cache more aggressively. |
Install the hotfix and remove irrelevant script mappings. |
Download and run the hotfix utility from the ftp site download
. You will need to choose the appropriate platform
(Intel or Alpha).
Using the Microsoft Management Console, navigate to the Web sites (virtual servers) under the IIS snap-in. Right-click Default Web Site, and/or any other Web site(s) where your content exists and select properties. Select the Home Directory property sheet. Click the Configuration button under the Application Settings section. Remove all unused mappings, leaving at least one mapping in place (the server requires at least one mapping). Microsoft recommends leaving the .asp extension in place if no other mappings are being used. |
To make it easier for customers to upgrade to IIS 4.0, IIS 4.0 checks the extension of each file, even in a read-only directory (a directory that has scripting disabled). This additional overhead can be eliminated. By design, the server requires at least one script mapping, so leave the ASP mapping in place. |
For high-volume sites or benchmark testing, set the Performance bar to More than 100,000. |
Using the Microsoft Management Console, navigate to the
Web sites (virtual servers) under the IIS snap-in.
Right-click Default Web Site, and/or any other Web site(s) where your content exists and select Properties. Select the Performance property sheet. Move the slider bar all the way to the right to More than 100,000. |
This controls the amount of resources available to IIS.
Because IIS expects heavy usage, which is common with
most benchmarks, IIS will keep additional resources
around even if they are not in use.
Note: Use this setting only for high-volume sites. For low-volume sites, this should be minimized. |
Disable performance boost for foreground applications. |
Open the Control Panel.
Double-click the System icon, and select the Performance property sheet. Move the Application Performance slider to None. |
Because high-volume sites are usually built on dedicated Web servers, it's important to give the Web server the maximum amount of system resources. This setting maximizes the number of CPU cycles available to the Web server process. |
Logging Tuning Parameters | ||
Disable logging when not needed. |
Using the Microsoft Management Console, navigate to the
Web sites (virtual servers) under the IIS snap-in.
Right-click Default Web Site, and/or any other Web site(s) where your content exists and select Properties. From the Web Site property page, uncheck Enable Logging to disable logging. Click OK. |
This frees up system resources and provides better performance. |
If logging is enabled, log to a striped partition with a controller that allows write-back caching, especially if you see heavy use on the log disk. |
Using the Microsoft Management Console, navigate to the
Web sites (virtual servers) under the IIS snap-in.
Right-click Default Web Site, and/or any other Web site(s) where your content exists and select Properties. Select the Web Site property sheet. Click the Properties button under the logging section. Make sure the path maps to a striped partition. |
Busy sites can see the log disk become a bottleneck, because it is a point of contention. This means that all requests on the server will be contending for a single file. |
Network Tuning Parameters | ||
Set receive buffers for the Network Interface Card (NIC) to maximum. If this is in a controlled environment or for a benchmark test, set it on both the client and server. | See the documentation for your NIC for details. This parameter can often be set using the properties of the NIC under the Network Control Panel. | Dropped packets on the receiving end cause TCP to retransmit. This minimizes the number of dropped packets on the receiving end, thus increasing performance. |
Set TCP parameters in registry. |
Using Regedt32, navigate to HKLM\
CurrentControlSet\ Services\ TCPIP Parameters. Add the value MaxUserPort if it's not already there, and set to 0xfffe. Add the value TcpWindowSize if it's not already there, and set to 0x4470. |
We don't want to run out of user ports. Also, a large window size works better for high-speed networks (TCP stops when the window fills up). |
SMP Tuning Parameters | ||
Control number of active IIS threads. |
Monitor the Processor Queue Depth object under System
in Windows NT Performance Monitor to see if you have
too many threads active.
If you have N processors in your system, a queue depth between N and 3N is good. Leave values at the default if you are not sure. For static workloads, you can set MaxPoolThreads to 1 and PoolThreadLimit to the number of processors in your system. (These values are set in the Windows NT Registry using regedt32.exe. See the following sections for details on setting these parameters.) |
There should be enough threads in the system that incoming requests don't get blocked. However, each thread uses system resources and can potentially cause unnecessary context switches. The goal is to maximize the number of threads IIS uses without causing excess context switches. Doing so will ensure better performance on Symmetric Multiprocessing (SMP) hardware. |
Optimizing for Static Workloads | ||
Set Object Cache Time to Live (TTL) appropriately.
Default: 30 Seconds |
Using Regedt32, navigate to HKEY_LOCAL_MACHINE\
System\ CurrentControlSet\ Services\ InetInfo\ Parameters. Add the value ObjectCacheTTL if it's not already there. Set to the desired value. If you do not know how long you want IIS to keep an unused file open, leave ObjectCacheTTL at its default value. |
This changes the frequency with which the cache
scavenger runs. If your content fits in memory and is
largely static, you may even disable the scavenger by
setting it to 0xffffffff.
A high ObjectCacheTTL works best for sites with a small number of "popular" files. If the number of frequently requested files is large, a high ObjectCacheTTL may not help. Setting this entry high tells IIS to try to keep unused files open longer. This is useful if you expect these files to be reused within the TTL period. If you do not expect the files to be reused often, or the system appears low on resources, use a lower ObjectCacheTTL to conserve resources. You can also use OpenFilesInCache to limit the number of files IIS will keep open. |
Set OpenFileInCache to a value large enough to
cache all the open handles.
Default: 1000 for every 32MB of physical memory |
Using Regedt32, navigate to HKEY_LOCAL_MACHINE\
System\ CurrentControlSet\ Services\ InetInfo\ Parameters. Add the value OpenFileInCache if it's not already there. Set to desired value. The value will depend on the amount of memory you want to make available for IIS' cache, and the number of file handles you want cached. |
Large Web sites will need to keep more file handles open for maximum performance. If the content on your site is static, you can greatly increase the performance of your Web server by maximizing the number of files served from RAM instead of from disk. You can monitor the number of cached file handles using the Cached File Handles counter under Internet Information Service Global in the Windows NT Performance Monitor. |
Optimizing Active Server Pages (ASP) Performance | ||
Set ProcessorThreadMax to a low value. |
Using Regedt32, navigate to HKEY_LOCAL_MACHINE\
SYSTEM\ CurrentControlSet\ Services\ W3SVC\ ASP\ Parameters. Add the value ProcessorThreadMax if it's not already there. Decrease the value and monitor performance. If performance decreases, revert to the previous value. |
This changes the number of threads per CPU that IIS allocates for MTS. For well-written scripts, low numbers are better. This lowers the amount of contention. |
Set the AspScriptEngineCacheMax property to
ProcessorThreadMax, multiplied by the number of
processors in the system.
Default: 30 |
Configuration information related to Web sites,
directories, and pages is stored in the IIS
configuration data store (metabase).
IIS 4.0 includes a number of scripts that let you change settings in the metabase.
From the SystemRoot, navigate to /System32/
Type adsutil.vbs. Set /w3svc/
|
This allows each ASP thread to cache a script engine, which results in processing ASP pages more efficiently. |
Enable buffering for ASP applications. |
Using the Microsoft Management Console, navigate to the
Web sites or ASP application name spaces under the IIS
snap-in.
Right-click the site or application and select Properties. Select the Home/Virtual Directory property sheet. Click the Configuration button under the Application Settings section. Click the App Options property sheet. Click on the Enable Buffering option. Click OK, then click OK again. |
Setting this option buffers ASP output to the browser. This allows the server to deliver the entire response to the client as opposed to delivering the content as the server generates it. |
Minimize the Session Timeout value. |
Using the Microsoft Management Console, navigate to the
Web sites (virtual servers) under the IIS snap-in.
Right-click Default Web Site, and/or any other Web site(s) where your content exists and select Properties. Select the Home Directory property sheet. Click the Configuration button under the Application Settings section. Click on the App Options property sheet. Set Session Timeout to the minimum amount of time you need to maintain a user's session state. |
Maintaining session using the Session object in ASP requires system resources. Imagine that there are 1,000 users connected at any given time. This means that the server needs to allocate resources to maintain the session state for each user. The longer the server needs to maintain the session state, the longer the resources are tied up. Therefore, minimizing the Session Timeout value optimizes the server's resources and improves performance. |