How can I investigate 99% CPU usage by w3wp.exe?

Attach WinDbg + sos and run !runaway. That will show you which thread is taking the most CPU time. Do a !clrstack on the thread to find out what it is doing.


Other suggestion of tools is DebugDiag, see more here
[UPDATE] Use ProcDump, see more at Using ProcDump.exe to monitor w3wp.exe for CPU spikes.


w3wp.exe is the ASP.NET worker process, so if it is using a high percentage of the server's CPU, it is the ASP.NET application that is causing the problem. However, this does not necessarily indicate that there is a problem with the ASP.NET application. It may be serving too many requests with limited resources. The only real measure is to check the CPU usage against the amount of traffic being handled by the application.

If you are suspecting that a certain request takes too long, you could can use the Logparser command line utility to analyze your logfiles and find which page has a long execution time.

c:\>logparser "select top 10 cs-uri-stem, time-taken from INSERT_YOUR_IIS_LOG_FILE_NAME.log group by cs-uri-stem order by time-taken desc" -q:on

You could also use a tool to show which pages are currently executing, like IISPeek (not free).

If you want to go deeper, try to understand hwo to use WinDbg. Here is a good tutorial: Windows Debuggers: Part 1: A WinDbg Tutorial