IIS optimization 2

Source: Internet
Author: User
Tags fast web

Q: Why does the memory usage reach 1 GB in bytes? Is there any way to avoid this situation?

A: This is mainly because your asp. Net Program has memory leakage. For unmanaged resources, be sure to release them.

Q: My situation is as follows:

2 Xeon 2.8 GB memory 512 m scsi hard disks (soft images) configured on the server)

Windows 2003

Now I am stuck with an Asp.net website with a low access volume, but one problem is that

Every time the server runs for 2-3 days, it is very slow to visit the website. After restarting the server, it will be normal.

View the memory usage of the process and find that the w3wp.exe and sqlservr.exe processes occupy the memory.

The size of physical available memory reaches more than 170 MB (each), and almost no memory is used up.

(The memory occupied during server restart is very small, only 40 MB per)

In the past, when a website was mounted to a virtual machine, databases were separated. This never happened.

Later, the original version was transplanted to the new server ~~

Another problem is that I found many SQL processes in the SQL Enterprise Manager. The process caused by. NET is sleeping, but the memory is occupied ~ Cannot be released

I haven't solved the problem for a long time ~~ Please kindly advise ~~ Thank you very much ~~~~~

Answer: IIS service manager ---- application pool ---- add your application and set the maximum memory. When the Program reaches the maximum memory, it will automatically restart.

My problem is the same as yours, but my memory is 2 GB and the access traffic is high. Generally, I have to restart after 24 hours of operation, and the memory is not enough, w3wp processes account for one hundred and eight 90 MB, and SQL accounts for more than two hundred MB, You have to restart, or the whole site will be there .... 55555555. It's almost half a month. It's still not good. It's painful.

W3wp.exe is your ASP. NET application host. If you use a large number of session, cache, and other resources, and the session supermarket takes a long time, the memory usage is relatively large. The application pool is a feature designed to increase performance, but it also consumes a lot of memory. In addition, turning off most services in Windows Server 2003 (which can be switched off without any need) can also save some memory

1. Suspect the cache applied in the program,

2. the cache contains a large amount of data.

3. Frequent cache refresh

4. No cache method is designed.

I have met your problem before. I used to use sessions. After I changed them all to cook, it would be much better, it should be because of a problem with your session or your cache (the cache doesn't know much about it, but it should be somewhat true)

Trace the SQL call records and record the time each time a large amount of data is written to the cache or session to check whether the time is too frequent.

1.The process of asp.netin win2003is w3wp.exe

2.512 M memory is enough for personal use, but it is not enough to put it on the server, especially win2003 + Asp.net + SQL Server. In particular, SQL Server is very memory-consuming. If it is not controlled, it will occupy all the physical memory (only a few MB is left for 100 MB ). Win2003 occupies around MB. There is nothing left.

3. to optimize the Asp.net program, I would like to say that there is little or no need to use session cache applications and other things, and whether there is a page flip, the page flip processing will also occupy a lot of memory.

4. Restrict SQL Memory. Enterprise Manager -- SQL attributes (generally local) -- "Memory" tag

Here, let's look at the memory settings and change the maximum value to MB.

Article 4 is the fastest way. You can try it.

This problem also exists in one of my self-developed OA systems.

To sum up, this is probably because of the improper use of sessions and cache.

Many sessions and caches are used in my application,

I found the "dynamic memory allocation" article in msdn. Today, I will explain whether it works.

I hope some experienced friends can give me more information. You can also summarize the reasons for similar errors. Thank you !!

I don't know what website you are. It is said that it will not occupy such a large amount. As shown above, you have used the cache to store excess content. Of course. Session-like objects are unlikely to occupy such a large amount of data, or some objects with a long time or permanent persistence similar to the application are used to save a large amount of data. For example, using a single instance to save data may result in a large amount of memory.

Jianye 2003 system installation requires at least 1 GB of memory.

W3wp.exe is an IIS process in 2003. As for the memory usage of SQL statements, it may be because your SQL statements do not set a memory usage limit.

IIS optimization reduces load on Web Servers

Monday July 21, 2008

Creating a site based on IIS 6.0 is the first choice for many enterprises. However, compared with other Web platforms, iis not only has high hardware requirements, but also has poor performance. Without a strong hardware platform, the web sites built using IIS do have a taste of good luck. In addition, the conservative default settings of IIS make all this worse. How can we build a fast web server on an existing hardware platform? It starts from IIS optimization and reduces web load.

 1. Disable redundant web service extensions

Iis6.0 supports a variety of service extensions. Some administrators are lazy or do not need to solve the problem. They are worried about parsing errors during Web running and simply enable all web service extensions during website creation. Some of these extensions, such as "all unknown CGI extensions" and "include files on the server", are not used in Web operations, besides, it also takes up IIS resources and affects the performance of the web. Some extensions may be exploited by attackers. Therefore, the scientific principle is to enable any extension when any extension is used.

If the enterprise site is a static page, do not enable any extensions. However, enterprise websites are all interactive dynamic pages such as ASP, PHP, and JSP. For an ASP page, you only need to enable "Active Server Pages. For dynamic pages such as PHP and JSP, iis6.0 is not supported by default. You need to install corresponding components to support these extensions. However, extensions that are not used can be disabled.

It is very easy to disable Web Service extension. Open "IIS manager", click "Web Service extension" in the left pane, select the corresponding extension on the right, and click "Disable. (Figure 1)

650) This. width = 650; "alt =" IIS optimized to Web Server minus "src =" http://image.mamicode.com/info/201410/20180921230044217167.jpg "Height =" 349 "width =" 500 "/>



