Chapter 12 - IIS Optimization and the Metabase
Previous chapters in this part of the book focused on techniques you can use to monitor Internet Information Services (IIS) and to optimize server hardware. In this chapter, you'll learn how to optimize IIS and its related services. You'll learn techniques for improving IIS performance, configuring automatic restarts of IIS, and getting the most from IIS applications. You'll also learn advanced techniques for managing IIS through the Microsoft Windows Registry and the IIS metabase.
The Windows Registry contai`ns configuration settings for the operating system, the server hardware, and all applications installed on the server, including IIS. The metabase contains configuration settings that are specific to the sites you've implemented on a particular World Wide Web server. While most configuration settings can be managed through the IIS properties dialog boxes, some properties can be changed only through direct editing of the registry or the metabase. These settings typically are advanced values that should be changed only when you have unique needs.
On This Page
Strategies for Improving IIS Performance
Managing IIS Registry Settings
Managing IIS Metabase Settings
Strategies for Improving IIS Performance
In this section, I examine strategies you can use to improve the performance of IIS. The focus of this section is on improving the overall responsiveness of IIS, and not the underlying server hardware.
Removing Unnecessary Applications and Services
One of the most obvious ways to improve IIS performance is to remove resource drains on the server. Start by removing applications that might be affecting the performance of IIS, including
Microsoft SQL Server
Microsoft Exchange Server
File and print services
If necessary, move these applications to a separate server. This will give IIS more resources to work with. For applications that you can't move, see if there is a way to run the applications only during periods of relatively low activity. For example, if you are running server backups daily, see if you can schedule backups to run late at night when user activity is low.
System services are another area you can examine to see if there are unnecessary resource drains. Every service running on the server uses resources that can be used in other ways. Services that aren't necessary should be stopped and then set to start manually. Before you stop any service, you should check for dependencies to ensure that your server isn't adversely affected.
If you have a dedicated IIS server, the following services are not required in most instances:
Internet Connection Sharing
NetMeeting Remote Desktop Sharing
Network DDE DSDM
TCP/IP NetBIOS Helper Service
Uninterruptible Power Supply
Optimizing Content Usage
The responsiveness of your server is tied directly to the content you are publishing. You can often realize substantial performance benefits by optimizing the way content is used. IIS can handle both static and dynamic content. While static content is passed directly to the requesting client, dynamic content must be processed before it can be passed to the client. This places a resource burden on the server that can be reduced by using static content.
Note: I'm not advocating replacing all dynamic content with static content. Dynamically generated content is a powerful tool for building highly customized and full-featured sites. However, if there are places that you are using dynamic content for no specific reason, you may want to rethink this strategy.
When you use static content, keep in mind that you should set expire headers whenever possible. Expire headers allow the related files to be stored in the client's cache, and this can greatly improve performance on repeat visits when the original content hasn't changed. For details on setting expire headers, see the "Customizing Web Site Content and HTTP Headers" section of Chapter 4, "Customizing Internet Information Services."
With dynamic content, you should limit your use of Common Gateway Interface (CGI) applications. CGI applications require more processor and memory resources than their Internet Server Application Programming Interface (ISAPI) and Active Server Page (ASP) counterparts. Because of this, you should replace or convert CGI applications to ISAPI or ASP. When you have a choice of using ISAPI or ASP, you should use ISAPI. ISAPI applications run faster than ASP applications, although they often require more development time.
Additionally, whenever you work with ISAPI or ASP applications, try to push as much of the processing load onto the client as possible. This reduces the server resource requirements and greatly improves application responsiveness. One example of pushing processing to the client is to use client-side scripting to evaluate form submissions before data is sent to the server. This technique reduces the number of times information is sent between the client and the server; therefore, it can greatly improve the overall performance of the application.
To improve content-related performance, you might also want to
Analyze the way content is organized on your hard drives In most cases, you should keep related content files on the same logical partitions of a disk. Keeping related files together improves IIS file caching.
Defragment your drives periodically Over time, drives can become fragmented, and this decreases read/write performance. To correct this, periodically defragment your server's drives. Many defragmentation tools allow you to automate this process so that you can configure a scheduled job to automatically defragment drives without needing administrator intervention.
Reduce the size of content files The larger the file size, the more time it takes to send the file to a client. If you can optimize your source Hypertext Markup Language (HTML) or ASP code and reduce the file size, you can increase the performance and responsiveness of your Web server. Some of the biggest bandwidth users are multimedia files. Compress image, video, or audio files using an appropriate compression format whenever possible.
Store log files on separate disks from content files Logging activity can reduce the responsiveness of a busy server. One way to correct this is to store access logs on a different physical drive from the one storing your site's content files. In this way, disk writes for logging are separate from the disk reads or writes for working with content files, which can greatly improve the overall server responsiveness.
Log only essential information Trying to log too much information can also slow down a busy server. With the World Wide Web Consortium (W3C) extended logging format, you can reduce logging overhead by logging only the information that you need to generate reports and removing logging for nonessential information. With any type of logging, you can reduce logging overhead by organizing different types of content appropriately and then disabling logging on directories containing content whose access doesn't need to be logged. For example, you could place all of your image files in a directory called Images, and then disable logging on this directory.
Optimizing ISAPI and ASP Applications
Improperly configured and poorly optimized applications can be major resource drains on an IIS server. To get the most from the server, you need to optimize the way applications are configured. To optimize applications:
Enable ISAPI application caching IIS can cache ISAPI applications in memory. This allows frequently used applications to be accessed quickly. You can control caching with the metabase property CacheISAPI.
Manage application buffering and flushes appropriately Application buffering allows all output from an application to be collected in the buffer before being sent to the client. This cuts down on network traffic and response times. However, users don't receive data until the page is finished executing, which can give the perception that a site isn't very responsive. You can control application buffering with the metabase property AspBufferingOn.
Disable application debugging Application debugging slows IIS performance considerably. You should only use debugging for troubleshooting. Otherwise, debugging should be disabled. You can control debugging with the metabase property AppAllowDebugging.
Run isolated applications only when necessary Pooled and out-of-process applications use additional system resources and have slightly lower performance than in-process applications. For more information, see the "Using and Running Applications" section of Chapter 4, "Customizing Internet Information Services."
Manage session configuration appropriately As the usage of your server changes, so should the session management configuration. By default, session management is enabled for all applications. If your applications don't use sessions, however, you are wasting system resources. Instead of enabling sessions by default, you should disable sessions by default and then enable sessions for individual applications. You can control sessions with the metabase properties AspAllowSessionState, AspSessionMax, and AspSessionTimeout.
Set a meaningful session time-out The session time-out value is extremely important in determining the amount of resources used in session manage ment. Set this value accurately. Sessions should time out after an appropriate period. Configure session time-out with the metabase property AspSessionTimeout.
Set appropriate script and connection time-out values ASP scripts and user connections should time out at an appropriate interval. By default, ASP scripts time out after 90 seconds and user connections time out after 15 minutes. Zombie scripts and open connections use resources and can reduce the responsiveness of the server. To reduce this drain, set appropriate time-outs. These time-outs should be set based on the way your site is used. You can control script and connection time-outs with the metabase properties AspScriptTimeout and ConnectionTimeout, respectively.
Optimizing IIS Caching and Queuing
IIS uses many different memory-resident caches and queues to manage resources. If you make extensive use of dynamic content or have a heavily trafficked site, you should optimize the way these caches and queues work for your environment. You might want to
Lengthen connection queues used with HTTP keep-alives When you use HTTP keep-alives, IIS maintains connections for a user's HTTP session in the connection queue. By default, this queue can hold a maximum of 15 connections at any one time. If this value does not meet your needs, you can modify it using the metabase property ServerListenBackLog. In most cases, you'll want to set this value to the maximum number of connection requests you want the server to maintain.
Consider enabling thread gating Thread gating dynamically controls the number of concurrently executing threads with a goal of ensuring that requests are serviced in a timely manner. When enabled, thread gating occurs when processor utilization drops below 50 percent or rises above 80 percent. When processor utilization drops below 50 percent, which could indicate that threads are blocked or that the load is light, IIS increases the number of active threads so that other requests can be serviced. When processor utilization exceeds 80 percent, indicating a heavy load, IIS deactivates threads to reduce the amount of context switching. To control thread gating, you'll use the metabase properties AspThreadGateEnabled, AspThreadGateLoadLow, and AspThreadGateLoadHigh.
Consider changing the IIS File Cache settings By default, IIS uses up to 50 percent of the server's physical memory. This value ensures that IIS works well with other applications that might be running on the server. If the server is dedicated to IIS or has additional memory available, you might want to increase this setting to allow IIS to use more memory. To control IIS file caching, you'll create and then set the Windows Registry value MemCacheSize.
Consider changing the maximum cached file size By default, IIS only caches files that are 256 KB or less in size. If you have large data or multimedia files that are accessed frequently, you might want to increase this value to allow IIS to cache larger files. Keep in mind that with file sizes over 256 KB you'll reach a point at which caching won't significantly improve performance. The reason for this is that with small files, the overhead of reading from disk rather than the file cache is significant, but with large files, the disk read might not be the key factor in determining overall performance. To control the maximum cached file size, you'll create and then set the Windows Registry value MaxCachedFileSize.
Consider adjusting the time-to-live value for cached resources By default, IIS purges from cache any resources that haven't been requested within the last 30 seconds. If you have additional memory on the server, you might want to increase this value so that files aren't removed from cache as quickly. To control the time-to-live value for cached resources, you'll create and then set the Windows Registry value ObjectCacheTTL.
Consider modifying the ASP template cache The ASP template cache controls the number of ASP pages that are cached in memory. By default, IIS will cache up to 250 files. This might not be enough on a site with lots of ASP content. Template cache entries can reference one or more entries in the ASP Script Engine Cache. To control template caching, you'll set the metabase property AspScriptFileCacheSize.
Consider modifying the script engine cache The ASP Script Engine Cache is an area of memory directly accessible to the scripting engines used by IIS. As such, the preferred area for IIS to retrieve information from is the script engine cache. By default, the script engine cache can hold up to 125 entries. To control script engine caching, you'll set the metabase property AspScriptEngineCacheMax.
Configuring Automatic Restarts of IIS
Chapter 2, "Core IIS Administration," focused on core administration tasks for IIS. In that chapter, you learned how to manage services and how to use the IIS Reset utility. To get the best performance from IIS, configure the IIS Admin Service to automatically run the IIS Reset utility if a problem occurs with the service. This allows IIS to automatically recover from most situations that otherwise would have stopped IIS from handling user requests altogether.
You can configure automatic restart of IIS by completing the following steps:
In the Computer Management console, connect to the computer whose services you want to manage.
Expand the Services And Applications node by clicking the plus sign (+) next to it, and then select Services.
Right-click on IIS Admin Service, and then select Properties.
Select the Recovery tab. Set the First Failure, Second Failure, and Subsequent Failure fields to Run A File, as shown in Figure 12-1.
In the Run File panel, set the File field to \%SystemRoot%\System32\ IISRESET.EXE.
Figure 12-1: Configure the IIS Admin Service to run the IIS Reset utility.
Managing IIS Registry Settings
The Windows Registry stores configuration settings for the operating system, the server hardware, and all installed applications. The Registry is essential to the proper operation of the operating system. You should make changes to the registry only when you know how these changes will affect the system.
Working with the Registry
Registry settings are stored as keys and values. These keys and values are placed under a specific root key. The root key controls when and how other keys and values are used. The root keys are
HKEY_CLASSES_ROOT Configuration settings for applications and files. Ensures the correct application is opened when a file is started through Microsoft Windows Explorer or object linking and embedding (OLE).
HKEY_CURRENT_CONFIG Contains information about the hardware profile being used.
HKEY_CURRENT_USER Controls configuration settings for the current user.
HKEY_LOCAL_MACHINE Controls system-level configuration settings.
HKEY_USERS Stores default user and other user settings by profile.
Under the root keys, you'll find the main keys that control various facets of the system, user, and application environments. These keys are organized into a tree structure in which folders represent keys. Settings that control the IIS Admin Service are stored under the following Registry path:
HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Services \InetInfo \Parameters
Here, the key is Parameters. The values associated with this or any other key have three components: a value name, a value type, and an actual value. Numeric values are often expressed in hexadecimal format. Hexadecimal values use the prefix 0x, such as 0x19 for the decimal value 25. In the following example, the ListenBackLog value has a type of REG_DWORD and a value of 0x19:
ListenBackLog : REG_DWORD : 0x19
REG_DWORD is one of many possible value types. The complete list of value types follows:
REG_BINARY Sets a binary value. Binary values must be entered using base-2 (0 or 1).
REG_DWORD Sets a DWORD value, which is composed of hexadecimal data with a maximum length of 4 bytes.
REG_SZ Sets a string value containing a sequence of characters.
REG_EXPAND_SZ Sets an expandable string value, which is usually used with directory paths.
REG_MULTI_SZ Sets a multiple string value.
The main tool that you'll use to work with the Windows Registry is the Registry Editor (REGEDT32.EXE). You can start the Registry Editor by clicking Start and then selecting Run. Then, type REGEDT32 in the Open field, and then click OK. If you are an experienced administrator, you might want to use a Windows script to manage the Registry. With scripts you can create, update, and delete Registry settings. A Microsoft Visual Basic, Scripting Edition (VBScript) script example that updates the ListenBackLog value follows:
'Initialize variables and objects Dim Path Path = HKLM\SYSTEM\CurrentControlSet\Services\Inetinfo\Parameters\" Set ws = WScript.CreateObject("WScript.Shell") 'Read and display key value val = ws.RegRead(Path & "ListenBackLog") WScript.Echo "Orginal ListenBackLog value: " & val 'Write new key value and then display new value retVal = ws.RegWrite(Path & "ListenBackLog", 50, "REG_DWORD") val = ws.RegRead(Path & "ListenBackLog") WScript.Echo "Updated ListenBackLog value: " & val
Note: A detailed discussion of scripting is beyond the scope of this book. A good resource for learning more about Windows scripting is the Windows 2000 Scripting Bible. See William R. Stanek, Windows 2000 Scripting Bible (IDG Books, June 2000).
Controlling IIS Through the Registry
Settings that control IIS are stored in the Registry under
HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Services \Inetinfo \Parameters
After you've started the Registry Editor and accessed this location, the key values you might want to work with are
CacheSecurityDescriptor Indicates whether security descriptors are cached for file objects. A value of 1 enables this feature. A value of 0 disables this feature. When enabled (the default setting), security descriptors for files are saved when caching a file object. As long as the file is cached, IIS will not need to re-access the file to determine access rights for new users. This value is most useful for sites that authenticate users and not useful for sites that allow anonymous access.
CheckCertRevocation Indicates whether IIS checks to see if a client certificate is revoked. If you issue your own certificates and make local certificate checks, you might want to enable this feature. Otherwise, the feature should be disabled, which is the default. A value of 1 enables this feature.
DisableMemoryCache Indicates whether IIS memory caching is enabled or disabled. By default, memory caching is enabled (meaning this value is set to 0). Disable memory caching only for testing or development purposes.
ListenBackLog Specifies the maximum number of active connections that IIS maintains in the connection queue. The default value is 15 and the range of acceptable values is from 1 to 250.
MaxCachedFileSize Determines the maximum size of a file that can be placed in the file cache. IIS will not cache files that are larger than this value. The default value is 262,144 bytes (256 KB).
MaxConcurrency Specifies how many threads per processor should be allowed to run simultaneously if there is a pending input/output (I/O) operation. The default value (0) allows IIS to control the number of threads per processor. You can also set a specific value.
MaxPoolThreads Sets the number of pool threads to create per processor. Each pool thread watches for a network request for a CGI application and processes it. This value does not control threads that are used by ISAPI applications. By default, the value is set to 4. On a single processor system, this means that only four CGI applications could run simultaneously.
MemCacheSize Sets 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. By default, IIS uses 50 percent of the available memory. The valid range is from 0 megabytes to the total amount of physical memory available in megabytes.
ObjectCacheTTL Sets the length of time (in milliseconds) that objects are held in memory. If the object hasn't been used in this interval, it is removed from memory. The default value is 30 seconds (300,000 milliseconds).
PoolThreadLimit Sets the maximum number of pool threads that can be created on the server. This limit is for all IIS threads. The default value is twice the size of physical memory in megabytes.
Controlling Indexing Service Through the Registry
Settings that control the Indexing Service are stored in the Registry under
HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Control \ContentIndex
You'll find a detailed discussion of related settings and keys in the "Indexing Service Essentials" section of Chapter 9, "Administering the Indexing Service."
Settings for the World Wide Web Publishing, File Transfer Protocol (FTP), and Simple Mail Transfer Protocol (SMTP) Services are stored in separate registry keys. The path to these keys is
HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Services \ServiceName \Parameters
ServiceName is the name of the service you want to work with. Services you might work with are
MSFTPSVC for the FTP Service
W3SVC for the World Wide Web Publishing Service
SMTPSVC for the SMTP Service
Although most of the keys under this path are used only by IIS, you might want to set the AllowGuestAccess key value. This key value determines whether Guest logons are allowed for Internet services. By default, Guest logons are permitted, but you can disable this feature by setting the key value to 0.
For the World Wide Web Publishing Service, you might also want to work with the following key values:
SSIEnableCmdDirective Determines whether Web pages can issue server-side include statements that execute shell commands. By default, the ability to execute shell commands is disabled (set to 0), and this is the value you should use in most cases. If you allow the direct execution of shell commands from Web pages, you might inadvertently open up the server to attack from malicious coders.
TryExceptDisable Determines whether exception caching is enabled for debugging. The value is disabled by default (set to 0). If enabled (set to 1), the server stops when any exception is thrown and allows a developer to debug the application that threw the exception.
UploadReadAhead When a client posts data to the server, this value determines the amount of data the server will read before passing control to the application responsible for handling the data. The default value is 48 KB.
UsePoolThreadForCGI Determines whether CGI requests can use pooled threads. By default, this value is enabled (set to 1). If disabled, CGI requests don't use pooling and the Inetinfo value MaxPoolThreads doesn't apply.
Controlling Secure Sockets Layer Through the Registry
Settings that control Secure Sockets Layer (SSL) are stored in the Registry under
HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Control \SecurityProviders \SCHANNEL
After you've started the Registry Editor and accessed this location, the key values you might want to work with are
EventLogging Determines whether SSL connections are logged for Web sites configured on the server. By default, this value is enabled (set to 1). To disable this feature, set the value to 0.
ServerCacheTime Determines the amount of time (in milliseconds) that an SSL session lasts. Establishing an SSL session is a time- and resource-intensive process. If you expect SSL sessions to last, on average, longer than the default value, you might want to modify this value. By default, an SSL session lasts 5 minutes (300,000 milliseconds). When the session expires, a new SSL session must be established.
Managing IIS Metabase Settings
The metabase is one of the most important components in an IIS installation. The metabase is where IIS stores configuration settings for sites and virtual servers. The metabase also contains default settings for sites and virtual servers, such as the Master WWW properties.
Examining and Editing the Metabase
The IIS metabase is stored in a structured file that is located in the \Inetsrv directory and is named METABASE.BIN. Although you should never access the file directly, there are many ways to view and modify the contents of this file. In the "Configuring IIS Backup and Recovery" section of Chapter 2, "Core IIS Administration," you learned how to create backup copies of the metabase and how to use these backup copies to recover the metabase to a specific point and time. Discussions in previous chapters showed you how to use standard administration tools, such as the Internet Information Services snap-in, to modify the configuration settings of IIS. Any configuration changes you make in the administration tools are in turn reflected in the IIS metabase.
Metabase contents can also be viewed and managed in a specially configured editor. The Windows 2000 Resource Kit includes Metabase Editor (METAEDIT.EXE). If you have the resource kit CD-ROM, you can install the Metabase Editor by double-clicking SETUP.EXE in the \Apps\Metaedit directory and following the prompts. After you install and run Metabase Editor, you'll find that working with the metabase is much like working with the Windows Registry Editor (REGEDT32.EXE).
As Figure 12-2 shows, configuration properties are organized into a hierarchy that follows a standard naming convention where each value has a key name and path. The key name is a location in the metabase. The path is a sequence of keys separated by a forward slash (/) that uniquely identifies the location of a key. The hierarchy follows this convention:
where LM is a key that represents the local machine; Service is a placeholder that represents an Internet service, such as W3SVC or MSFTPSVC; Website is a placeholder that represents the site or virtual server instance; and Root is the virtual directory root.
To see how metabase paths are used, consider the following example. The metabase path /LM/W3SVC/1/Root represents the root of the first Web site instance installed on the local machine. Thus, if this value is associated with the path C:\Inetpub\Wwwroot, then the Uniform Resource Locator (URL) http://www.domain.com/index.htm could be mapped to the physical file path C:\Inetpub\Wwwroot\INDEX.HTM.
When you work with metabase properties, the inheritance rules discussed in previous chapters still apply. Properties that you set at the global level can apply to
Figure 12-2: Use the Metabase Editor to view and edit metabase properties.
sites, directories within a site, and subdirectories within a directory. Properties that you set at the local level can inherit properties you set at the global level. Similarly, child nodes could inherit properties that you set for a site or a directory. Inheritance is automatic. You can, however, override inheritance. One way to do this in the Metabase Editor is to remove the Inherit attribute from the property before you change its value. Another way to do this is to set a specific property value at the site level. For example, if you want to turn buffering on for an individual site and not for all sites, you could set the AspBufferingOn property for the specific site.
Modifying Metabase Properties
You can use the Metabase Editor or a Windows VBScript to modify metabase properties. With the Metabase Editor, you can modify properties using techniques similar to those for the Registry Editor. You can
Browse the directorylike structure of the metabase until you find the property that you want to edit.
Double-click the property and then edit the value using a dialog box similar to the one shown in Figure 12-3.
Use the Data field to view or set the property value. When you are finished editing the property, click OK.
Note: As you work with metabase properties, keep in mind that new settings might not take effect until you restart the related service. For example, if you modify a Web site setting, you might need to stop and then start the Web site for the changes to take effect.
Figure 12-3: After you locate a property, use the dialog box shown to edit its settings.
You can also use the Metabase Editor to search for a property that you want to edit. To do this, follow these steps:
Press Ctrl+F or select Find from the View menu.
In the Find dialog box, type the property name in the field provided, and then click OK.
If the editor can find the property, the editor locates the property in the metabase tree and highlights it. Double-click the property and then edit the value using the dialog box provided. Click OK when you are finished.
If the editor cannot find the property, you'll see an error message. Make sure you've typed the property name correctly and try searching again.
As you can probably imagine, you can set hundreds of metabase properties. The ones you'll work with the most relate to global settings for Web servers. You'll find these properties in the metabase location \LM\W3SVC. The properties you'll want to work with include
AppAllowDebugging Specifies whether ASP debugging is enabled on the server. When you enable this property, only one thread of execution is allowed for each IIS application you've configured on the server. This allows you to debug applications individually. By default, this value is set to FALSE. Set this value to TRUE only for debugging purposes.
AspAllowSessionState Specifies whether sessions are enabled for applications. When you enable this property, IIS tracks information for user sessions. By default, this value is set to TRUE (enabling sessions). If sessions aren't used, however, you can achieve better performance by setting this value to FALSE and then enabling sessions in individual applications as needed using <% @ENABLESESSIONSTATE=TRUE %>.
AspBufferingOn Specifies whether ASP buffering is enabled. With buffering, output is collected in a buffer before it is sent to the client. By default, this value is set to TRUE (enabling buffering). If you set this property to FALSE, output from ASP scripts is sent to the client browser as it becomes available.
AspQueueConnectionTestTime Sets the interval used to determine if a client is still connected to the server. If a request has been in the queue longer than the test time, the server checks to see if the client is still connected before beginning execution. The default value is 3 seconds. This feature is designed to handle the problem of impatient users filling the request queue with numerous requests for the same page. ASP pages can also use the Response.IsClientConnected method to see if the client is still connected.
AspRequestQueueMax Specifies the default limit for ASP requests in the connection queue. The default value is 3000. The way you set this value depends on your applications. If the average request has a very short execution time and the time in the queue is short, you might want to increase this limit (particularly if you have a very busy server).
AspScriptEngineCacheMax Specifies the maximum number of scripts to cache in memory. A hit in the script engine cache means that you can avoid recompiling a template into byte code. The default value is 125.
AspScriptFileCacheSize Specifies the number of precompiled script files to store in the ASP Template Cache. The default value is 250. If you set this property to –1, all script files requested are cached. If you set this property to 0, no script files are cached.
AspSessionMax Sets the maximum number of concurrent user sessions for ASP applications. By default, sessions are limited by time and not the total number of connections.
AspSessionTimeout Determines when ASP sessions time out and have to be refreshed. By default, sessions time out after 20 minutes.
AspThreadGateEnabled Specifies whether thread gating is enabled. Thread gating is used to dynamically control threads of execution. By default, this value is set to FALSE. You can enable thread gating by setting this property to TRUE.
AspThreadGateLoadHigh Sets the high value for thread gating. IIS deactivates threads to reduce the amount of context switching when processor utilization rises above this value. This is a precautionary measure to improve performance under heavy loads.
AspThreadGateLoadLow Sets the low value for thread gating. IIS increases the number of active threads when processor utilization drops below this value. This is a precautionary measure in case there are blocking threads.
CacheISAPI Specifies whether ISAPI DLLs are cached in memory after use. By default, this property is set to TRUE and ISAPI DLLs remain in the cache until the server is stopped. If the property is FALSE, DLLs are unloaded from memory after use.
ConnectionTimeout Specifies the time in seconds that the server will wait before disconnecting an inactive connection. The default value is 900 seconds (15 minutes).
DisableMemoryCache Indicates whether IIS memory caching is enabled or disabled. By default, memory caching is enabled (meaning this value is set to 0). You should disable memory caching only for testing or development purposes.
ServerListenBackLog Sets the request queue size. The default value is based on the AcceptEx operating system parameter and on the value of the ServerSize metabase property. If ServerSize is set to 1, the default for this property is 40. If ServerSize is set to 2, the default is 100. Valid values for this property range from 5 to 1000.
ServerSize Specifies the general size of the server in terms of the number of client requests processed per day. A value of 0 indicates fewer than 10,000 requests per day, a value of 1 indicates between 10,000 and 100,000 requests per day, and a value of 2 indicates more than 100,000 requests per day.
Scripting the Metabase
Windows scripts provide another technique you can use to work with the metabase. To access metabase properties in a Windows script, you use the Active Directory Services Interface (ADSI) provider for IIS. This provider allows you to manipulate the IIS administrative objects. Key administrative objects that you'll work with include IIsComputer, IIsWebServer, and IIsFtpServer.
You can use the IIsComputer object to set global IIS properties and to manage metabase backups. Keep in mind that all child nodes (sites, directories, and others) can inherit global properties. The IIsComputer object is an ADSI container object that has this AdsPath:
where MachineName can be any computer name or LocalHost, such as
In VBScript, you could get the IIsComputer object for ENGSVR01 using the following code:
'Initialize variables Dim compObject, serverName serverName = "engsvr01" 'Get IISWebServer object Set compObject = GetObject("IIS://" & serverName)
Note: A detailed discussion of scripting the metabase is beyond the scope of this book. If you want to learn Windows scripting, a good resource is the Microsoft Windows 2000 Scripting Bible. Once you know how to program Windows scripts, use the IIS online help documentation to get a better understanding of what objects are available and how those objects can be used.
You can then work with any of the IIsComputer object's methods and properties, such as these:
'Initialize variables Dim compObject, serverName serverName = "engsvr01" 'Get IISWebServer object Set compObject = GetObject("IIS://" & serverName) 'Restore metabase configuration from last backup compObject.Restore
You use the IIsWebServer object to set metabase properties that apply to a specific Web site and to set inheritable properties for directories and files. Methods are also available to control server operation. For example, you can use the Stop method to stop a site and then use the Start method to start the site.
Web sites are identified according to their index number in the metabase. The first Web site instance created on the server has an index number of 1, the second has an index of 2, and so on. The IIsWebServer object is an ADSI container object that has this AdsPath:
MachineName can be any computer name or LocalHost, W3SVC identifies the Web service, and N is the index number of the site. In the following example, the AdsPath string specifies the first Web site instance on the server named ENGSVR01:
In VBScript, you can get the IIsWebServer object for the first Web site instance using the following code:
'Initialize variables Dim webObject, serverName, webN serverName = "engsvr01" webN = "1" 'Get IISWebServer object Set webObject = GetObject("IIS://" & serverName & "/W3SVC/ & webN)
You can then work with any of the IIsWebServer object's methods and properties, such as these:
'Initialize variables Dim webObject, serverName, webN serverName = "engsvr01" webN = "1" 'Get IISWebServer object Set webObject = GetObject("IIS://" & serverName & "/W3SVC/"& webN) 'Stop Web site webObject.Stop 'Turn on ASP Buffering webObject.AspBufferingOn = True 'Save the changed value to the metabase webObject.SetInfo 'Start the Web server webObject.Start
You can use the IIsFtpServer object to set metabase properties that apply to a specific FTP server and to set inheritable metabase properties for directories. As with the IIsWebServer object, methods are also available to control server operation. You can, for example, call the Pause method to pause the FTP server and then call the Continue method to resume operation.
FTP servers are identified according to their index number in the metabase. The first server has an index number of 1, the second has an index of 2, and so on. The IIsFTPServer object is an ADSI container object that has this AdsPath:
MachineName can be any computer name or LocalHost, MSFTPSVC identifies the FTP Service, and N is the index number of the server. In the following example, the AdsPath string specifies the first FTP server on ENGSVR01:
In VBScript, you can get the IIsFtpServer object for the first FTP server instance using the following code:
'Initialize variables Dim ftpObj, serverName, ftpM serverName = "engsvr01" ftpN = "1" 'Get IIsFtpServer object Set ftpObj = GetObject("IIS://" & serverName & "/MSFTPSVC/ & tpN)
You can then work with any of the IIsFtpServer object's methods and properties, such as in the following:
'Initialize variables Dim ftpObj, serverName, ftpN serverName = "engsvr01" ftpN = "1" 'Get IIsFtpServer object Set ftpObj = GetObject("IIS://" & serverName & "/MSFTPSVC/"& ftpN) 'Stop FTP Server ftpObj.Stop 'Enable anonymous access ftpObj.AllowAnonymous = True 'Save the changed value to the metabase ftpObj.SetInfo 'Start FTP Server ftpObj.Start