IIS 5.0 Process Recycling Tool

Version 1.0

On This Page

Introduction Installation Instructions Functionality and Configuration Running an Audit with IIS5Recycle Advanced Control/Scripting Feature NLB Support Recovery Appendix: Registry Settings

Introduction

The IIS 5.0 Process Recycling Tool (IIS5Recycle) version 1.0, runs as a service on a computer running Windows 2000 and Internet Information Server 5.0. The purpose of IIS5Recycle is to recycle processes, minimizing the effects of resource-consumption problems before performance and reliability are affected. This tool automatically recycles IIS processes based on configurations stored in the Windows registry. IIS5Recycle also allows administrators to gather information for use in troubleshooting processes and applications.

The following user scenarios illustrate how IIS5Recycle is used in process recycling, and in gathering information:

  • Minimizing consumption caused by memory leaks A Web administrator suspects that Web applications running on his/her servers are leaking memory. The administrator schedules periodic recycling of IIS processes to release resources are consumed by the leaking Web applications.

  • Troubleshooting a Web application Using the Advanced Scripting feature, an administrator gathers and logs information about a problematic Web application before IIS is recycled. While the Web site continues to serve the customer, a developer can analyze the logs.

Download IIS5Recycle.exe to your computer and extract the files to the c:\IIS5Recycle directory.

Installation Instructions

To install IIS5Recycle:

  1. Open the command prompt.

  2. Type IIS5Recycle /install.

  3. Configure the recycling conditions by typing IIS5Recycle /config.

Functionality and Configuration

IIS5Recycle provides the ability for administrators to set criteria for automatic recycling of IIS processes, and stopping IIS when recycling fails.

Setting IIS5Recycle

IIS5Recycle automatically recycles IIS processes based on the following criteria:

  1. IIS up time: Recycle IIS after it has been running for a configured number of hours (see Figure 1).

  2. Total HTTP requests served: Recycle IIS based on the total number of requests served, recorded by the Get Request performance counter (see Figure 1).

  3. Time of day/week: Recycle IIS based on a specific day or time (see Figure 1 and Figure 2).

  4. Virtual memory usage: Recycle IIS based on the total virtual memory usage recorded by InetInfo.exe + DLLHost.exe for out-of-process applications (see Figure 1).

  5. ASP requests queued: Recycle IIS if ASP requests queued total is greater than the configured value after a determined number of retries. Retries can be configured through a registry key: %ASPThresholdRetries% (see Figure 1).

  6. Recycle IIS at the next Quiet Time: To recycle the IIS service at the next quiet time threshold, set the following registry key configuration: %QuietTimeRequests%. The default value is 10, which means that there is a quiet time whenever GET requests per second falls to 10 or lower.

Figure 1: Configure the IIS5Recycle tool using the IIS 5.0 Recycle.

Figure 2: Add or edit scheduled times and days using the IIS5Recycle Select Time screen.

Stopping IIS with IIS5Recycle

IIS5Recycle forcefully stops IIS if a recycle request fails after a configurable amount of time. This functionality ensures that IIS will be recycled when a recycle threshold is met. The registry key for this feature is IISStopTimeoutSecs.

Running an Audit with IIS5Recycle

The NoRealRecycle feature allows you to run the IIS5Recycle tool in an audit-only mode without interrupting the IIS service. When using the audit-only mode, IIS Recycle events will be stored in the Windows Eventlog and can be used to assess IIS Recycle conditions that can be configured for your Web server. An administrator can use this feature to fine-tune the recycle settings based on application and environment specifics gathered during the audit-mode run. To turn on this feature, set the NoRealRecycle key to 1 in the Registry.

Advanced Control/Scripting Feature

The Advanced Control/Scripting feature allows administrators to specify commands (scripts) to run before and after each IIS5Recycle execution. Click the Advanced button on the IIS5Recycle screen to invoke the Advanced Control screen (see Figure 3).

Figure 3: Use the Advanced Control dialog box to configure commands and timeouts.

The return value of Before Command will be verified if the Verify Return Value checkbox is checked. The output of the script will be redirected to a log file under %windir%\system32\LogFiles\IIs5Recycle. If the script does not return the expected value, the current recycle will be skipped.

Note: On a WLBS-enabled system, the script will be executed after the WLBS stop and before WLBS start.

If you do not see the expected output in the log file, verify that the script name is correct and that it is copied to the %windir%\system32 directory. If the script needs to access any other executable files, ensure that all those files are also located in the %windir%\system32 directory.

NLB Support

IIS5Recycle removes the Web server from the cluster (Web farm) on a Windows Network Load Balancing (NLB)-enabled system before recycling the IIS process. Each time a server is taken out of a cluster, connections to the Web server will be drained. Once the connection number drops below the configured threshold or the given time passed, the IIS service is recycled. The default of this feature behavior can be configured by setting the following registry keys:

  • %WLBSDrainWaitSecs%,

  • %WLBSDrainStopConnectionNum%

  • %WLBSWaterMark%.

The WaterMark feature guarantees that at any time there will be more servers in the cluster than the value set for %WaterMark% in the registry. There are two requirements to use the WaterMark feature:

  1. Remote control on each WLBS host is enabled.

  2. If a password is required for remote control, each node uses the same password.

NLB Web farms that do not use WLBS can use the Advance Control/Scripting feature.

Recovery

The Service Control Manager (SCM), available through the Computer Management MMC snap-in, can be configured to take an action when a service fails unexpectedly. The IIS5Recycle service uses this feature as a fatal error notification/recovery method. Configuring the recovery actions for the IIS5Recycle service ensures that the administrator will be notified if an unrecoverable event occurred on the Web server. If any of the following failures occur, the IIS5Recycle service terminates itself in order to triage the SCM recovery action:

  1. After an IIS process stopped and IIS5Recycle could not start it after several retries.

  2. On a clustering-enabled system, after the server was removed from the cluster and IIS5Recycle could not restart Windows Load Balancing.

In both cases an event will be logged into the Windows EventLog.

Appendix: Registry Settings

All IIS5Recycle configuration settings will be stored in the registry under

HKEY_LOCAL_MACHINE \SOFTWARE \Microsoft \Windows NT\CurrentVersion\IIs5Recycle

Any registry changes will be picked up by IIS5Recycle automatically.

The following table displays the names, types, and defaults of the registry entries used by IIS5Recycle.

Name

Type

Description

Default

QueryIISMinutes

REG_DWORD

How often processes should query IIS status.

15 minutes

RecycleIISDelay

REG_DWORD

If a recycle condition is reached, how long to wait to see if IIS can reach a quiet time defined by %QuietTimeRequestNumber%

0 minutes (recycle immediately).

QuietTimeRequestNumber

REG_DWORD

If a recycle condition is reached, IIS attempts to recycle processes at the next quiet time (if %RecycleDelay% equals zero). Number is used to determine if IIS reached quiet time.

10 Get requests/second.

IISStopTimeOutSecs

REG_DWORD

Time given for IIS to stop before timeout occurs.

60 seconds.

IISStartTimeOutSecs

REG_DWORD

Time given for IIS to start before timeout occurs.

60 seconds.

NoRealRecycle

REG_DWORD

Report recycle event only.

0 (do recycle).

WLBSDrainWaitSecs

REG_DWORD

Time given for WLBS drain to stop.

60 seconds.

WLBSWaterMark

REG_DWORD

If the number of current active hosts in the NLB cluster is equal to or below this threshold, IIS5Recycle skips the current recycle period.

0 (disabled).

WLBSDrainStopConnectionNum

REG_DWORD

If the number of current connections is below this value, IIS5Recycle stops draining.

0 (drain until there are no connections).

ForceDrainStop

REG_DWORD

Enforce that NLB is not started by other monitoring programs during the %WLBSDrainWaitSecs% period

0 (disabled).

ASPThresholdRetries

REG_DWORD

How many times IIS5Recycle will retry when ASP Requests Queued is above the set value of %ASPRequestsQueued%.

0 (no retries).