[This is preliminary documentation and subject to change]
You can adjust both Internet Information Services (IIS) metabase properties and registry settings to tune the performance of your Web server. If you do plan to make changes to the registry, do not use a registry editor unless the editor is your only option. Registry editors bypass the standard safeguards provided by administrative tools. These safeguards prevent you from entering conflicting settings or settings that are likely to degrade performance or damage your system. Editing the registry directly can have serious, unexpected consequences that can prevent the system from starting and may require you to reinstall Windows. Exercise the same caution when making changes to the IIS metabase with the adsutil administrative utility (found in the Inetpub\AdminScripts directory). To configure or customize Windows and IIS, use the programs in Control Panel or Microsoft Management Console (MMC) whenever possible.
This list includes the most important metabase settings for tuning your Web servers. These settings can be retrieved and changed using the ADSI interfaces or by directly editing the metabase. Most of these settings will not take effect until the Web service is restarted. Click the metabase property to view the default value.
| Metabase Property | Description |
|---|---|
| AppAllowDebugging | This property specifies whether ASP debugging is enabled on the server. If this property is enabled, IIS application threads will be serialized, meaning that only one thread at a time will be allowed to execute for each application. Serialized threads adversely affect Web server performance. It is recommended that you set this property to FALSE on all production servers. |
| AspAllowSessionState | It is recommended that you set this property to FALSE for better performance. Once changed, developers will have to explicitly override this setting in pages that need to make use of the Session object. To change the default setting for a single page, developers can use <% @EnableSessionState=False %> at the top of the page. Be sure to notify developers if you change this setting. |
| AspBufferingOn | This property's default behavior allows all output from an application to be collected in the ASP output buffer before the buffer is flushed to the client browser. If this property is set to FALSE, output from ASP scripts will be written to the client browser as the client browser becomes available. It is recommended that you set this property to TRUE on all production Web servers. |
| AspQueueConnectionTestTime | This setting aids significantly in the performance of Web applications. If a request has been in the queue longer than the queue connection test time, the server checks to see that the client is still connected before beginning execution. This feature handles the problem of impatient users filling up the request queue with numerous attempts at the same page. The value should be small, for example three seconds. Base your decision to change this value on the type of Web application your server is running. Long-running ASP pages can also make use of the Response.IsClientConnected method to see if the client is still waiting for the rest of the page. Long-running pages should make judicious use of Response.Flush to ensure that users perceive that the page is still alive and doing productive work. |
| AspRequestQueueMax | The effectiveness of this setting depends on the behavior of the application. If the request's execution time is very short and the time in the queue will be short, it is reasonable to increase the limit of the default value. |
| AspScriptEngineCacheMax | Adjust the default value according to the type of content in
the application. (The default value does not include currently
running script engines.) If there are thousands of unique pages,
you may experience some gain associated with increasing the cache
size so that the most frequently requested pages can be readily
accessed. A hit in the script engine cache means that you can avoid
recompiling the template into byte code.
Before you set this metabase property, you should understand how ASP uses the ASP Script Engine Cache and the ASP Template Cache. For more information, see the Cache section. |
| AspScriptFileCacheSize | This property specifies the number of precompiled script files to store in the ASP Template Cache. If set to zero, no script files will be cached. If set at -1, all script files requested will be cached. Increase the default value if you have many different ASP pages. Do not set the value of this property to 0. A value of 0 turns off all ASP caching and severely impairs your server's performance. |
| AspSessionMax and | The default behavior is to limit the length of single sessions to a specified number of minutes rather than to limit the number of concurrent sessions. For applications that take advantage of sessions, it may be prudent to reduce the Session Timeout to reduce the overhead required of the server, but if concurrent sessions increase to unwieldy proportions, it may be necessary to include a Session Maximum. |
| AspThreadGateEnabled and | Thread gating is enabled when you set AspThreadGateEnabled to TRUE, and IIS dynamically changes the number of worker threads in response to changing workloads. The maximum number of worker threads that IIS will allow per ASP process is AspProcessorThreadMax multiplied by the number of processors on your server. Reduce this value and monitor performance. If performance degrades, bring the AspProcessorThreadMax value back up. |
| AspTrackThreadingModel | This property specifies whether IIS checks the threading model of any components that your application instantiates. If this metabase property is set to FALSE, the overhead incurred by ASP's threading model tracking is avoided, and you might see performance improvements in your ASP application. However, if this property is set to FALSE, any components that you create that you plan on giving application scope must be agile: either marked as Both-threaded and aggregate the free-threaded marshaller or marked as ThreadingModel=Neutral. If an application-scoped component is not agile, ASP will generate an error when you try to instantiate the component. In addition, if this property is FALSE, any objects that lack OnStartPage or OnEndPage methods and are instantiated in your ASP application will be released earlier than they would otherwise. This should improve your application's scalability. It is not recommended that you enable this property. |
| CacheISAPI | This property indicates whether ISAPI extensions are cached in
memory after use. If the value of this property is TRUE, the DLL
file will remain in the cache until the server is stopped. If the
value is FALSE, ISAPI extensions are unloaded from memory once the
extension DLL is no longer in use. ISAPI extensions are cached or
not cached based on the value of this property at the time they
were loaded into memory for use. Therefore, if this property is
changed after an extension has been loaded and cached, the change
will have no effect on that extension.
Setting this property to FALSE can be helpful for debugging, but it is recommended that you set this value to TRUE on all production Web servers. Reloading an ISAPI extension DLL file for every request will degrade performance. ASP.dll is itself an ISAPI extension, so disabling this property will also degrade ASP performance. |
| ConnectionTimeout | This property specifies the time in seconds the server will wait before disconnecting an inactive connection. Open connections can degrade performance, so consider lowering this value and monitoring your servers to see what impact this change makes. |
| MaxEndpointConnections | This property specifies the maximum number of "listen" sockets that will be aggregated on a network endpoint. For example, if this value is set to 15, a maximum of 15 total connections can be made to a single port, even if more than one domain is bound to the port. The lower of this property value and the value of the ServerListenBackLog property determines the number of sockets pooled on your server. Set this to a high number and monitor performance. |
| ServerListenBacklog | This property specifies the number of outstanding sockets that can be queued. Set this to a high number and monitor performance. The default value is based on the AcceptEx operating system parameter and on the server size specified in the ServerSize metabase property. |
| ServerSize | This property specifies the general size of the server, in terms of number of client requests processed per day. A value of 0 indicates a small Web site that would expect to receive fewer than 10,000 requests per day, a value of 1 indicates a medium site handling between 10,000 and 100,000 requests a day, and a value of 2 designates a large site processing more than 100,000 requests a day. To maximize the number of requests your server can handle, set this property to 2. You can adjust this setting using the IIS snap-in. Open your site's property sheet, select the Performance tab, and adjust the Performance tuning slider to More than 100,000. |
This section lists the registry settings that you should be most concerned with when you tune your Web server. Included is the registry path for settings that reside in the same location, along with the name, range, default value and a description of what each setting does. You will have to restart Web services on your server for new Inetinfo settings to go into effect. For more information on these registry settings, see the Global Registry Entries.
Registry Path:
HKEY_LOCAL_MACHINE \SYSTEM
\CurrentControlSet
\Services
\Inetinfo
\Parameters
DisableMemoryCache REG_DWORD
Range: 0, 1
Default: 0
Make sure that this parameter is set to 0 on all production servers. If this parameter is set to 1, static file caching will be disabled. While this may be useful during debugging, disabling caching can severely compromise production server performance. This parameter cannot be configured by using IIS snap-in.
MaxCachedFileSize REG_DWORD
Range: 0 - unlimited (measured in bytes)
Default: 262,144 bytes (256KB) if value is not in registry.
This parameter determines the maximum size of a file that can be placed in the cache. IIS will not cache files that are larger than MaxCachedFileSize bytes. If you are running large dedicated Web servers, you may want to add this value to the registry to increase the file size that the cache can hold.
MemCacheSize REG_DWORD
Range: 0 MB - Total MB of Available RAM
Default: 50% of available memory if value not in registry
This parameter specifies the maximum amount of memory that IIS will use for its file cache. If IIS does not need this much memory, it will be left for other applications to use. If this value is not in the registry, IIS will use no more than half of the available memory on the Web server (which is dynamically calculated every 60 seconds). If you are running large dedicated Web servers, you may want to add this value to the registry and increase the amount of memory that IIS can use. You must specify this size in MB when you add this object to the registry.
ObjectCacheTTL REG_DWORD
Range: 0 - Unlimited
Default: 30 seconds
This parameter controls the Time To Live (TTL) setting of the static file cache, which defines the length of time that objects, including files, are held in cache memory. If an object in the memory cache has not been referenced for the defined period, that object will be phased out of the cache. By default, this value is not included in the registry. If you wish to change it, you must add it manually. If system memory is limited, or the server's contents are dynamic, you can use a lower TTL to prevent system memory from being used to cache a large number of volatile objects. Setting the value to 0xFFFFFFFF disables the object-cache scavenger and allows cached objects to remain in the cache until they are overwritten. Disabling the cache scavenger is useful if your server has ample system memory and your data is relatively static. Other sites may prefer the compromise of raising this value to several minutes.
PoolThreadLimit REG_DWORD
Range: 0 - Unlimited
Default: 2 * # MB
This parameter specifies the maximum number of I/O worker threads that can be created in the Inetinfo process, which limits the number of simultaneous connections. IIS sets PoolThreadLimit to 2 * number of megabytes of RAM present in the machine. If this value is larger than 256, it will be clamped to 256. If a value is present in the registry, it overrides IIS's calculation. Each pool thread watches for a network request and processes it, either by sending back a static file or by passing the request to an ISAPI extension DLL (such as ASP) or to a CGI. If the ISAPI extension processes a request synchronously and it takes a long time to process requests, then it will tie up the worker thread, leaving IIS with fewer worker threads to process other requests. For this reason, well-written ISAPI extensions, such as ASP, implement their own thread pools, place requests in a queue, and process them asynchronously with their own threads, so as not to tie up IIS worker threads. In general, if you find that the default limit of 256 threads is inadequate, you probably have a poorly written ISAPI extension tying up IIS worker threads.
PoolThreadLimit is a hard limit that includes all IIS worker threads, including the HTTP, FTP, NNTP, and SMTP services. PoolThreadLimit will always be greater than or equal to MaxPoolThreads.
The ASP thread pool is a separate set of threads. Its size is controlled by the AspProcessorThreadMax metabase setting. The largest possible number of outstanding ASP requests is the sum of AspRequestQueueMax and AspProcessorThreadMax.
MaxPoolThreads REG_DWORD
Range: 0 - Unlimited
Default: 4 per processor
This parameter specifies the number of I/O worker threads to create per processor. Each pool thread watches for a network request and processes it. The MaxPoolThreads count does not include threads that are consumed by ISAPI applications; it refers only to the number of worker threads available to process request for static files. IIS will create more threads as needed to process ISAPI requests. The total number of IIS worker threads is capped by PoolThreadLimit.
By default, only four CGI applications can run concurrently. If you run many CGI applications, you should increase this value in order to increase the throughput. You could set the UsePoolThreadForCGI value (under ..\Services\W3SVC\Parameters) to FALSE (0); however, this is somewhat dangerous because it can significantly decrease performance during high usage of CGI applications. Generally, it is not good to create more than 20 threads per processor.
ListenBackLog REG_DWORD
Range: 1 to 300
Default: 15
This parameter specifies the maximum number of active connections to hold in the queue while they wait for server attention. It is typically not necessary to use or modify this entry, although with extremely heavy use it could be beneficial to increase this value up to 300.
Registry Path:
HKEY_LOCAL_MACHINE \SYSTEM
\CurrentControlSet
\Control
\SecurityProviders
\SCHANNEL
ServerCacheTime REG_DWORD
Range: 0 - Unlimited (measured in milliseconds)
Default: 300,000 milliseconds (5 minutes)
This parameter determines the amount of time an SSL session lasts. Once an SSL session has been established, clients can reconnect to that session at a fraction of the resource cost of the initial connection. If the SSL session expires, a new SSL session must be completely established. This parameter is not present by default. To change its behavior, you must add it to the registry. You should evaluate how long you expect SSL sessions to last, then set this parameter slightly longer. Do not make the timeout much longer than your estimate or this cache may begin to store stale data.
Related Topics