Resource icon

IIS Configuration For Best Performance

  • perf-test.com need your contributions to build up a strong repository of performance engineering resources.

What is IIS ?

-Internet Information Services (IIS), formerly known as Internet Information Server, is a web server producted by Microsoft. IIS is used with Microsoft Windows OSs and is the Microsoft-centric competition to Apache, the most popular webserver used with Unix/Linux-based systems. IIS supports HTTP, HTTPS, FTP, FTPS, SMTP and NNTP. It has been an integral part of the Windows NT family since Windows NT 4.0, though it may be absent from some editions .IIS has it's own ASP.NET Process Engine to handle the ASP.NET request. So, when a request comes from client to server, IIS takes that request and process it and send response back to clients.

Following Are The Common Problem Areas In IIS Performance :

  1. Memory leak
  2. Thread Limit
  3. High CPU usage
  4. Cache
  5. HTTP compression
  6. Connection limitation
Configuration to improve IIS performance
Internet Information Services (IIS) exposes numerous configuration parameters that affect IIS performance. The following points describes several of these parameters and provides general guidance for setting the parameter values to improve IIS performance.
  • Configure Logging option(Log only essential information or completely disable IIS logging)
  • Disable IIS ASP debugging in production environments
  • Tune the value of the ASP Threads Per Processor Limit property
  • Tune the value of the ASP Queue Length property
  • Tune the MaxPoolThreads registry entry
  • Configure ASP.NET 2.0 MaxConcurrentRequests for IIS 7.5/7.0 Integrated mode
  • Enabling CPU Monitoring in IIS
  • Improving IIS Scalability and Availability with Network Load Balancing
  • Enable IIS HTTP compression
  • Configure HTTP expires header
  • Enable Output caching
  • Connection Limit in IIS
upload_2015-12-15_10-18-56.png

Configure Logging option(Log only essential information or completely disable IIS logging)
With default settings, IIS logs almost everything under the hood . which results memory consumption and increase the response time . so to consume less memory You either can disable logging option or can select a number of essential events to log in your server. To disable logging follow these steps:
1. Click Start, point to All Programs, click Administrative Tools, and then click Internet Information Services (IIS) Manager.
2. In the Connections pane, click to expand Sites, click to select the Web site for which you would like to disable logging, click to select Features View, and then double-click the Logging feature.
3. Click Disable in the Actions pane to disable logging for this Web site.
Remember that you can set logging option both in server level and website level.
Disable IIS ASP debugging in production environments
When you run your server in the production environment, you may not need to run “ASP debugging” mode. Stopping debugging mode will save you a great amount of processing power. To disable IIS ASP debugging follow these steps:
1. Click Start, point to All Programs, click Administrative Tools, and then click Internet Information Services (IIS) Manager.
2. In the Connections pane, click to expand Sites, click to select the web site for which you would like to disable ASP debugging, click to select Features View, and then double-click the ASP feature.
3. Click to expand Compilation, click to expand Debugging Properties, and verify that both Enable Client-side Debugging and Enable Server-side Debugging are set to False.
4. If necessary, click Apply in the Actions pane.
Disable debugging for ASP.NET Applications and Web Services by specifying the <compilation debug="false"/> section in the web.config file for the web application.
upload_2015-12-15_10-20-12.png

Tune the value of the ASP Threads Per Processor Limit property
The ASP “Threads Per Processor Limit property” specifies the maximum number of worker threads per processor that IIS creates. Increase the value for the Threads Per Processor Limit until the processor utilization meets at least 50 percent or above. This setting can dramatically influence the scalability of your Web applications and the performance of your server in general. Because this property defines the maximum number of ASP requests that can execute simultaneously, this setting should remain at the default value unless your ASP applications are making extended calls to external components. In this case, you may increase the value of Threads Per Processor Limit. Doing so allows the server to create more threads to handle more concurrent requests. The default value of Threads Per Processor Limit is 25. The maximum recommended value for this property is 100.
To increase the value for the Threads Per Processor Limit follow these steps:
1. Click Start, point to All Programs, click Administrative Tools, and then click Internet Information Services (IIS) Manager.
2. In the Connections pane, select the web server, click to select Features View, and then double-click the ASP feature.
3. Click to expand Limits Properties under Behavior, click Threads Per Processor Limit, enter the desired value for Threads Per Processor Limit and click Apply in the Actions pane.
Tune the value of the ASP Queue Length property
The goal of tuning this property is to ensure good response time while minimizing how often the server sends the HTTP 503 (Server Too Busy) error to clients when the ASP request queue is full. If the value of ASP Queue Length property is too low, the server will send the HTTP 503 error with greater frequency. If the value of “ASP Queue Length property” is too high, users might perceive that the server is not responding when in fact their request is waiting in the queue. By watching the queue during periods of high traffic, you should discern a pattern of web request peaks and valleys. Make note of the peak value, and set the value of the ASP Queue Length property just above the peak value. Use the queue to handle short-term spikes, ensure response time, and throttle the system to avoid overload when sustained, unexpected spikes occur. If you do not have data for adjusting the ASP Queue Length property, a good starting point will be to set a one-to-one ratio of queues to total threads. For example, if the ASP Threads Per Processor Limit property is set to 25 and you have four processors (4 * 25 = 100 threads), set the ASP Queue Length property to 100 and tune from there.
To increase the value for the Queue Length property follow these steps:
1. Click Start, point to All Programs, click Administrative Tools, and then click Internet Information Services (IIS) Manager.
2. In the Connections pane, select the Web server, click to select Features View, and then double-click the ASP feature.
3. Click to expand Limits Properties under Behavior, click Queue Length, enter the desired value for Queue Length and then click Apply in the Actions pane.
Note - Because this property can only be applied at the server level, modification of this property affects all Web sites that run on the server.
Tune the MaxPoolThreads registry entry
This setting specifies the number of pool threads to create per processor. Pool threads watch the network for requests and process incoming requests. The MaxPoolThreads count does not include threads that are consumed by ISAPI applications. Generally, you should not create more than 20 threads per processor. MaxPoolThreads is a REG_DWORD registry entry located at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\InetInfo\Parameters\ with a default value of 4.
Configure ASP.NET 2.0 MaxConcurrentRequests for IIS 7.5/7.0 Integrated mode
ASP.NET 2.0 restricts the number of concurrently executing requests instead of the number of threads concurrently executing requests. For synchronous scenarios, this will indirectly limit the number of threads because the number of requests will be the same as the number of threads. But for asynchronous scenarios, the number of requests and threads will likely be very different because you could have far more requests than threads. When you run ASP.NET 2.0 on IIS 7.5 in integrated mode, the minFreeThreads and minLocalRequestFreeThreads of the “httpRuntime” element in the machine.config are ignored. For IIS 7.5 Integrated mode, a DWORD named MaxConcurrentRequestsPerCPU within HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\2.0.50727.0 determines the number of concurrent requests per CPU. By default, the registry key does not exist and the number of requests per CPU is limited to 12. .NET Framework 3.5 SP1 includes an update to the v2.0 binaries that supports configuring IIS application pools via the aspnet.config file. This configuration applies to integrated mode only (Classic/ISAPI mode ignores these settings).The new aspnet.config config section with default values is listed below:
upload_2015-12-15_21-46-43.png

In IIS 7.5 Integrated Mode, the maxWorkerThreads and the maxIoThreads parameters in the “processModel” section of the machine.config file are not used to govern the number of running requests, but they are still used to govern the size of the CLR thread pool used by ASP.NET. When the “processModel” section of the machine.config has “autoConfig=true” (which is the default setting), this will give the application pool up to 100 worker threads (MaxWorkerThreads) per logical CPU. So a common commodity server with 2 dual-core CPUs would have 400 MaxWorkerThreads. This should be sufficient for all but the most demanding applications.
Specifies configuration settings that are used by ASP.NET to manage process-wide behavior when an ASP.NET application is running in Integrated mode on IIS 7.0 or a later version.
This element and the feature it supports only work if your ASP.NET application is hosted on IIS 7.0 or later versions.
<configuration> Element
<system.web> Element (Web Settings)
<applicationPool> Element (Web Settings)
upload_2015-12-15_21-47-12.png

Enabling CPU Monitoring in IIS
The CPU monitoring feature monitors and automatically shuts down worker processes that consume large amounts of CPU time. CPU monitoring is enabled for individual application pools.Before enabling CPU monitoring, take note of the following:
  • IIS must be operating in Worker Worker Process Isolation (you can isolate one application from another so that an erro in one application does not affect another application running in a different process. This application isolation mode provides better isolation while not incurring a performance penalty for isolation Worker process isolation mode loads application code — for example, ASP and ASP.NET applications)
  • monitoring is available only for application pools.
  • CPU monitoring does not apply to CGI applications.

To enable CPU monitoring
  1. In IIS Manager, expand the local computer, expand the Application Pools folder, right-click the application pool for which you want to enable CPU accounting, and click Properties.
  2. Click the Performance tab, and select the Enable CPU monitoring check box.
  3. In the Maximum CPU use box, click the up and down arrows to set the maximum percentage of the CPU the application pool should use. If the application pool uses more than the designated maximum, IIS generates an error in the Windows Events log.
  4. In the Refresh CPU usage numbers (in minutes) box, click the up and down arrows to set the refresh rate.
  5. In the Action performed when CPU usage exceeds maximum CPU use list box, click the appropriate action for the designated application pool.
    • To have IIS write an event to the system log when the application pool reaches the maximum CPU usage, without shutting the application pool down, click No Action.
    • To shut down the application pool in addition to logging an event in the system log, click Shutdown.
    • By default, No Action is selected.
    • Important - Shutting down the application pool shuts down all worker processes that serve that application pool.
  6. Click Apply, and then click OK.
