IIS resolves an issue with high CPU and memory usage

Source: Internet
Author: User
Tags memory usage cpu usage

The w3wp occupancy rate in the discovery process is too high.

After the query, found as follows:

W3wp.exe is a process that is associated with an application pool in IIS (Internet Information Server), and if you have multiple application pools, there will be multiple W3wp.exe process instances running. This process is used to allocate a large amount of system resources. This process is of great importance to the stability and security of the system and cannot be easily terminated.

Find a workaround: (in Windows2008, you can find the application pool under the site by using the Server Manager, role \web Server \iis Manager, directly in the right-click of the program pool entry)

To resolve excessive CPU usage:

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

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

According to W3WP, which application pool is obtained:

1. Add the Display PID field to the Task Manager. You can see the process PID that consumes memory or the highest CPU

2. Run iisapp-a at the command prompt. Note that the first run, will prompt without JS support, click OK. And then you run it again. This allows you to see the application pool corresponding to the PID. (Iisapp is actually a VBS script that is stored in the C:\windows\system32 directory with the full name iisapp.vbs, if you and I also prohibit the VBS default affiliate program, then you need to manually go to the directory, select Open mode, and then select " Microsoft (R) Windows Based Script Host "to execute, you can get the corresponding relationship between the PID and the application pool." )

3, to the IIS to view the application pool corresponding to the site, OK, make the above memory or CPU restrictions, or check the program has a dead loop and so on.

Resolve memory consumption too much, you can do the following configuration:

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

2, set the application pool recycling time, the default is 1720 hours, can be modified as appropriate. Then set the memory to be reclaimed automatically when the memory consumption is more than (for example, 500M).

My settings are as follows:

The first is the CPU limit: After CPU monitoring is enabled, I set the maximum CPU utilization of the application pool to 50%. Set the refresh CPU time to 1 minutes and set the action to OFF. The maximum number of worker processes is set to 1. This means that IIS refresh detects that the CPU usage time for this stand-alone pool is 1 minutes, and if it exceeds the set CPU limit of 50%, it will issue an instruction to close the pool, requiring the pool to shut down within a specified time. If the pool is successfully shut down during this time, IIS restarts a new pool, which is short and generally does not feel, the pool is re-opened, and the people who visit the site are basically not feeling. However, if the pool does not close within the specified time, IIS forcibly shuts it down to a refreshed CPU time. During this stop time, the website cannot be accessed, prompting "Service unavaliable". Shutdown time and start interval settings: Set short for example 10 seconds, so that when your site program is heavily consuming system resources, IIS automatically recycles the process and quickly starts the process, and your site can temporarily work.

The memory limit and the process recovery time settings: I set the memory consumption of more than 800M automatically reclaim memory, virtual memory is not limited. Process recycle time I keep the default without modification. You can set a shorter time depending on your situation. The maximum virtual memory for the application pool can also be set here, exceeding the set maximum virtual memory, which is recycled.

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

1. To limit the CPU usage of a site, you must set the site as a stand-alone application pool, which cannot restrict individual sites. The IIS standalone application pool requires a separate process that consumes memory very much. The more independent pools, the more w3wp processes. For each site to separate application pool server, in general ordinary P43.0 2G memory of ordinary server, it is recommended not more than 50 sites, preferably 30 or less, or the server pressure is very large. In the configuration, I generally put the resource consumption of a large site independent of a pool, general BBS or generated HTML system about 5 stations a pool. Common sites and some enterprise sites share a pool.

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

3, these are not the fundamental solution, it is the fundamental problem of the website program has a problem, to solve the fundamental problems to be checked from the program. Follow the methods mentioned at the beginning of this article to find the specific application pool, locate the site that uses the application pool, and troubleshoot problems with the site program, such as a dead loop.

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

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.