How to solve w3wp CPU and memory problems

  
                  Under WINDOWS2003 IIS6, the memory usage of w3wp often fails to be released in time, resulting in a slow response of the server.
Actual case
Server configuration
Xeon 2.8G
Memory 512M
SCSI hard disk 2 (soft image)
System windows 2003
now hangs an asp.net development The website has a small amount of traffic, but there is one. The problem is that every time the server runs for 2-3 days, accessing the website is particularly slow, and it is normal after restarting the server.
View the process using memory, found that w3wp.exe and sqlservr.exe process memory is quite large to more than 170 M (each), the physical available memory is almost used up, (the memory used when the server restarts is very small Only 40 M each), the previous website was hung on a virtual machine, the database was hanged separately, and this never happened.
Later, the original version was transplanted to the new server. This problem is also a problem. In the SQL Enterprise Manager, the SQL process is found to have a lot of problems. The process caused by .net is sleeping but it takes up memory. Release
Take action:
IIS Service Manager----"Application Pool----"Add your application and set the maximum memory, it will automatically restart when the program reaches the maximum memory.
Upgrade the memory to 2G, the traffic is relatively high, generally it will restart after 24 hours of running, the memory is not exhausted, W3WP process accounts for 189 megabytes, SQL accounts for more than 200 megabytes Have to restart, or the entire site will be paralyzed.
Solution one:
w3wp.exe is your ASP.NET application host, if you use a lot of Session, Cache and other resources, and the Session supermarket is very long, then the memory footprint is relatively large. Application pooling is a feature for increased performance, but it also consumes a lot of memory. In addition, turn off most of the services in Windows Server 2003 (the one can be turned off), you can also save a part of the memory
1. Suspected in the application of CACHE,
2. CACHE has a large amount of data < BR>3. Frequently refresh CACHE
4. There is no way to design CACHE
Solution 2:
Track the SQL call record, record the time every time you write a lot of data to CACHE or SESSION See if it is too frequent
1. In win2003, asp.net process is w3wp.exe
2.512M memory personal use is enough, but put it on the server is not enough, especially win2003 Asp.net sql server. Especially sql server, he is very eating memory, if not controlled, he will occupy all the physical memory (only tens of M left 100M). Win2003 itself will occupy about 150M. There is nothing left.
3. Optimize the asp.net program, as the upstairs said, use less or no session cache application and so on, and then there is no place to turn pages, page turning is not good Take up a lot of memory.
4. Limit sql memory. Enterprise Manager - SQL attributes (usually local) - "memory" tags. Look at the memory settings here and change the maximum value to 100M.
Solution 3:
Researched a bit, you can do the following configuration:
1, in IIS for each site for a separate application pool configuration. 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. At the same time, set the number of w3wp processes running at the same time to 1. Then set the memory or cpu occupied more than how much, it will automatically reclaim memory
In general, this can be solved. However, there will still be individual websites that cannot be released correctly due to procedural issues.
So, how can I find out which website?
1, add the display pid field in the task manager. You can see the process pid
with the highest memory or cpu, and 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. In this way, you can see the application pool corresponding to the pid
3, and view the website corresponding to the application pool in the iis, it is ok.
Solution 4:
Jianyi 2003 system installed at least 1G memory.
w3wp.exe is an iis process under 2003, as sql occupies memory, it may be because your sql is not set to take up the memory limit
Under IIS6, often w3wp.exe memory and CPU usage can not be Released in time, causing the server to respond slowly.
Solve too much memory usage, you can do the following configuration:
1, in IIS for each site for a separate application pool configuration. 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.
Solve too much CPU usage:
1, in IIS for each site for a separate application pool configuration. 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 to get that one application pool:
1, add display pid field in the task manager. You can see the process pid
with the highest memory or cpu, and 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 website corresponding to the application pool in iis, Ok, make the above memory or CPU restrictions, or check the program for dead loops or the like.
Copyright © Windows knowledge All Rights Reserved