Q: A lot of asp.net programs, put on a server, the client connection after a period of time, on the server to open Task Manager A look, found that there are many w3wp.exe, occupy a large memory, to 1g, I would like to ask why this? Is there any way to avoid this?
A: This is mainly your asp.net development of the program has a memory leak; for unmanaged resources, be sure to pay attention to the release.
Q: My specific situation is this:
Server configuration Xeon 2.8G memory 512M SCSI Hard Drive 2 block (soft mirror)
System Windows 2003
Now hang up a asp.net development of the Web site is not much traffic but there is a problem
Every time the server is running 2-3 days after the site is particularly slow to restart the server after the normal
Viewing processes using memory finds that w3wp.exe and sqlservr.exe processes are consuming memory
Quite large reached more than 170 m (each) the physical available memory almost ran out
(server reboot takes up a small amount of memory more than 40 m per)
The previous web site hangs on a virtual machine The database is hung separately. This never happened.
Then the original version of the transplant to the new server on this problem ~ ~
Another problem is that I look at the SQL process in SQL Enterprise Manager and found that a lot of it is. NET causes the process to be sleeping but consumes the memory ~ Cannot release
have been engaged for a long time have not solved, help ~ ~ Please master advice ~ ~ Thank ~~~~~
A: IIS Service Manager----Application pool----Add your application and set maximum memory, which automatically restarts when the program reaches maximum memory.
My problem is the same as yours, but my memory is 2G, traffic is relatively high, is generally about 24 hours after the operation will have to restart, the memory is not consumed, w3wp process accounted for 990 trillion, SQL accounted for more than 200 trillion, you have to restart, or the entire site as there .... 55555555, it's almost half a month, or not, pain.
W3wp.exe is your asp.net application host, if you use a lot of session, cache and other resources, and session supermarket time is very long, then the memory footprint is relatively large. An application pool is an attribute that is designed to increase performance, but it also consumes a large amount of memory. You can also save a portion of your memory by turning off most of the service in Windows Server 2003 (which can be turned off)
1. The cache that is suspected of being applied in the program,
There's a lot of data in 2.CACHE.
3. Frequent Refresh Cache
4. No way to design a good cache
Your question I have met before, I used to use the session, after I changed to cook after all the better, should be your session or your cache has problems (cache does not understand, but more or less should be some)
Keep track of SQL call logs, and record time to write a large amount of data each time you go to the cache or session to see if it's too frequent
1. The process of asp.net in Win2003 is w3wp.exe
2.512M memory personal use is enough, but on the server is a little more than enough, especially Win2003 + asp.net +sql server. In particular, SQL Server He is very eat memory, if not controlled, he will take up all the physical memory (only dozens of M is left 100M). The win2003 itself will occupy about 150M. There is nothing left.
3. Optimize the ASP.net program, said to the upstairs, less use or no session cache application, and so on, and then there is not a place to turn the page, the paging processing is not good will take up a lot of memory.
4. Limit the memory of SQL. Enterprise Manager--sql properties (typically local)--"Memory" tab
Look at the memory settings here and change the maximum to 100M.
Fourth is the quickest way, you can try.
One of my self-development OA systems also has this problem.
Summary above, presumably because of the session and cache of unreasonable use caused.
In my application, I did use a lot of session and Cache,
Find "Dynamic memory allocation" in MSDN, and try today to see if it works.
Hope to have experienced friends to give more information, we have summed up the cause of similar errors, thank you!!
Don't know what website you are. It's not supposed to take up so much. If you use the cache to store the excess content. Of course. Like the session this is not likely to occupy such a large, or with application similar to some of the long time or permanent retention of objects to save a lot of data. Using a single example to save data can result in a large amount of memory being used.
The build Justice 2003 system installs at least 1G of RAM.
W3wp.exe is an IIS process under 2003, as the landlord says the SQL consumes memory, it may be because your SQL does not set up memory caps
Building a site based on IIS 6.0 is the preferred choice for many enterprises, but IIS is not only more hardware than other web platforms, but also less performance. Without a strong hardware platform, a Web site built with IIS does have a Leanio flavor. In addition, IIS's conservative default settings make this all the worse. How do you build a fast Web server on an existing hardware platform? Then optimize from IIS to start with Web offload.
1. Prohibit redundant Web service extensions
IIS6.0 supports a variety of service extensions, some administrators lazy or superficial understanding, worry about parsing errors in the Web run, and simply open all Web service extensions at the time of construction. As you can see, some of these extensions, such as "All unknown CGI extensions", "server-side Include files", are simply not used in web operations, but also occupy IIS resources to affect the performance of the web, and even some extensions are vulnerable to exploitation by attackers. Therefore, the scientific principle is that what extensions are used to enable what extensions.
If the corporate site is a static page, do not open any extensions. But now the enterprise site are interactive dynamic pages such as ASP, PHP, JSP and so on. If it is an ASP page, just open "Active Server pages". For dynamic page IIS6.0 such as PHP, JSP, and so on, the default is not supported by the need to install the appropriate components to achieve these extensions support. However, extensions that are not in use at this time are completely disabled.
The operation to prevent Web service extensions is simple, open IIS Manager, click Web Service Extensions in the left pane, select the appropriate extension on the right, and then click "Disable". (Figure 1)
2. Remove unnecessary IIS extension mappings
IIS defaults to the mapping of 8 extensions, such as ASP,. CDX, which, in addition to. asp, are almost impossible to extend. These unnecessary extensions can add to the burden on the Web server and pose some security risks. Extensions such as. Asa,.cer can be exploited by attackers to gain webshell. Because the general ASP system will limit the upload of ASP files, but if there is no limit. Asa or. cer extension, the attacker can change the file suffix to break through the upload limit, run. Asa or. cer file gets Webshell. (Figure 2)
The operation to remove an IIS extension is: Open IIS Manager, right-click the default Web site, select Properties, click the Home Directory tab, and then click Configure to open the application window, and then select unnecessary application mappings according to your needs, such as. shtml, shtm. STM, and then click "Delete". (Figure 3)
3. Cancel Access record
IIS6.0 the access record for the web is turned on by default. When logging is turned on, IIS faithfully logs all Web Access records in detail. The contents of these records are very complex, such as access time, client IP, from which link access, cookies, etc., also include method (methods), useragent (user agent) and so on. These records not only occupy a large amount of disk space, but also greatly affect the performance of the Web server. It has been evaluated that stopping access records can increase Web performance by 5% to 8%. And these records for the average user, especially the small and medium-sized Web site does not have any use, is simply too expensive system performance, so it is recommended to close it.
To cancel access to a record, open IIS Manager, navigate to a specific Web site, right-click Select Properties, and uncheck "Record Access" under the Home Directory tab. (Figure 4)
4, the access to traffic restrictions
By default, IIS 6.0 has no limit on the amount of traffic, and if a concurrent connection exceeds the load on the web, the network congestion occurs, and heavy causes the server to go down. Therefore, restrictions on user access are required to control the flow of Web Access.
Open Internet Information Services Manager, click the "+" number in front of the host name on the right side of its window, and navigate to a Web site in turn. Select the Web site right-click to select Properties, select the Performance tab in the Open Properties Settings window, check the Enable bandwidth throttling check box, and in the maximum network usage setting that is subsequently activated, specify a specific number for your network site bandwidth. You can continue to set up according to the server's performance and the amount of traffic. For a typical enterprise site, the bandwidth traffic is set to 1500kb/s. At the same time under the "Web site Connection" can be set to connect restrictions, you can set a value according to the situation. When the above settings are complete, IIS can only use the resources it has granted to do Web services, eliminating the server overload caused by exceptional conditions, and reducing the burden on the web. (Figure 5)
5. Allow Web load to scale freely
By default, IIS is fully serviced for the web, which in some ways adds to the burden of the web. How can I automatically adjust the work process according to the load change?
With the Web garden of IIS 6.0, we can isolate each Web site by specifying the number of worker processes used for an application pool. The specific configuration step is to open the Properties dialog box for the application pool in Internet Information Services Manager, go to the Performance page, and enter the number of processes in the maximum number of worker processes entry box under Web Garden. IIS 6.0 automatically shrinks the actual number of worker processes after a certain amount of time (default 20 minutes, configurable) when the server's load is small and no additional worker processes are required, and IIS 6.0 increases the number of worker processes again if the load becomes large and requires additional worker processes. In addition, you can enable cup monitoring, set maximum CPU usage, refresh cup usage values, and "CPU usage exceeds maximum usage is performed", which can be set as needed. When all is set, this is done automatically by IIS without the need for administrator intervention. (Figure 6)
6. Configure Application Rendering Pool
IIS can support multiple Web services, especially a virtual host with very many Web sites on one server. How can each site be independent of each other, not because some Web site failures affect other sites? It is a good solution to specify the application pool for different worker processes.
(1), create
Open IIS Manager, expand the local computer, right-click Application pools, and select new → application pool. In the Application Pool name box, enter a new application pool name. If you select the use of an existing application pool as a template, you can choose the appropriate application pool in the list of application pool names, and then click OK. (Figure 7)
(2), assigning
In IIS Manager, right-click the site for which you want to assign an application pool, and then click Properties. In the site's properties panel, in the Home Directory tab, select the application pool you just created in the application pool Drop-down list. If all the options are grayed out, click the Create button to enter application name, and then in the Application Pool list box, select and assign the Web site's application pool. (Figure 8)
(3), recycling
The recycle feature, however, sets the flexibility to restore system resources for use with IIS resources. Open the IIS Management console, click the +, and then expand Local computer → application pool. Select the application pool you want to recycle right-click to select Properties, the Application Pool Properties dialog box appears, click the Recycle tab to set up process recycle, memory recycle, and so on, all of these settings are set according to the actual needs. (Figure 9)
Summary: Through the above IIS optimization measures, the Web server can travel light its performance will be greatly improved. Of course, to fundamentally improve Web performance, only soft settings are not enough. In addition, the need for hardware transformation, soft and hard combination is the most perfect solution.
Manage Internet Information Server (Internet Information Server,iis) Everyone knows that it is a simple and troublesome thing, simple to install it hardly need any brains, select the path, and then press "Next" can be completed; Configuration is also relatively simple , as long as there is a certain NT and network knowledge, according to the instructions can be set up a respectable web site out. Managing IIS, however, is not as simple as it might seem. After a period of time, administrators often encounter poor server performance. At this point, the performance optimization of IIS is particularly important.
There are two reasons why the IIS service can be bad. One is artificial, that is, the administrator is not tuning or misconfigured when installing and configuring IIS. The other is objectively, with the type of service running, and the increase in the number of visitors, the server's original hardware configuration can not meet the requirements, this need to improve the hardware configuration.
Optimizing IIS performance on a server configuration
The 1.IIS cache is one of the most important items to consider when optimizing IIS. The server retains a portion of the memory space used as the IIS cache, storing objects for future requests, so that IIS can retrieve objects from the cache without retrieving them from the hard disk.
Adjusting the capacity of the IIS cache requires the registry to be modified as follows:
\hkey_local_machine
\system
\CurrentControlSet
\services
\inetinfo
\parameters
\memorycachesize
The Memorycachesize range is from 0 4GB and the default is 3072000 (3MB).
IIS improves system performance by caching system handles, directory listings, and other commonly used data values. This parameter indicates the amount of memory allocated to the cache. If the value is 0, that means "no caching is done." In this case, the performance of the system may be reduced. If your server network traffic is busy, and you have enough memory space, you can consider increasing the value. It is important to note that after you modify the registry, you need to reboot for the new value to take effect.
2. Allow IIS to use the processor for the longest time. The server's CPU processor capacity is always limited. Which application occupies the longest processor time, whose performance can be maximized.
(1) In the NT Control Panel, double-click the System icon.
(2) Click the Performance tab.
(3) Drag the cursor to none in the application performance, so that all running services, including IIS, will have the maximum time to use the processor.
3. Server property settings. There is an option in server properties that will maximize the total processing power of your network application, and you should certainly choose it.
(1) Right-click the Network Neighborhood icon on the desktop, and then select the Properties option.
(2) Click "Service Tag".
(3) Click Server, and then press properties.
(4) Choose to maximize the total processing power of the network application. And then click OK. ”
Improve your hardware configuration to optimize IIS performance
With the above optimized configuration, the performance of IIS is still not significantly improved, perhaps you should consider improving the server configuration. such as upgrading the processor, increase the hard drive, upgrade the network card, increase memory and so on.
Considerations for Optimizing IIS
To avoid future headaches, you should be aware of IIS optimizations when you install IIS. Like what:
1. To improve performance and conserve resources, you should only run the required protocols. Many administrators have not noticed this, and I have seen the NetBEUI, TCP/IP, and IPX protocols installed on a single web-service machine. Obviously this is unreasonable.
2. The IIS server should be set up as a stand-alone server, and the server should not be allowed to withstand the additional load required by the domain controller. Just imagine: the server in response to the user's login, while also providing IIS services, performance can not be reduced?
3. You can distribute the paging file of an NT Server to multiple physical disks, noting that multiple "physical disks" are not available on multiple partitions. Also, do not place the paging file in the same partition as the Windows NT boot zone.
4. Disk mirroring or disk stripe sets can improve the read performance of the disk.
5. For logging records, you should use file records instead of logging to an ODBC data source. In addition, you can increase the capacity of the memory buffers used to record logs during the recording period to reduce disk activity. The default capacity value for this buffer is 64KB.
6. It is best to store all the data in a separate partition. Then run the Disk Defragmenter on a regular basis to ensure that there is no fragmentation in the partition where the Web server data is stored. Using NTFS helps reduce fragmentation. The author recommends using Norton's speeddisk to quickly organize NTFS partitions.
7. Although SSL can provide a fairly reliable encryption transmission. However, the additional overhead will cause the IIS server to slow down, especially when working with large files. Therefore, SSL encryption should be done only for directories that do need to be protected.