One of the types of performance problems that can occur with IIS web applications is when the process hosting the web application (in IIS6 in Worker Process Isolation Mode it is w3wp.exe) spins up the CPU utilization of the server. Usually this is associated with end users experiencing a long period of waiting for the web content to be displayed in their web browsers. This scenario is generally referred to as a "high CPU hang".
Troubleshooting high CPU hang problems can be done with two tools: Performance Monitor, and a debugger. We use Performance Monitor to get a 'perfmon' log of the high cpu behavior, and we use the debugger to get a hang dump of the process that is spiking the cpu. Then we analyze the info in the perfmon log and associate it with the info in the debug dump file. Debugging user-mode dumps is a whole topic in and of itself which I won't cover in depth here. Instead the emphasis here is on getting the right data at the right time to actually analyse. In Part 2 of this topic I'll go through a sample analysis of a high CPU scenario.
HOW DO I SET UP PERFMON TO GET THE RIGHT DATA? Following these steps should get you the right data (and not much useless data that would confuse things) in perfmon:
1. In Performance Monitor, expand "Performance Logs and Alerts"
2. Right Click on "Counter Logs"
3. Choose "New Log Settings..."
4. Enter a descriptive name
5. Note the log file location for later (or go to the "Log Files" tab and change the location)
6. Click the "Add Counters" button
7. Click the "All Counters" radio button. Click the “Select instances from list” radio button, and select the process hosting the IIS or ASP.net application. On Windows 2000 and Windows XP, this will be inetinfo, dllhost, or aspnet_wp . On Windows 2003 this will be w3wp. NOTE: It is possible you will see multiple instances of dllhost on IIS5/5.1 or w3wp on IIS6 in the list of available processes. If you do, or if you are unsure of which process to monitor, please cltrl-click to multiselect all of the available IIS/ASP.net choices.
8. If the application is not an ASP.net application, select the following from the "Performance Object" dropdown, being sure to "Add" each one as you select it: