Troubleshooting w3wp high CPU usage
So you have your IIS web server that has really high CPU usage with w3wp being the culprit. How do you go about finding out what is causing the actual issue? You should start with opening your IIS manager and going to your Worker processes. From here you should be able to see what Application is using the high CPU usage. Once you which application is causing the high CPU usage such as ASP.NET 1.1 you will click on it to view the requests. From here you can see all the requests that are being made to the application. To print this information to file, so you can look at it in your leisure and get your site back up and running optimally. Open PowerShell and run the following commands:
Appcmd list requests | out-file –filepath C:\[wherever you want to put it]
Understand the output
URL – the complete URL that was being executed.
Time – the total amount of time, in milliseconds, the web request has been executing.
Client – the address of the user that initiated the request.
Stage – the stage of the IIS pipeline that the request is currently in.
Module – the ASP.NET module that is currently executing.
What to pay attention to:
Are all of the requests for the same URL? Perhaps that URL is the source of the problem.
Is a high number of requests coming from the same client? Perhaps a specific user is slamming your web server with traffic.
Are all the requests stuck in the same stage or module? There could be a problem with requests getting hung in that specific step of the IIS pipeline.
Likely reasons for high CPU usage are:
- High error rates within your ASP.NET web application
- Increase in web traffic causing high CPU
- Problems with application dependencies
- Garbage collection
- Requests getting blocked or hung somewhere in the ASP.NET pipeline
- Inefficient .NET code that needs to be optimized
The quick fix
Now the quick fix is to go under the IIS manager and go to application pools click on the application, right-click on ASP.NET 1.1 and click recycle. This will start a new application instance and clean up the old one getting rid of the requests that were in the old instance. Now your CPU usage should be good to go.