Restart IIS Application Pool when CPU is 100%

This topic contains 2 replies, has 3 voices, and was last updated by Profile photo of Don Jones Don Jones 5 months, 2 weeks ago.

  • Author
    Posts
  • #44288
    Profile photo of Imran Safi
    Imran Safi
    Participant

    Hi,

    Can someone help me out with a script that when CPU on server is 100% due to some crazy application pools so the script recycle the application pools that is listed or mention in the script.

    For example if I have a application pool called app01 app02 app03 so the CPU is very high and I already know its due to these 3 app pool so they should be recycle.

    Thanks in advance.

  • #44302
    Profile photo of Arie H
    Arie H
    Participant

    IIS management has those options of limiting the threshold for when it should recycle the pool
    you can set it per RAM, per CPU usage, and more options.

    while doing it in PS is a nice exercise, I think if the product already gives you the options built-in, you should use it first.

    Could try http://thoughtsofmarcus.blogspot.co.il/2011/01/recycle-iis-application-pools-using.html
    and http://powershell.com/cs/forums/p/17675/36508.aspx

    Edit: you should also be looking at other factors if your app pools behave like that, starting from hardware issues (memory) or usually better coding needed ofr the web site and more

    • This reply was modified 5 months, 2 weeks ago by Profile photo of Arie H Arie H.
    • This reply was modified 5 months, 2 weeks ago by Profile photo of Arie H Arie H.
    • This reply was modified 5 months, 2 weeks ago by Profile photo of Arie H Arie H.
  • #44318
    Profile photo of Don Jones
    Don Jones
    Keymaster

    I'll add my $.02, which is that PowerShell isn't designed for this kind of long-term, ongoing monitoring-and-reaction. You would need a proper monitoring system, like SCOM, which could run PowerShell scripts as needed to react to the current situation.

You must be logged in to reply to this topic.