W3wp.exe on a server that consumes too much CPU sometimes over 50% causes analysis _win Server

Source: Internet
Author: User
Tags cpu usage
Resolving Excessive CPU Usage:

1. Separate application pool configuration for each Web site in IIS. That does not affect each other.

2, set the application pool CPU monitoring, not more than 25% (server 4CPU), refresh every minute, when the limit is closed.

Which application pool is obtained according to W3WP:

1, in the task Manager to increase the display of the PID field. You can see the process PID that takes up memory or the highest CPU

2, run iisapp-a at the command prompt. Note that the first run, will be prompted without JS support, click OK. And then you can run it again. This allows you to see the application pool that the PID corresponds to. (Iisapp is actually stored in the C:windowssystem32 directory of a VBS script, full name for Iisapp.vbs, if you and I, as well as the VBS default associated program, then you need to manually to the directory, choose to open the way, and then select " Microsoft (R) Windows Based Script. Host to perform, you can get the PID and application pool of the corresponding relationship. )

3, to IIS to see the application pool of the Web site, OK, to make the above memory or CPU restrictions, or check the program has no dead loop and so on.

To resolve the memory footprint, you can configure the following:

1. Separate application pool configuration for each Web site in IIS. That does not affect each other.

2, set the application pool recovery time, the default is 1720 hours, can be modified according to the situation. Then set the memory to automatically recycle when the memory footprint is more than (500M).


My setup is as follows:

The first is the CPU limit: After CPU monitoring is enabled, I set the maximum CPU usage for this application pool to 50%. Set the refresh CPU time to 1 minutes and set the operation to "off". The maximum number of worker processes is set to 1. This means that the IIS refresh detects the CPU usage of the stand-alone pool for 1 minutes, and if the CPU limit of 50% is exceeded, an instruction is issued to turn off the pool, requiring the pool to shut down within a specified period of time. If the pool is successfully closed at this time, IIS restarts a new pool, which is very short and generally does not feel the same, the pool is reopened, and the people who visit the site basically will not feel. However, if the pool is not closed within a specified time, IIS will force it to shut down a flush CPU time. In this stop time, the website is unable to access, prompt "Service unavaliable".

Shutdown time and start interval settings: Set for a short period of time, such as 10 seconds, so that when your Web site program is heavily occupied with system resources, IIS automatically quickly reclaims the process and quickly start the process, your site can temporarily work on.

Restrictions on memory and process recovery time settings: I set to memory consumption of more than 800M automatically recycled memory, virtual memory is not limited. Process recovery time I keep the default unchanged. You can set a shorter time according to your own situation. The maximum virtual memory for the application pool can also be set here, exceeding the maximum set of virtual memory, and the pool will be reclaimed.

Finally, some experiences of the outdated WLMMC are summarized, and some problems needing attention are summed up:

1. To limit the CPU usage of a site, the site must be set up as a stand-alone application pool, and a single site cannot be restricted by a shared application pool. IIS standalone application pool requires a separate process that consumes memory very much. The more independent pools there are, the more w3wp processes there are. For each site to separate application pool server, in general ordinary P43.0 2G memory of ordinary servers, recommended not more than 50 sites, preferably 30 or less, otherwise the server pressure is very large. In the configuration, I generally use the resource to consume a larger site independent of a pool, general ordinary BBS or generate HTML system about 5 stations a pool. Common sites and some corporate sites share a pool.

2, according to WLMMC experience, in the case of server hardware, generally do not limit the use of site memory, so that the site can be guaranteed to run, the user will not appear out of line. You need to limit the maximum virtual memory of a station to less than 64M, or there may be some unknown error.

3, these are not the fundamental solution, its fundamental problem is that the Web site procedures have problems, to solve the fundamental problems to be checked from the program. According to the method mentioned at the beginning of this article, find the specific application pool, locate the Web site that uses this application pool, and troubleshoot problems with the site program, such as dead loops.

4, in addition to W3wp.exe, in the call database for a large number of query operations, will also be a large amount of CPU resources, this is inevitable (database aspects of the statement and structural optimization is not covered in this article). Personally, as long as the CPU is not a long time to occupy 100%, generally around 75% are normal.

Server running normally the cup should be under 60%, and sometimes the cup appears to fluctuate greatly, or the server is suddenly very card, or very slow. View Task Manager, you can find a lot of w3wp.exe consumed CPU, immediately after the end of a new w3wp.exe appear to occupy the CPU, admin in this case. You have to restart the IIS service, oddly enough, after restarting the IIS service, everything is fine, but it may be some time before the problem comes up again.

Direct reason:

One or more Access databases are corrupted during multiple reads and writes, while Microsoft's MDAC system is writing to this corrupted access file, the ASP thread is in block state, and the other threads can only wait, IIS is deadlocked, and all CPU time is consumed in w3wp.exe.

Solution: 1

Set up multiple application pools within IIS Manager and add the virtual host site to the application pool, respectively. In the case of a multiple application pool, each application pool generates a w3wp.exe file. The Task Manager allows you to view all W3wp.exe CPU utilization. By opening the application pool through IIS Manager, you can deactivate the application pool one by one. To stop the application pool, while in Task Manager to see which w3wp.exe CPU utilization from a sudden down, CPU utilization back to normal. This will tell you that the application pool is out of the question. You can then create multiple application pools, each of which corresponds to one site. By stopping the application pool one at a, you can determine which Web site is the problem. The most problematic is often the access file for the counter class, for example: "**count." MDB "," *count. ASP ", find this file, you can delete it, or download down, with ACCESS2000 fix it, the problem is solved.

Solution: 2

W3wp.exe CPU too high Query method, many web providers the most headache problem, in the task manager often appear w3wp.exe accounted for too high, causing the entire server affected. The solution is as follows:

1. Open the Task Manager first and find that the w3wp.exe takes up the CPU Guan Gao to end the process

2. In My Computer-admin-Event Viewer-system-you will find the error report of the W3wp.exe, record the pool name and record the time. (such as 12.59.56).

3. Security on the system. Find the user who has logged on to the corresponding time (e.g. 12.59.56).

4. Open IIS to find 2 of the query to the program pool, and 3 query to the landing of the user, take the intersection, you can accurately find that the Web Occupy Point Station Cup.

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.