Do you experience poor IIS performance? Does w3wp.exe use a lot of CPU power? How can the high CPU usage of the IIS Worker Process be troubleshooted?

We’ll go over some strategies in this post to figure out why your ASP.NET web applications are using a lot of CPU power.

There are numerous reasons why w3wp.exe, your IIS worker process, might be consuming a lot of CPU power. We’ll go over some of the most common causes and how to fix issues with IIS performance.

In order to troubleshoot the IIS worker process, you should first see which web requests are currently executing with IIS and see if that helps you identify the problem.

How to See Active Internet Requests in IIS

Identifying the web requests that are presently being executed ought to be among your initial priorities. This could assist you in determining which particular URL is the source of the issue.

It’s possible that you will identify one of the URLs that is notorious for taking a very long time or causing high CPU problems.

On the other hand, this might also display a number of pending web requests rather than taking you straight to the source.

Via the IIS User Interface

Viewing the active worker processes is possible through the IIS management console. You can see which IIS application pool is using a lot of CPU time as well as the web requests that are presently active.

You can view the IIS worker processes that are currently active by choosing “Worker Processes” from the main IIS menu.

A worker process’s executing requests can all be seen by double-clicking on it.

A sample from one of our servers is provided here. As you can see, every request is presently executing a different HTTP module and is situated in a different section of the ASP.NET pipeline.

Via Command Line

The currently active web requests is just one of the many uses for the appcmd.exe utility.

C:\Windows\System32\inetsrv>appcmd list requests
REQUEST "f20000048000021c" (url:GET /nopcommerce, time:6312 msec, client:localhost, stage:BeginRequest, module:IIS Web Core)

Understanding The Results & Things to Look For

Using the command line or IIS user interface, you can see which web requests are active at any given time. It returns the same data in either case.

  • 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.

When reviewing the requests, there are a few things you should be aware of.

  • Does each request point to the same URL? It’s possible that the issue originated from that URL.
  • Do a lot of requests originate from the same customer? Maybe a particular user is overloading your web server with requests.
  • Do all of the requests remain in the same module or stage? Requests hanging at that particular IIS pipeline stage might be the cause of the issue.

6 Typical Reasons and Solutions for IIS Worker Process High CPU

There are numerous reasons why the CPU usage of the IIS Worker Process, w3wp.exe, may be high. I’ll be discussing six prevalent causes in this post:

 1. High Error Rates Within Your ASP.NET Web Application

It’s possible that your application has application errors and you are unaware of them. Your users may receive an error message of some kind when there are certain errors. There could be more mistakes made without anyone noticing.

Make sure to check any application performance management or error monitoring tools you use for high error rates.

You can check Windows Event Viewer, IIS Logs, and other places for application error rates and actual errors.

Windows Performance Counters for Error Rates

I would advise looking over two particular performance counters for high error rates. By adding the counters to the chart view and launching Performance Monitor in Windows, you can verify these.

  • .NET CLR Exceptions -> # of Exceps Thrown / sec: Examine this to determine whether your application is throwing a lot of exceptions. Your application may contain numerous hidden errors that could seriously impair performance.Though some exceptions cannot be avoided, they are still undesirable.
  • W3SVC_W3WP -> % 500 HTTP Response Sent: A 500 status code indicates an internal server error for any requests. Ensure that this percentage is extremely low. It ought to be between 0% and 1%.

2. Growing Web Traffic Resulting in High CPU IIS Worker Process

An increase in web traffic is one of the easiest explanations for the high CPU usage of w3wp.exe. However, it can be challenging to determine whether traffic has increased if you don’t have a baseline for your typical volume of traffic.

Make sure to check your application monitoring tool to see if the traffic levels have changed, if you are using one.

You could try determining whether traffic levels have changed using your IIS log files if you have no other way to know.

To query them, use Log Parser Lizard or VisualLogParser.

To view the current traffic rates in real time, there are additional Windows performance counters for Requests / Sec and Requests Current.

Possible Reasons for Higher Web Traffic

If traffic is increasing, consider whether it should be. Consider the following when considering elevated traffic levels:

  • Client or user: Is there a notable increase in traffic coming from a particular user, client, or source? It’s possible that something isn’t accessing your website properly. Perhaps you should block a particular IP address.
  • Bots: It might be a bot, much like a particular user generating a lot of traffic. Examine the user agents in your IIS logs that are being used to visit your website.
  • Oprah effect: Has anyone mentioned your products, including Oprah? Have you recently gone viral? It’s great to receive a lot of attention, but you might have to increase your capacity to manage it.

You might need to scale out (add more servers) or scale up (get a bigger server) if your website is seeing a lot more traffic.

But traffic might not be the issue if your website receives a small number of requests every second.

Ten to thirty requests are made per second by many ASP.NET applications. On the other hand, I have also observed light web requests making more than 100 requests per second on busy apps.

There is a wide range in both the amount of traffic and CPU usage between different web apps. Everything depends on your particular application.

How to Spot Pricey Online Requests

You can monitor the overall performance of your application over time by using an APM solution like Retrace. Additionally, it can inform you of the precise web requests that take the longest.

APM tools analyze your application’s performance right down to the code level using methods such as.NET profilers and other data collection techniques.

You might be able to pinpoint the source of your high CPU usage problem or pinpoint areas of your application that need performance optimization by determining which web requests are consuming the longest.

3. Problems With Application Dependencies

Web apps of today make extensive use of a wide range of external dependencies and services. SQL, NoSQL, caching, queuing, and numerous external HTTP web services are among them.

Any application dependency that slows down can lead to issues with your application’s performance.Slow SQL queries and issues with external HTTP web services are the most frequent issues.

Retrace or another APM tool is needed to track your application’s performance to this extent. Retrace monitors your application’s performance right down to the code level. It can assist you in rapidly determining web service calls, slow SQL queries, and much more.

4. Garbage Collection

Garbage collection is used by Microsoft.NET to control memory allocation and release.

The allocation and cleanup of application memory may result in a significant amount of garbage collection activity, depending on the functionality of your application. Garbage collection issues arise, for instance, when numerous large string variables are used on a large object heap.

Use this Windows Performance Counter to see whether garbage collection is interfering with your application.

.NET CLR Memory -> % Time in GC: This counter shows the percentage of time that is spent on garbage collection by your application. Should this figure significantly rise above 5–10%, you should look into memory usage in more detail.

Garbage collection also has two modes. You may need to enable server mode, which is not the default.

5. The ASP.NET Pipeline is blocking and hanging requests.

An ASP.NET request’s lifecycle consists of numerous steps. This covers fundamental actions such as initiating the request, authenticating, granting access, determining the appropriate HTTP handler, and concluding the request. Numerous standard and bespoke HTTP modules could be used in this context.

I started by showing you how to view the web requests that are presently running.


I would advise checking to see if all of the requests appear to be hanging on a single HTTP module if you are experiencing performance issues.

Both managed.NET code and native code can be used in HTTP modules. These could be common.NET modules like SessionStateModule or FormsAuthentication. A lot of apps also make use of proprietary or third-party HTTP modules.

Are You Using Sessions?

The majority of people are unaware of how much ASP.NET sessions slow down system performance.

They cause your IIS worker process to retrieve your session object upon page load, lock it, and then release it upon request completion.

Sessions can create a bottleneck in your application by causing locking.

Your application’s performance will be affected by any performance lags if you are using a session provider like SQL or Redis.

6. Ineffective.NET Code That Requires Optimization

It may be necessary to go deeper into the code to make changes if none of the other common causes were the issue. To find out which methods are being called in your code and how long they take, you will need to use.NET code profilers.

You can find particularly slow methods in your code with the aid of profilers.

Be advised that profilers do increase your application’s overhead. The performance of your application will deteriorate and profiling will be extremely slow if your application is already running at a high CPU usage rate (90+%).

Depending on the degree of detail you are profiling and the CPU usage prior to starting the profiling, this could render your application unusable.

Conclusion

It is hoped that you are reading this in an effort to learn how to perform better. I hope you’re rushing and your server isn’t running at 100%!

We spend a lot of time working on and considering application performance issues as an APM solution provider. We hope that the IIS Worker Process (w3wp.exe) troubleshooting guide has been useful.

Leave a comment

Your email address will not be published. Required fields are marked *