In iis6, the memory and CPU usage of w3wp.exe cannot be released in time, resulting in slow server response.
Solve the problem of excessive CPU usage:
1. Separate applications for each website in IISProgramPool configuration. That is, they do not affect each other.
2. Set the CPU monitoring of the application pool to no more than 25% (4 CPU for the server), refresh every minute, and close when the limit is exceeded.
Which application pool is obtained based on w3wp:
1. Add the display PID field in Task Manager (Task Manager> View> Select column> PID (process identifier )). You can see the process PID with the highest memory usage or CPU usage.
2. Run iisapp-A at the command prompt. Note: the first running will prompt that no JS support is available. Click OK. Then run it again. In this way, you can see the application pool corresponding to the PID. (Iisapp is actually a vbs script stored in the c: \ windows \ system32 directory. Its full name is iisapp. vbs: If you and I are the same, and disable the default vbs associated program, you need to manually go to this directory, select the open method, and then select "Microsoft (r) run the Windows Based Script Host Command to obtain the correspondence between the PID and the application pool .)
3. Check the website corresponding to the application pool in IIS, and then make the above memory or CPU restrictions, or check whether the program has problems such as endless loops.
To solve the problem of excessive memory usage, you can configure the following:
1. configure a separate application pool for each website in IIS. That is, they do not affect each other.
2. Set the recycle time of the application pool. The default value is 1720 hours, which can be modified as needed. Then, when the memory usage exceeds 500 mb, the memory is automatically reclaimed.
My settings are as follows:
First, the CPU limit: After enabling CPU monitoring, I set the maximum CPU usage of this application pool to 50%. Set the CPU refresh time to 1 minute, and set the operation to "off ". Set the maximum number of worker processes to 1. This means that IIS refresh checks the CPU usage of the independent pool for 1 minute. If the set CPU limit is exceeded by 50%, a command is sent to disable the pool, the pool must be closed within the specified time. If the pool is successfully closed within this time period, IIS will restart a new pool. This period of time is very short. Generally, the pool will not be started any more, people who access the website will not feel it. However, if the pool is not closed for a specified period of time, IIS will forcibly close it and refresh the CPU time. During the stop time, the website cannot be accessed and the message "service unavaliable" is displayed ".
Set the close time and start time interval: set a shorter time, for example, 10 seconds. In this way, when your website programs occupy a large amount of system resources, IIS automatically recycles the process and starts the process quickly, your website will be ready for work now.
Restrictions on memory and process recovery time: I set it to automatically reclaim the memory when the memory usage exceeds mb. There is no limit on the virtual memory. The process recovery time remains unchanged by default. You can set a shorter time as needed. You can also set the maximum virtual memory of the application pool here. If the maximum virtual memory is exceeded, the pool will be recycled.
Finally, based on the experience of outdated wlmmc, We will summarize some issues that need attention:
1. to limit the CPU usage of a site, you must set the site as an independent application pool. Sharing an application pool cannot limit a single site. The IIS independent application pool requires independent processes, which consumes a lot of memory. The more independent pools, the more w3wp processes there will be. For servers with independent application pool for each site, we recommend that you do not have more than 50 sites on general servers with p43.0 2 GB memory, otherwise, the server is under heavy pressure. In terms of configuration, I usually separate a website with a large resource consumption pool. Generally, a common BBS or HTML generation system has five sites and one pool. Common websites and some enterprise websites share a pool.
2. When server hardware permits, do not limit the memory usage of the site. This ensures that the website is running and the user will not be disconnected. You need to limit the maximum virtual memory size of a website to 64 mb. Otherwise, some unknown errors may occur.
3. These are not fundamental solutions. The fundamental problem is that there is a problem with the website program. To solve the fundamental problem, check the program. Find the specific application pool according to the method mentioned at the beginning of this article, find the website using this application pool, solve the problems of the website program, such as endless loops.
4. In addition to w3wp.exe, when calling a database for a large number of queries, it also occupies a lot of CPU resources. This is inevitable (Database statements and structure optimization are not covered in this article ). In my opinion, as long as the CPU does not occupy 100% for a long time, it is generally normal at around 75%.