Leansentry Recycle diagnostics track the causes of recycling in your web stack, to help you improve performance by eliminating unnecessary, expected, excessive, or inefficient recycling.
This includes:
1. Application pool recycling
2. ASP.NET application/appdomain restarts
Why is this important
When an application pool recycles, IIS will start another worker process to handle future requests to the websites serviced by the application pool. The new worker process must initialize web applications before they can begin servicing incoming requests.
This has the following impact:
1. Initialization overhead. Application startup can place additional overhead on the server due to potentially expensive application init logic.
2. Startup request delays. Incoming requests must wait for the application to initialize, which can create a long delay for applications with a long startup path.
3. Excessive Memory usage. While the old worker process is shutting down, its possible to have both the new and the old worker process alive at the same time, potentially doubling the memory demands on the system.
Diagnosing recycling and application restarts
Use the LeanSentry Recycle diagnostics to identify the causes of recycling at both the application pool, and application level.
You can view the details for each recycle and restart, as well as recommendations for how to improve your recycling strategy.
LeanSentry will provide additional information to help you optimize recycling behavior, including:
1. Attributing the ASP.NET application restarts to the corresponding application pool recycle that caused it, including the reason for the recycle
2. Estimating the "impact" of each recycle/restart by the number of requests that had to wait for the new application to start up, and the wait duration. This can help pinpoint the recycles that have particularly high performance cost.
3. Providing recommendations for optimizing your recycle strategy.
Enabling Recycle diagnostics
To allow Recycle diagnostics to be enabled automatically, you have to allow LeanSentry to make a configuration changes to your server.
To allow this:
1. Go to your Environment settings,
2. Click "show/hide environment settings",
3. Click the "Other" tab,
4. Check the "Allow LeanSentry to modify IIS configuration" and
5. click "Save" at the bottom of the settings.
NOTE: These changes are minimal and are only performed one time. Your application pools MAY recycle when you first allow configuration changes, due to a one-time configuration change being detected by your worker process. As a result, some customers prefer to do this during off-peak hours.
You can also disable Recycle diagnostics in your environment settings if you wish, although there is no benefit for doing so.
Data quality warning
If you do not have Recycle diagnostics enabled, or if LeanSentry is not allowed to make configuration changes, or encounters trouble saving the configuration change necessary to monitor recycling, you will see a suggestion to enable it in your data quality checklist.
Follow the suggestion/information provided to enable recycle diagnostics. If you are receiving an error, please contact support for additional assistance.
Enable Application pool recycle monitoring manually
Please note that LeanSentry automatically configures these settings so no action is normally necessary. You CAN optionally enable Application pool recycle monitoring and ASP.NET application restart monitoring yourself via inetmgr.exe or by editing IIS configuration.
1. InetMgr.exe: Select the "Application Pools" node, click "Set Application Pool Defaults", expand the "Generate Recycle Event Log Entry" property and enable all recycle events.
NOTE: You may need to set this for each specific application pool that explicitly configures these settings (and does not inherit the defaults).
2. In applicationHost.config: Set the <recycling> logEventOnRecycle attribute for the application pool defaults, and for each specific application pool that explicitly specifies the logEventOnRecycle property.
NOTE: You may need to set this for each specific application pool that explicitly configures these settings (and does not inherit the defaults).
<system.applicationHost>
<applicationPools>
<applicationPoolDefaults managedRuntimeVersion="v4.0">
<recycling logEventOnRecycle="Time, Requests, Schedule, Memory, IsapiUnhealthy, OnDemand, ConfigChange, PrivateMemory" />
</applicationPoolDefaults>
</applicationPools>
<system.applicationHost>
Enable ASP.NET application restart monitoring manually
To enable the ASP.NET application restart monitoring manually, you will need to edit the configuration for the corresponding ASP.NET Framework's root web.config. This file is typically located in the following directory:
c:\windows\Microsoft.NET\Framework\v2.0.50727\config [.NET v2, 3.5, 32 bit]
c:\windows\Microsoft.NET\Framework64\v2.0.50727\config [.NET v2, 3.5, 64 bit]
c:\windows\Microsoft.NET\Framework\v4.0.30319\config [.NET 4.0+, 32 bit]
c:\windows\Microsoft.NET\Framework64\v4.0.30319\config [.NET 4.0+, 64 bit]
You will then need to make sure the following entries are added to the <healthMonitoring> configuration section:
<healthMonitoring>
<rules>
<add eventName="Application Lifetime Events" maxLimit="Infinite" minInstances="1" minInterval="00:00:00" name="LeanSentry - Application Lifetime Events - EventLogProvider" profile="Critical" provider="EventLogProvider" />
</rules>
<eventMappings>
<add name="Application Lifetime Events" type="System.Web.Management.WebApplicationLifetimeEvent,System.Web,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" endEventCode="2147483647" />
</eventMappings>
</healthMonitoring>
Common questions and answers
I do not want LeanSentry to modify my IIS configuration
In rare cases, you may want to prevent LeanSentry from modifying IIS configuration due to a concern about application pool recycling, or if you want each change to be explicitly approved. If so, simply do not enable the "Allow LeanSentry to make configuration changes" checkbox, and make the changes manually when/as needed.
I am not seeing recycle events for my application pool, or I am not seeing application restart events for my application
Check the diagnostic quality checklist, and:
1. Make sure Recycle diagnostics are enabled in your environment settings (default)
2. If your application pool sets explicit recycle settings, make sure its configuration enables all recycle events.
3. If your application configures specific Health monitoring rules, make sure its configuration enables the required rules for application lifetime events.
LeanSentry reports a configuration error while trying to configure IIS to allow recycle monitoring (in the data quality checklist)
Please forward the error you are seeing to support to receive additional assistance.
Comments
0 comments
Article is closed for comments.