Home > IIS6.0, Performance, Web > Worker Process Instance and Process ID

Worker Process Instance and Process ID


Today we wanted to monitor the number of exceptions thrown by our application. We have separate application pools for each application and we have more than one website running in our server.

There is an excellent counter “# of exceptions thrown” listed under “.Net CLR Exceptions” performance object to just monitor the number of exceptions thrown by the application.You can see this in PerfMon.

In case if you don’t know what PerfMon is and how to use PerfMon, have a look here.

Perfmon is a tool performance monitoring utility which you will find in c:windowssystem32 or c:windowssyswow64 (for 64 bit machines).

When we tried to add this counter to PerfMon we were confused to see the list of instances appeared in the “Add Counters” dialog.

image001

As you see in the above window there are 2 instances shown. One is W3WP and another one is W3WP#1. How are we supposed to know which worker process belongs to our application that we wanted to monitor?

There is a way to find it out. Since worker process is a Process it must have a process id. It is possible to associate a process id to the weird names like w3wp#1 that we see in the instance list.

image004

Select Process from the performance object and select ID Process in the counter list. You can see the available worker process in the list shown in “select instances” list. Select them. Now in the PerfMon you will be able to see w3wp and w3wp#1 with their respective process id as shown below.

image005

So now we have Process ID for each worker process. But how do we relate this Process ID with our application? There is a way.

Microsoft has provided some script files (available in windowssystem32) by default that helps in lot of ways. One of them is iisapp.vbs.

When we run this vbs in command prompt we can find the worker process, process id and the app pool id as shown below.

image007

Using the AppPoolID we can relate to our respective website then to our application.

This trick also helps us in some cases where we have more than one worker process running in the server and we need to monitor the memory usage for them. In the below image, there are 2 w3wp processes running. How to distinguish between these 2 worker process? Use the process id column available in the task manager “processes” tab and link this process id with the output given by iisapp.vbs

image010

Happy monitoring!

Update

I stumbled up on this Stackoverflow question that is exactly the same as what we are discussing here. Instead of going through all the above said process, you could just change some registry settings to see the process# in the format of process_pid. Check out this KB 281884:

By default, Performance Monitor (Perfmon.msc) displays multiple processes that have the same name by enumerating the processes in the following way:

Process#1 Process#2 Process#3

Performance Monitor can also display these processes by appending the process ID (PID) to the name in the following way:

Process_PID

About these ads
  1. January 27, 2010 at 4:57 am | #1

    Great site, I will be back. Well done

  2. gene
    January 26, 2011 at 8:47 pm | #2

    Hi, thanks for the useful article. I just checked the ID Process on my box and I only saw w3wp. I then launched the browser and my .net application and w3wp#1 appeared. Then I launched another application from a different pool and w3wp#2 appeared. Now, I have a performance log that I setup for all 3 w3wp instances. This means that they may not always mean the same depending on which app pool started up first and began processing. If I restart iis, the working set for w3wp depends on the order. Is that your understanding too?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: