Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How to handle application pools which uses too much memory or CPU? I would like to have possibility to select for how much time application pool is using certain amount of memory or cpu (or both) before it will be recycled. Any idea how to achieve this? IIS7 allows to kill app pool when it reaches some level of CPU usage but I'm interested in recycling it.

Thanks

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Have you tried setting the Recycling Conditions for your app pool? You can configure IIS to recycle the app pool at fixed intervals, fixed number of requests, at specific time or at certain memory thresholds.

  1. Run inetmgr
  2. In the Connections pane, expand the server name, and then click Application Pools
  3. Select desired application pool
  4. In the Actions pane, click Recycling

This will not recycle based on cpu usage though, but at least you can have the app pool recycled at certain intervals.

That said, I don't think that you should need to recycle the app pool under normal circumstances. If you need to do this very often, I'd say you either have a "bad" application or you need to give the application more resources.

share|improve this answer
    
Recycling in Actions is not covering scenario with high CPU usage. In my hosting environment when app uses too much CPU it's quite hard to explain some customer that his app is "bad". Especially when he only is using it (programmed by someone else). Disabling this app of course will cause phone to ringht right away with questions like "WTF my site is not working ..." etc. So I would like to have all wrong app pools using too much CPU over some period of time to be recycled only. I don't want to disable them when they use too much CPU but just recycle. –  GrZeCh Apr 14 '11 at 11:29
    
I guess you would have to solve this with some kind of whatchdog that is using appcmd for controlling the app pool. This whatchdog can be made using powershell f.ex.. The syntax for recycling an app pool is appcmd recycle apppool /apppool.name: [App pool name]. To list running processes in IIS, you can use the appcmd list wps command. From that command you get the PID for the process. This PID can later be used to obtain CPU usage by using the get-process command in Powershell f.ex.. –  Nils Magne Lunde Apr 14 '11 at 12:11
    
I was thinking about it but I was hoping it can be done easier. Thank you. –  GrZeCh Apr 14 '11 at 16:01
add comment

Windows Server Resource Manager is recommended while installing IIS. It's included with some Windows Server editions - check out your Features list to see if it's there.

This utility is application pool aware, and lets you limit CPU and working set for application pools.

This is less destructive than a CPU consumption-based recycle trigger, but needs careful setup. It typically only makes a difference when one app pool is overconsuming, which sounds like your situation; it might be worth checking out.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.