What application pool is using all that CPU?

One of the things I like to blog about are the simple little tips and scripts that shave a few seconds of minutes off a simple task. As I’m working more and more with IIS7.5 in Windows Server 2008 R2, I’m finding ways to save more and more time.

Have you ever had an out of control IIS Worker Process and needed to know what application it is fast? The server CPU is maxed at 100% or the memory usage is peaking. You open up Task Manager and you see an AWOL w3wp.exe process.

The quickest method of identifying the application pool is to cross check the process’ PID (process identifier) against the appcmd.exe output. Fastest way is as follows.

Open task manager, click View > Select Columns:

Enable the PID column:

Reference the PID of the out of control w3wp.exe worker process (I know my example isn’t out of control but it makes my point):

Using appcmd.exe (C:\Windows\System32\inetsrv\appcmd.exe) one can run the following command:

However the inetsrv directory isn’t in the environmental PATH variable by default and the command is long-winded to type. I prefer the following method.

Every web server I logon to has a prepared “tools” directory where a collection of time saving scripts are kept. One of the many is the listwp.bat script:

Summary of commands:

  • @echo off – Simply hides the following commands from the prompt when the batch file is run. Merely keeps things looking nice.
  • C:\Windows\System32\inetsrv\appcmd.exe list wps – Prints to the screen a list of IIS worker processes that you can cross check the PID against an application pool.

You can simply now run this script to get the output you require:

So you know the PID, to locate the application pool, which you can use to identify the offending website or applications causing your server to overload.

Similar Posts:

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Tags: , , .

What are your thoughts?