Improving IIS Scalability and Availability with Network Load Balancing
The best way to guarantee the scalability and availability of your Internet services is to host your site with more than one computer. Microsoft Windows Server 2003 includes the Network Load Balancing service. Network Load Balancing enhances the availability and scalability of Internet server applications such as those used on Web, File Transfer Protocol (FTP), firewall, proxy, and virtual private network (VPN) servers, in addition to other mission-critical servers. A single computer running Windows can provide a limited level of server reliability and scalable performance. However, by combining the resources of two or more computers running Windows Server 2003 into a single cluster, Network Load Balancing can deliver the reliability and performance that Web servers and other mission-critical servers need. Figure shows two connected Network Load Balancing clusters. The first cluster consists of two hosts and the second cluster consists of four hosts.
upload_2015-12-15_21-53-16.png

Each host runs separate copies of the server applications, such as those for a Web, FTP, or Telnet server. Network Load Balancing distributes incoming client requests across the hosts in the cluster. The load weight to be handled by each host can be configured as necessary. You can also dynamically add hosts to the cluster to handle the increased load.
Enable IIS HTTP compression
To more efficiently use available bandwidth, enable IIS HTTP compression. HTTP compression provides faster transmission time between compression-enabled browsers and IIS, regardless of whether your content is served from local storage or a UNC resource.
To configure compression at the Web server level:
1. Click Start, point to All Programs, click Administrative Tools, and then click Internet Information Services (IIS) Manager.
2. In the Connections pane, select the Web server, click to select Features View, and then double-click the Compression feature.
3. Set the desired compression options and then click Apply in the Actions pane.
To configure compression at the Web site level:
1. Click Start, point to All Programs, click Administrative Tools, and then click Internet Information Services (IIS) Manager.
2. In the Connections pane, click to expand Sites, click to select the Web site for which you would like to configure compression, click to select Features View, and then double-click the Compression feature.
3. Set the desired compression options and then click Apply in the Actions pane.
Configure HTTP expires header
This feature helps to minimize the number of http requests send to IIS by website visitors. HTTP expires header will help the client browser to cache webpages and its elements such as images, CSS etc. To set http expires you need to follow these steps:
1. click on HTTP response headers in the IIS, and then click on “set common headers”.
2. Next select ‘expire web contents” and select the number of days or hours—this is total time your contents will be cached in the client’s browser.
upload_2015-12-15_21-55-1.png

Enable Output caching
When you enable “output caching”, IIS will keep a copy of requested webpages. If a new user requests the very same webpage located in the cache, IIS will send the copy from its cache without reprocessing the contents. Output caching can significantly improve your server response time for dynamic contents. This eliminates the requirement to reprocess the page every time that it is requested. This is helpful when your content relies on an external program for processing, such as with a Common Gateway Interface (CGI) program, or includes data from an external source, such as from a remote share or a database.
Connection Limit in IIS
This option can give you to control the connection in three ways:
- controlling connection timeout
- controlling maximum bandwidth per website
- controlling concurrent connections
The default connection timeout for IIS 7.5 is 120 seconds, which means after this time http session will be terminated. When a user visit a page and keeps the page open for indefinite time without any activity, the IIS need to keep the connection alive—this causes IIS to spend computing resources for this connection to keep alive. For better performance, you need to keep this limit as low as possible, but not too short. For example, you can set this limit to 70 seconds. To change connection timeout you need to right click on website in IIS, and click on “manage website” .Then select “advanced settings”. Next, click on connection limits and set the value for connection timeout.
upload_2015-12-15_21-56-6.png

This connection limit option will allow you to set the maximum bandwidth per second and the maximum concurrent connection per second. The maximum allowed bandwidth make a site use only a certain amount of bandwidth per second—thus improving the performance of other sites in a shared web-hosting environment. Before you restrict bandwidth, you should monitor the network object counters If these counters indicate a possible problem, restricting bandwidth is one answer. You can configure bandwidth throttling for all Web and FTP sites on a server by completing the following steps:
1. In the Internet Information Services snap-in, right-click the icon for the computer that you want to work with, and then select Properties.
2. On the Internet Information Services tab, select the Enable Bandwidth Throttling check box.
3. In the Maximum Network Use box, type the maximum number of kilobytes per second (Kbps) you want IIS to use. Remember, this value is for all Web and FTP sites.
4. Click OK.
While you cannot configure bandwidth throttling for individual FTP sites, you can configure throttling for individual Web sites. To do so, complete these steps:
1. In the Internet Information Services snap-in, right-click the Web site you want to work with, and then select Properties.
2. On the Performance property sheet, select Enable Bandwidth Throttling.
3. In the Maximum Network Use box, type the maximum number of kilobytes per second you want the site to use.
4. Click OK.
Controlling the number of concurrent connection is another way to improve IIS performance and to improve the security of IIS as well. This option will allow only the specified number of clients to connect to the website at a given moment. So, if any malicious program tries to send numerous connection requests will be rejected by the IIS, and thus prevent your server becoming overloaded with requests during a DDoS attack.
References and More Information:
http://securitywing.com/8-effective-ways-to-improve-iis-7-5-performance/
http://msdn.microsoft.com/en-us/library/ee377050.aspx
http://technet.microsoft.com/en-us/library/bb727100.aspx
http://www.microsoft.com/technet/pr...aae-f444-443c-8b2a-520c2961408e.mspx?mfr=true
Author
admin
Views
67
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from admin