2. Delete unnecessary IIS extension mappings

By default, IIS supports ing between. asp,. CDX, and other eight extension types, which are rarely used except. asp. These unnecessary extensions will increase the burden on web servers and bring some security risks. For example, extensions such as. Asa and. Cer can be exploited by attackers to obtain webshells. Generally, ASP system restricts the upload of ASP files. asa or. CER extension, attackers can change the file suffix to break through the upload restrictions and run. asa or. CER file to obtain webshell. (Figure 2)

650) This. width = 650; "alt =" IIS optimized to Web Server minus "src =" http://image.mamicode.com/info/201410/20180921230044467177.jpg "Height =" 354 "width =" 471 "/>



To delete an IIS extension, click confirm,. shtm, And. stm, and then click Delete. (Figure 3)

650) This. width = 650; "alt =" IIS optimized to Web Server minus "src =" http://image.mamicode.com/info/201410/20180921230044815823.jpg "Height =" 437 "width =" 400 "/>

3. Cancel access records

Iis6.0 enables Web access records by default. When the record function is enabled, IIS faithfully records all web access records. The contents of these record files are very complex, such as the access time, Client IP address, access from which link, cookies, and so on. It also includes method and useragent. These records not only occupy a large amount of disk space, but also greatly affect the performance of web servers. Some people have done some tests. Stopping access records can improve the web performance by 5% to 8%. In addition, these records are useless for general users, especially small and medium-sized websites, which is too costly for system performance. Therefore, we recommend that you disable them.

To cancel an access record, open the IIS manager, locate a specific web site, right-click and choose Properties ", on the "home directory" tab, deselect the "record access" check box. (Figure 4)

650) This. width = 650; "alt =" IIS optimized to Web Server minus "src =" http://image.mamicode.com/info/201410/20180921230045158610.jpg "Height =" 446 "width =" 464 "/>



4. Restrict Access traffic

By default, IIS 6.0 has no limit on access traffic. If the concurrent connection is too large and exceeds the Web load, network congestion may occur, leading to server downtime. Therefore, you must restrict user access to control web access traffic.

