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



Question:

w3wp.exe is showing 99% CPU usage. What are the best ways to investigate the cause of this high CPU usage?


Solution:1

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.


Solution:2

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.


Solution:3

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


Solution:4

I've had this problem intermittently before. It seems to spike to 99% after the first request and never comes down. If I kill the process the new worker process usually behaves correctly. I've never figured out why this happens.


Solution:5

We're having the same issue Greg notes above. We're just killing those processes. Didn't observe this on IIS6/windows server 2003, only on IIS7/windows server 2008.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »