The Windows Performance Monitor (perfmon) is a useful tool to capture run-time performance metrics such as CPU utilisation, .NET GC runs etc.
Problem
The IIS web applications execute on multiple"w3wp" processes and it can be difficult to profile a single web application using perfmon. Perfmon simply name each process as "w3wp#1", "w3wp#2", which is not helpful at all!.
Multiple w3wp processes in perfmon |
The goal of this post is to help identify the relevant "w3wp" process and map it back to the application pool.
Step 1 : Find the Process Id of the application pool process
Navigate to C:\Windows\System32\inetsvr folder and issue the command in the following screen capture. (appcmd list wp).
Finding out Process Id per application pool |
Step 2: Add the requisite performance metric to perfmon
Simply add the metric to perfmon. I have added the CPU utilisation and most importantly the process Id. The process Id can be found under "Process" category.
Adding CPU utilisation with process Id |
Step 3: Monitor the metric added in Step 2
The sample metric looks like below:
Captured metric in perfmon |
Concerns
What if there are dozens of web application in IIS? The steps discussed here are for a simple case and does not scale well unfortunately. However I have seen some answers in StackOverflow that suggest to modify few registry keys that can provide a more meaningful name.
I do see that perfmon is not the best tool for performance monitoring. But I do think it is not too bad once you get use to it. (I do prefer dotTrace!).