Optimizing IIS 6.0
This section takes a look at optimizing IIS 6.0 by using the IIS management console. The following are easy to adjust for and optimize for better web server performance. They mainly deal with conserving or giving back resources to your server, which increase overall server performance.
Managing Network Resources to Increase Overall Performance
To better the performance of IIS 6.0, you can do a number of things to improve network resource usage such as limiting connections, enabling keep-alives, setting connection timeouts, using HTTP compression, and throttling bandwidth.
Limiting server connections better optimizes performance by reserving bandwidth for the number of connections within the specified connection limit. This ensures that your users all get adequate bandwidth to process their requests, which also means faster server response time. It also helps protect against malicious attacks on the web server. You can determine how many connections are sufficient based on your peak load times for the server for a given web site. To set the connections limit, open the IIS snap-in. In Windows Server 2003, you can find it in the Administration Tools menu called IIS Manager. In the left pane, right-click the Web Sites folder and choose Properties. Click the Performance tab to open the Performance Property Sheet, as shown in Figure 1.
Figure 1 Setting a connection limit.
Looking at the "Web site connections" section, you can see that by default we are allowing for a total of up to 2,000,000,000 connections. That's a lot of connections! I don't have any websites that, when combined, even come close to this many connections at a time. By using a stats server program, you can determine about how many should be sufficient for all websites on your system. Setting the limit here spans all websites. You can choose to do individual websites only if you want to.
Enabling HTTP Keep-Alives
If you're hosting a web application, it is likely that a user makes numerous multiple requests during a session. Some applications use a lot of control loops that force the user to iterate through database records, making a request each time through taxing the server resources. To improve application and overall web server performance, make sure that this option is enabled. You can find it on the Web Site property sheet, as shown in Figure 2.
Figure 2 Enabling HTTP keep-alives.
HTTP keep-alives, which is already enabled by default, is a good choice for servers hosting web applications or database-driven web sites. Checking this option keeps a user's connection open while multiple requests are processed, without closing and re-establishing a new connection for each request Thus, server resources are conserved.
Setting Connection Timeouts
To further conserve your server's resources, set the Connection Timeout property on the Web Site property sheet shown in Figure 2. The default is 900 seconds, which is pretty generous. Unless you're hosting an application or web site that allows for users to sit idle before continuing, there is no need to keep the connection. I recommend reducing this amount by at least half. By doing so, your server trashes any connections that have been idle longer than the specified period of time, giving back resources for connections that are active.
Using HTTP Compression
To enable faster data transmission between your web server and a client's compression-enabled Internet browser (IE 5.0 and later by default), there is a property called HTTP Compression on the Service property sheet that, when enabled, will compress your application files. If your server is serving a lot of dynamic content and your processor workload is below 80 percent most of the time, turning this option on will increase performance and conserve bandwidth. To enable HTTP compression, click the Service tab in Web Sites Properties; you should see a screen similar to the one shown in Figure 3.
Figure 3 Enabling HTTP compression.
You can compress static files (static content), application files (dynamic content), or both. If you choose to compress static files, a copy of the compressed file must be made by IIS and stored in a temp directory. You can define which directory to use after static file compression is enabled. Dynamic files are compressed at runtime, and no compressed file copies are needed.
If you're an ISP, conserving bandwidth used to be very important. Although conservation is still important, more bandwidth has become more affordable, so not as much emphasis is placed on it. Limiting bandwidth can still improve your server's performance. If you're hosting multiple sites, you can specify the amount of bandwidth each site is to use. Giving priority to a high-traffic site, as opposed to one that isn't, can make a difference in performance. You can see a web site's bandwidth limit in the Bandwidth Throttling section of the Performance tab (refer to Figure 1). Use a stats monitoring tool to see how much bandwidth is sufficient for a site during peak load times, and then give a cushion to this value. After all your sites are tweaked with bandwidth throttling, it should improve overall server performance response times.