Visit Heroix at http://www.heroix.com
Subscribe to the Heroix eNewsletter
Visit Heroix at http://www.heroix.com
Charting Life in the IT Environment

>> Monitoring Your IIS Application Pools

by Chris Smith on October 9, 2009

I had intended to begin a new theme in October, but I got an inquiry from a customer last week for which the answer may help others, and it definitely fits into the Free Stuff theme. It can be extremely difficult to understand and solve problems for mission critical IIS applications without a good view of application pool use. IIS7 makes the process of application pool monitoring and recovery very easy in the IISMgr interface. You have access to modify the Process Model in detail. In IIS6 and below, the application pools appear as w3wp.exe processes in Task Manager. But it’s not clear which w3wp.exe process represents which application pool. Fortunately, Microsoft again provides a VBS script to figure that out. That’s just half the battle, though. Once we know the specific process that supports each application pool we want to get some detailed process statistics. We could populate several WMI queries with the process PIDs, but an easier, more efficient method is to download and install Microsoft’s Sysinternals PsList.exe utility. It’s free and provides all the process and thread information we’ll want.

How do we identify our application pool processes?

For IIS6 and below, begin setting up your application pool monitoring by ensuring we can run the IISAPP.VBS script on the monitored system. You either have to wrap the call to the script in the command that executes CScript, or you have to set CScript as the default scripting language. For example,

  • Call CScript in front of the script name: cscript iisapp.vbs //NOLOGO
  • Set CScript as the default: CScript //H:cscript //NOLOGO //S

Now we can run the iisapp.vbs script to identify the application pool processes. The parameters for the script are /a, ApplicationPoolName and /p, PID, like this:

W3wp.exe PID: 2232 AppPoolID: DefaultAppPool
W3wp.exe PID: 1160 AppPoolID: MyAppPool

NB: If you have more than one process for each pool, you probably have Web Garden (multiple worker processes) enabled, and should seriously evaluate if this provides any benefit.

So if MyApp is the pool I care about I know its PID is 1160, and we can move on to step two.

For IIS7 on Windows Server 2008 life is much easier. You can view the application pools in the tree view of IISMgr. From the command line, issue the following command:

%windir%\system32\inetsrv\appcmd list apppool

From the IISMgr interface, you can right-click on each application pool and set up ping and recovery parameters, process model details, security, and more.

TIP: You want to create separate application pools in IIS for each application. This prevents one application’s pool problem from taking down all applications. Plus, it makes it easier to do detailed workload characterization on each application.

How do we get statistics for our IIS6 application pool processes?

Here’s where we use Sysinternals’ PsList.exe to get information on IIS6 application pool processes. There are many parameters, or arguments, but the important ones for us are:

  • -X; Shows process, memory, and thread information.
  • PID; For example, PsList.exe -x 1160; we don’t actually include “PID” in the command, so it’s implied that the number following the command is a PID.

The results of the command above look like this:

C:\Windows\system32>pslist -x 1160

pslist v1.28 - Sysinternals PsList
Copyright - 2000-2004 Mark Russinovich
Sysinternals

Process and thread information for STUDIO:

Name Pid Pri Thd Hnd Priv CPU Time Elapsed Time
w3wp 1160 8 18 276 12020 0:00:00.483 1:23:57.316
VM WS Priv Priv Pk Faults NonP Page
115204 20500 12020 12892 7141 41 189
Tid Pri Cswtch State User Time Kernel Time Elapsed Time
1164 10 66 Wait:Executive 0:00:00.000 0:00:00.015 1:23:57.316
1176 10 64 Wait:UserReq 0:00:00.000 0:00:00.000 1:23:57.303
1188 10 6063 Wait:UserReq 0:00:00.000 0:00:00.046 1:23:57.293

At the top of the output are the statistics for the w3wp process. Below follows a summary for each thread, including its Context Switches, Current State, User CPU Time, Kernel CPU Time, and Total Elapsed Time. This is all the information we’ll need.

For more Information

Diagnosing Application Pool crashes and hangs

Managing IIS7 Application Pools

Share this post:
  • E-mail this story to a friend!
  • StumbleUpon
  • Digg
  • del.icio.us
  • Facebook
  • LinkedIn
  • Google
  • Furl

[Post to Twitter] 

No Comments »

No comments yet.

RSS feed for comments on this post. RSS must be enabled on your computer.

TrackBack URI

Leave a comment

© 2010 Heroix | Heroix | RSS | Privacy Policy | Email: info@heroix.com