I would like to automatically stop/start or recycle the app pool when it reaches 80% of CPU usage for a certain period of time.
I see that under app pool Advanced Settings, there is a CPU section and it has Limit (percent)
, Limit Action
and Limit Interval (minutes)
properties.
What happens when I set the following?
`Limit Action` to `KillW3wp`
`Limit (percent)` to 80%
`Limit Interval (minutes)` to 1.
According to the documentation, the application pool is shut down for the duration of the reset interval
. Does this mean that if the app pool has a momentary spike to 80% it is immediately killed and restarted in 1 minute?
What I would like to have happened is if the CPU is > 80% for a minute or longer, the app pool is killed and a new one is created immediately (basically overlapped recycle). Is that possible?
P.S. I did some research and testing and here is what I found - in case someone else needs these features.
If your process is over Limit (percent)
for period of Limit Interval (minutes)
, IIS will send a shutdown signal. If your process doesn't respond to it and shutdown peacefully, IIS will wait for period indicated in Application Pool Advanced Settings: Process Model / Shutdown Time Limit (seconds)
and then forcefully shut it down. There will typically be entries in the Event Viewer describing what it's doing.
Note that in my experience, the timings were extremely approximate. Sometimes IIS would carry out its actions down to the second. But mostly they were off by up to a minute.