Posts Tagged ‘Performance Monitor’

Worker Process Instance and Process ID

September 17, 2009 2 comments

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.


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.


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.


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.


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


Happy monitoring!


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: