W3wp.exe (IIS) CPU usage of 100% common causes and solutions

Source: Internet
Author: User

For IIS administrators, the CPU usage of web servers is usually 100%. The following is a summary of my daily work and some solutions, which are mainly used to analyze w3wp.exe (IIS) some reasons and solutions for CPU usage of 100% may help you

 

Description of w3wp.exe: full name, IIS application pool process. W3wp.exe is part of the IIS tool. Worker. This process is used to allocate a large amount of system resources.

 

The common causes of w3wp.exe (IIS) CPU usage of 100% are as follows:

 

1. High web traffic, resulting from high server pressure

 

This is also the most common situation. If the amount of web traffic is high, especially when the number of concurrent online users is large, and the number of requests current (current number of requests) processed is too high, it will put a lot of pressure on IIS and the server at the same time. In particular, servers need to constantly perform operations to send generated pages to the client, which all occupy a large amount of CPU resources, resulting in 100% CPU

 

2. complexity of program logic of dynamic pages (. aspx)

 

This problem is also very serious for the CPU usage of w3wp.exe. It may not affect much in the case of a small access volume, but for highly concurrent websites, especially ASP. when the current requests of net exceeds 250, it will be an important factor for w3wp.exe to occupy the CPU.

 

I have encountered a situation where two web sites (A and B) are deployed on two servers with equivalent configurations, and both sites have a high access volume, access pages are concentrated on two separate pages of the two sites, and the number of IIS connections between the two pages is about 50, but the complexity of the page program is a lot wrong, the page in Site, there are only a few simple repeater bindings, while pages in Site B have a large number of bindings, string filtering replacement, repeater nested bindings, and so on. In this case, when the number of IIS connections of Site A reaches more than 50% in a high-traffic and high-concurrency environment, the CPU usage is still about, when the number of IIS connections in Site B reaches about 7 kb, the CPU usage is more than 90%, which puts a lot of pressure on the server and causes IIS to be blocked.

 

3. There is an endless loop in the page program

 

If the web traffic is small but the CPU usage is high, the Program on the page must have an endless loop or a program statement with severe performance.

 

4. Sites downloaded through HTTP

 

If the site is an HTTP download site, w3wp.exe occupies 100% of the CPU

 

5. Server resources will not be automatically released

 

Sometimes, the traffic of a site increases sharply within one hour. As a result, the operating system allocates a lot of CPU resources, but when the traffic goes down, the CPU occupied by w3wp.exe is not released in time, and it is still above 90%.

 

6. Operations on IIS log files

 

For example, if you analyze the data in the IIS log file and import the IIS log to the database for moderate operations, this phenomenon will also occur.

 

Solution:

 

1. Quickly locate the problematic site

 

Use the iisapp-a command to quickly locate the site with the problem. If the current server only runs one web site, skip this step.

Enter iisapp-A in cmd and the following information will appear:

 

 

Of course, this requires that you have no site and have an independent application pool corresponding to it. The application pool name should preferably be the site name, for example:

 

 

About the application pool configuration of IIS, I won't talk about it here. If you don't understand it, you can search

 

Then open the task manager, such:

 

 

Observe that the process is w3wp.exe, check the CPU usage, and use its PID to compare the results listed in iisapp to easily find out that the CPU usage of the site is too high.

 

2. Restart IIS and application pool


This step is an emergency solution. Generally, it is a temporary step. If your site has a Server Load balancer (SLB and NLB), you need to remove the current server in the Server Load balancer (SLB and NLB) and restart it. If you do not have Server Load balancer (SLB and NLB), and your website is online, it will take more than 10 seconds. You cannot access it for a short time.

 

3. Add page-level cache to the page

 

If the web is an ASP. NET program, be sure to <% @ outputcache duration = "10" varybyparam = "NONE" %>. However, many users do not use outputcache, which leads to frequent page downloading problems. Therefore, they all gave up using it. Here is a solution for page downloading caused by outputcache.

 

Outputcache is very useful and has three advantages: Directly Reading pages from the memory, the page response speed is faster, and the user experience is better; it greatly reduces the pressure on the server, especially for highly concurrent websites, in particular, the CPU pressure reduces the DB's strength and the dB (database) pressure.

 

4. Check page logic

 

If the web traffic is low, but the CPU usage of w3wp.exe (IIS) is about 100%, check the code logic of the page, which may be caused by an endless loop or a large number of operations.

 

The preceding figure shows the common causes of 100% CPU usage in w3wp.exe (IIS) and the solution. If this is helpful to you, leave a message or click "recommended ".

Find yourself-2011/04/18-. net, C #, ASP. NET-starter blog

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.