Windows2003 IIS takes up 100% of CPU resources.

  

The following is scenario 1:

Phenomenon: When the machine is debugging or allowing IIS, the service is aborted (such as a power outage), and then IIS runs the page again. CPU resources occupy 100%, even if restarted. Cause: When an interrupt occurs, IIS will write an exception log, but at this time, garbled characters are written, causing IIS to write an infinite loop of logs, exhausting system resources. You can see the above by finding the error log file for the day under the system path \\System32\\Logfiles\\W3SVC1. Solution: Delete the error log file of the day under system path \\System32\\Logfiles\\W3SVC1, such as ex060904.log, and then restart IIS.

The following is scenario 2:

Environment: win2003server+IIs+ASP+MSSQL

Phenomenon: Every once in a while (indefinite, sometimes a few minutes, sometimes half an hour) Once a website is opened very slowly, sometimes even a timeout can not open the site. At this time, the process of the server side is viewed, and the CPU usage reaches 100%, wherein w3wp occupies 70~80%, and SQL takes 20~30%. All server-side operations become slow. Initial solution: Whenever the phenomenon occurs, log in to the server and end the w3wp process or restart the IIS service. The average operation is about 10 times a day. Since the server is stored in the remote computer room, all operations are remotely controlled. In the event that there is a remote connection failure, the server administrator can only be notified by phone to restart the server. This process causes the user to complain and continuously check the data on the Internet. Most of these phenomena are caused by unreasonable webpage code. The situation will lead to such phenomena:

1. The server caches such as application and seesion are used in many places in the code, resulting in excessive occupation of server data; 2. The code has unreasonable syntax, infinite loop, etc.; 3. Database corruption , especially the ACCESS database; 4, installed too many third-party software or plug-ins, conflict with IIS or web page function code.

The first stage of investigation: According to the reference materials reviewed, it is analyzed item by item

1. All the website code on the server is written by the company's designers, which can confirm that there is not too much call to the server cache. Grammar (exclude) 2, the code has unreasonable grammar (unsure) 3, according to the situation, when the IIS process occupancy rate increases, the SQL occupancy rate increases at the same time, should be the SQL database site, according to the phenomenon judgment, the library Or the table should be normal, it is estimated that the data may be wrong; (unsure) 4, the server side in addition to the basic system services, anti-virus and website operation essential services, there is no redundant third-party software, the probability is not large (excluding ).

After the above analysis and judgment, the conclusion that the uncertain items are connected is that an unreasonable grammar of the website webpage code using the SQL database causes the IIS and SQL process CPU usage to be too high.

Second Phase Troubleshooting:

Determine the range, then continue to narrow the range. Since there are not many sites using SQL databases on the server, it is easy to establish an independent process ID to observe. Set up a separate application pool in the IIS Manager for all sites that use SQL databases, and then input them through the CMD interface: iisapp -a Now view and record the process ID number of each IIS pool. Through the observation of multiple phenomena reappearing, there is an IIS process ID that is the culprit leading to this problem.

The following is the scheme 3:

Under IIS6, the memory and CPU usage of w3wp.exe often cannot be released in time, resulting in slow response of the server. To solve the memory usage too much, you can do the following configuration: 1. Configure a separate application pool for each website in IIS. That is, it does not affect each other. 2, set the application pool recycling time, the default is 1720 hours, can be modified according to the situation. Then set the memory usage automatically (more than 500M), it will automatically reclaim memory.

Resolve too much CPU usage: 1. Configure a separate application pool for each website in IIS. That is, it does not affect each other. 2, set the CPU monitoring of the application pool, no more than 25% (the server is 4CPU), refresh every minute, close when the limit is exceeded.

According to w3wp is the one application pool: 1. Add the display pid field in the task manager. You can see the process that occupies the highest memory or cpu. 2. Run iisapp -a at the command prompt. Note that the first time you run, you will be prompted for no js support, click OK. Then run it again. This will show the application pool corresponding to the pid. (iisapp is actually a VBS script stored in the C:\\windows\\system32 directory, the full name is iisapp.vbs. If you and I are also banned from the Vbs default association program, then you need to manually go to the directory, first Select the open method, and then select "Microsoft (r) Windows Based Script Host" to execute, you can get the correspondence between the PID and the application pool.) 3, to view the application pool corresponding to the iis site, ok , make the above memory or CPU restrictions, or check the program for dead loops and other issues.

Copyright © Windows knowledge All Rights Reserved