IIS allows applications to be run out-of-process (OOP) hosted by a DLLHost.exe process which is isolated from IIS. Process recycling leverages the infrastructure built by COM+ to perform process recycling of these OOP applications. Specifically, IIS relies on the RecycleProcess() method in COM+ as a means of indicating to COM+ that applications hosted by a DLLHost.exe process should be recycled. For more information about when you may want to recycle an application, see Problems with Applications.
Over time applications often see their performance degrade due to poorly written code, sometimes getting stuck in a loop that causes unnecessary load on the CPU. These applications can also cause memory leaks, where applications do not release un-needed memory back to the operating system. These applications can cause a server to stall, requiring the server to be re-booted. Process recycling was created to solve these problems.
How Process Recycling Works
Process recycling works by recycling an application or pool of applications when a configured reycling event occurs. The methodology behind recycling an OOP application is simple; IIS calls into the COM+ RecycleProcess() method requesting that the application's DLLhost.exe hosting process be recycled. When a recycling event is triggered, the following events happen:
- A new process is created to service new application requests for the application(s) being recycled.
- The process that is being recycled is given time to finish processing old application requests. The time interval is configured using the ShutdownTimeLimit metabase key.
- If the ShutdownTimeLimit is reached, and the old process has not shut down, then IIS terminates the old process.
For more information about the COM+ RecycleProcess, search for the keyword "RecycleProcess" in the COM+ (Component Services) Platform SDK.
Applications can be configured to run in one of three ways. IIS 5.0 introduced the terminology "isolation level" to describe these options. The three isolation levels are Low, Medium, and High: Applications are configured on the Home Directory property sheet using the IIS snap-in.
- Low (IIS) Applications can be run in inetinfo.exe, which is the primary IIS process, also known as in-process. You should not run applications in the IIS process unless they have been thoroughly tested. If an application that runs in this process crashes, it also crashes IIS and any other applications that run in-process. Applications running in-process do not get recycled.
- Medium (Pooled) Pooled applications are run OOP, and hosted by a common DLLHost.exe process. Process Recycling is configured for all pooled applications at the W3SVC level of the metabase and all pooled applications are recycled together.
- High (Isolated) Isolated applications are run OOP, and each application is hosted by a single DLLHost.exe process. Isolated applications are recycled separately from any other application. Process recycling can be configured at any level of the metabase where an isolated application exists.
The levels of the metabase that Process Recycling can be configured are explained in Levels and Inheritance. For information about configuring process recycling, see Configuring Process Recycleng Events. For more information about running an application in-process or out-of-process, see About Applications
There are three events that can be configured to trigger a recycling event, all of which can be active simultaneously. These events are as follows:
Summary of Process Recycling Events
Listed below are the metabase key names that can be configured to trigger a process recycling event to occur.
- Time Created
Applications are recycled after running for a pre-determined amount of time. This property is configured using the PeriodicRestartTime metabase key.
- Number of Requests
Applications are recycled after receiving a pre-determined number of requests. This property is configured using the PeriodicRestartRequests metabase key.
- Scheduled Time
Applications are recycled at a pre-determined time of day. This property is configured using the PeriodicRestartSchedule metabase key.
Understanding Triggered Events
When more than one event is used to trigger recycling, the first event threshold that is reached causes IIS to recycle the application's DLLhost.exe process. The PeriodicRestartTime and PeriodicRestartRequests events use internal timers that count from zero to the value set in their metabase key. When the counter reaches the value set in the metabase key, the process is recycled, and the internal counter is set back to zero. Also, the PeriodicRestartTime and PeriodicRestartRequests internal counters affect each other as shown below.
- When the PeriodicRestartTime event triggers: The process is recycled and the PeriodicRestartTime and PeriodicRestartRequests internal timers are reset to zero.
- When the PeriodicRestartRequests event triggers: The process is recycled and the PeriodicRestartTime and PeriodicRestartRequests internal timers are reset to zero.
- When the PeriodicRestartSchedule event triggers: The process is recycled and the PeriodicRestartTime and PeriodicRestartRequests internal timers are reset to zero. The PeriodicRestartSchedule event is based on clock time and is not reset, or affected by the other two events.
Important The internal timers only read from the metabase, they do not reset the metabase values. Do not confuse the internal timers with the default metabase key parameters.
Note The default metabase key parameters for the PeriodicRestartTime and PeriodicRestartRequests is zero, thereby disabling these features. The PeriodicRestartSchedule event is not configured at all by default. The Levels and Inheritance topic describes the metabase keys that are associated with Process Recycling events in detail.
For information about configuring Process Recycling events, see Configuring Recycling Events. For information about configuration levels and inheritance, see Levels and Inheritance.
The following resources provide related information:
- About Applications Conceptial information about applications, their starting point, and about the different processes an application can run in.
- Isolating Applications Step-by-step instruction about how to configure an application to run in different processes.
© 1997-2001 Microsoft Corporation. All rights reserved.