App Pools Gone Mad!

IIS.  I’m not a fan.  But it’s a requirement where I work, so there you go.  Occasionally one of our IIS servers will slow to a crawl or stop responding altogether.  Often it’s a application pool run amok.  An app pool is essentially a container that holds the processes of a web application.  And if your web application isn’t written well, and doesn’t have decent controls in it, it can go nuts.  If someone can, say run an open ended database query with the potential to return a bajillion records because your app doesn’t disallow this sort of irresponsible behavior, the app pool containing that process is going to fill. And fill. And fill, eventually gobbling all  your processor cycles. An easy way to discern this is if the process w3wp.exe is pegging your CPU at 99%.  Find this in Task Manager.

Here, shown on 2008, is a quick way to locate that offending app pool and smack it down.

First, figure out which app pool it is.  Every running process in Windows has a PID, or process ID.  Open Task Manager, make sure you’ve selected to show PID in the columns (View>Columns>PID), and find the offending w3wp.exe pegging the proc.  Take note of the PID:


Open a CMD prompt and run appcmd list wp (you might have to run this from the c:\windows\system32\inetsrv dir if environment variables aren’t set for it):


Match your PIDs.  Now open IIS and drill down into the app pools.  Play with that app pool.  You can try cycling it, but that rarely works for me.  Usually stopping it does.  Once you stop it, watch Task Manager and wait for it to disappear before restarting.  It needs time to “drain,” or wrap up whatever it was doing to end gracefully.  This can take a couple of minutes.  Then flip it back on and see how it goes.  If it really gummed up the works you may have to restart the site as well.


Post a comment

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">