Open the "Internet Information Service" Manager, click "+" in front of the host name on the right side of the window, and locate a web site in sequence. Right-click the Web site and choose properties. In the displayed Properties window, select the performance tab and select the Enable bandwidth limit check box, in the "maximum network usage" setting box that is subsequently activated, specify the bandwidth value of your network site. You can proceed with the configuration based on the server performance and traffic. For general enterprise sites, it is almost the same to set the bandwidth traffic to kb/s. At the same time, you can set connection restrictions under "website connection". You can set a value as needed. After completing the preceding settings, IIS can only use the resources it grants for Web Services. This prevents server overload caused by exceptions and reduces web load. (Figure 5)

650) This. width = 650; "alt =" IIS optimized to Web Server minus "src =" http://image.mamicode.com/info/201410/20180921230045478934.jpg "Height =" 447 "width =" 468 "/>

5. enable free scaling of Web Load

By default, IIS provides services for the web, which increases the Web burden to a certain extent. How can I automatically adjust work processes according to load changes?

With the Web Garden of IIS 6.0, we only need to specify the number of worker processes used in an application pool to isolate various web sites. The specific configuration steps are as follows: Open the "properties" dialog box of the application pool in the "Internet Information Service" Manager and go to the "performance" page, in the "Maximum number of worker processes" input box under "Web Garden", enter the number of processes. When the server load is small and no additional worker processes are required, IIS 6.0 automatically reduces the actual number of worker processes after a certain period of time (20 minutes by default, which can be configured; if the load increases, additional worker processes are required. IIS 6.0 increases the number of worker processes again. In addition, you can also "enable CPU monitoring", set "Maximum CPU usage", "Refresh CPU usage value", and "The operation is performed when the CPU usage exceeds the maximum usage ", these settings can be set as needed. After all the settings are complete, this will be automatically handed over to IIS without administrator intervention. (Figure 6)

650) This. width = 650; "alt =" IIS optimized to Web Server minus "src =" http://image.mamicode.com/info/201410/20180921230045790470.jpg "Height =" 425 "width =" 457 "/>



6. Configure the application rendering pool

IIS supports multiple web services, especially a host with many web sites. How can we ensure that each site is independent from each other and does not affect other sites because of faults on some Web sites? It is a good solution to specify an application pool for different working processes.

(1) Create

Open IIS manager, expand local computer, right-click application pool, and select new> application pool ". In the application pool Name box, enter a new application pool name. If you select "use existing application pool as template", you can select the corresponding application pool in the "application pool name" list and click "OK. (Figure 7)

650) This. width = 650; "alt =" IIS optimized to Web Server minus "src =" http://image.mamicode.com/info/201410/20180921230046249472.jpg "Height =" 212 "width =" 391 "/>



(2) Assignment

In "IIS manager", right-click the site for which you want to assign an application pool, and then click "properties ". On the Home Directory tab in the properties Panel of the site, select the application pool you just created from the application pool drop-down list. If all options are gray, click the create button to enter the application name, and then in the application pool list box, select and assign the application pool of the website. (Figure 8)

650) This. width = 650; "alt =" IIS optimized to Web Server minus "src =" http://image.mamicode.com/info/201410/20180921230046608861.jpg "Height =" 446 "width =" 466 "/>



(3) Recycling

With the "recycle" function, you can flexibly customize how to restore system resources for IIS resources. Open the "IIS console" and click "+" to expand the Local Computer and application pool ". Right-click the application pool you want to recycle and choose properties. The Properties dialog box is displayed, click the recycle tab under which you can set process recycle and memory recycle. All these settings are set as needed. (Figure 9)

650) This. width = 650; "alt =" IIS optimized to Web Server minus "src =" http://image.mamicode.com/info/201410/20180921230047043448.jpg "Height =" 427 "width =" 456 "/>



Conclusion: Through the above IIS optimization measures, the web server can be installed with ease, and its performance will be greatly improved. Of course, it is not enough to perform soft settings to fundamentally improve web performance. In addition, hardware transformation is required, and the combination of hardware and software is the perfect solution.

As we all know about managing Internet Information Server (IIS), it is a simple and troublesome thing. It is easy to install it without any worries, select the path and click "Next". The configuration is also relatively simple. If you have some nt and network knowledge, you can build a decent web site according to the instructions. However, managing IIS is not as simple as you think. After a period of use, administrators often encounter poor server performance. At this time, IIS performance optimization is particularly important.

There are two reasons for poor IIS service performance. One is artificial, that is, the Administrator does not optimize or configure IIS during installation or configuration. The other is objective. As the service type and number of visitors increase, the original hardware configuration of the server cannot meet the requirements. Therefore, the hardware configuration needs to be improved.

Optimize IIS performance in server configuration

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 to store objects for future requests. In this way, IIS can retrieve objects from the cache instead of from the hard disk.

To adjust the IIS cache capacity, You need to modify the registry. The table items are as follows:

\ HKEY_LOCAL_MACHINE
\ System
\ CurrentControlSet
\ Services
\ Inetinfo
\ Parameters
\ Memorycachesize
The memorycachesize range is from 0 to 4 GB. The default value is 3072000 (3 MB ).

IIS improves system performance by using the cache system handle, directory list, and other common data values. This parameter specifies the memory size allocated to the cache. If the value is 0, it means "no cache is performed ". In this case, the system performance may be reduced. If your server is busy with network communication and has enough memory, you can increase the value. Note that after you modify the registry, you must restart the Registry to make the new value take effect.

2. Make IIS use of the processor for the longest time. The CPU processor capability of the server is always limited. Which application occupies the longest processor for the maximum performance improvement.

(1) On the NT control panel, double-click the System icon.
(2) Click the performance tab.
(3) drag the cursor to the none position under the application's procedural ability, so that all running services, including IIS, can use the processor to reach the maximum time.

3. Set server properties. There is an option in the server attribute that maximizes the total processing capability of network applications. Of course you should choose it.

(1) Right-click the network neighbor icon on the desktop and select Properties.
(2) Click "service tag ".
(3) Click "server" and then press "properties ".
(4) select to maximize the total processing capability of network applications. Click OK ."

Improve hardware configuration to optimize IIS Performance

After the above optimization configuration, the IIS performance is still not significantly improved, you may want to improve the server configuration. Such as upgrading the processor, adding a hard disk, upgrading the NIC, and adding memory.

Notes for IIS Optimization

To avoid future headaches, you should pay attention to IIS optimization when installing IIS. For example:

1. To improve performance and save resources, only the required protocols should be run. Many administrators did not pay attention to this. I have seen netbeui, TCP/IP, and IPX protocols installed on a Web Service-only machine. Obviously this is unreasonable.

2. Set the IIS server as an independent server and do not let the server bear the extra load required by the domain controller. Imagine: Can the server provide the IIS service while responding to user logon?

3. You can distribute the Page Swap files of the NT Server to multiple physical disks. Note that multiple "physical disks" are not valid when distributed across multiple partitions. In addition, do not place the Page Swap file in the same partition as the Windows NT boot area.

4. Using a disk image or a disk zone set can improve the disk read performance.

5. log records should adopt file records instead of logging to ODBC data sources. In addition, you can increase the memory buffer capacity used to record logs during the recording period to reduce disk activity. The default size of the buffer is 64 KB.

6. It is best to store all the data in a separate partition. Then, run the disk fragment program regularly to ensure that no fragments exist in the partition where the Web server data is stored. Using NTFS helps reduce fragments. I recommend using Norton's speeddisk to quickly sort out NTFS partitions.

7. Although SSL can provide quite reliable encrypted transmission. However, the additional overhead will cause the IIS server to speed down, especially when processing large files. Therefore, you should only perform SSL encryption on directories that do need to be protected.


IIS optimization 2

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.