Microsoft IIS 6.0Administrator's Consultant

Previous chapters in this part of the book focused on techniques you can use to monitor Internet Information Services (IIS) and to optimize server hardware. In this chapter you’ll learn how to optimize IIS and its related services. You’ll learn techniques for improving IIS performance, configuring automatic restarts of IIS, and getting the most from IIS applications. You’ll also learn advanced techniques for managing IIS through the Microsoft Windows Registry and the IIS metabase.

The Windows Registry contains configuration settings for the operating system, the server hardware, and all applications installed on the server, including IIS. The metabase contains configuration settings that are specific to the sites and virtual servers you’ve implemented on a particular server. Although you can manage most configuration settings through the IIS properties dialog boxes, you can change some properties only through editing the registry or the metabase directly. These settings typically are advanced values that you should change only when you have unique needs.

Strategies for Improving IIS Performance

In this section I examine strategies you can use to improve the performance of IIS. The focus of this section is on improving the overall responsiveness of IIS and not the underlying server hardware.

Removing Unnecessary Applications and Services

One of the most obvious ways to improve IIS performance is to remove resource drains on the server. Start by removing applications that might be affecting the performance of IIS, including:

If necessary, move these applications and services to a separate server. This will give IIS more resources to work with. For applications that you can’t move, see if there’s a way to run the applications only during periods of relatively low activity. For example, if you’re running server backups daily, see if you can schedule backups to run late at night when user activity is low.

System services are another area you can examine to see if there are unnecessary resource drains. Every service running on the server uses resources that can be used in other ways. You should stop services that aren’t necessary and set them to start manually. Before you stop any service, you should check for dependencies to ensure that your server isn’t adversely affected.

If you have a dedicated IIS server, the following services aren’t required in most instances:

Optimizing Content Usage

Your server’s responsiveness is tied directly to the content you’re publishing. You can often realize substantial performance benefits by optimizing the way content is used. IIS can handle both static and dynamic content. Although static content is passed directly to the requesting client, dynamic content must be processed before it can be passed to the client. This places a resource burden on the server that you can reduce by using static content.

Note

I’m not advocating replacing all dynamic content with static content. Dynamically generated content is a powerful tool for building highly customized and full-featured sites. However, if there are places where you’re using dynamic content for no specific reason, you might want to rethink this strategy.

When you use static content, keep in mind that you should set expire headers whenever possible. Expire headers allow the related files to be stored in the client’s cache, and this can greatly improve performance on repeat visits when the original content hasn’t changed. For details on setting expire headers, see the section entitled “Customizing Web Site Content and HTTP Headers” in Chapter 4, “Customizing Web Server Content.”

With dynamic content, you should limit your use of Common Gateway Interface (CGI) applications. CGI applications require more processor and memory resources than their Internet Server Application Programming Interface (ISAPI), Active Server Pages (ASP), and ASP.NET counterparts. Because of this, you should replace or convert CGI applications to ISAPI, ASP, or ASP.NET.

Whenever you work with ISAPI, ASP, or ASP.NET applications, try to push as much of the processing load onto the client as possible. This reduces the server resource requirements and greatly improves application responsiveness. One example of pushing processing to the client is to use client-side scripting to evaluate form submissions before data is sent to the server. This technique reduces the number of times information is sent between the client and the server; therefore, it can greatly improve the application’s overall performance.

To improve content-related performance, you might also want to do the following:

Optimizing ISAPI, ASP, and ASP.NET Applications

Improperly configured and poorly optimized applications can be major resource drains on an IIS server. To get the most from the server, you need to optimize the way applications are configured. Do the following to optimize applications:

Optimizing IIS Caching, Queuing, and Pooling

IIS uses many memory-resident caches and queues to manage resources. If you make extensive use of dynamic content or have a heavily trafficked site, you should optimize the way these caches and queues work for your environment. You might want to do the following:

Configuring Automatic Restarts of IIS

Chapter 2, “Core IIS Administration,” focused on core administration tasks for IIS. In that chapter you learned how to manage services and how to use the IIS Reset utility. To get the best performance from IIS, configure the IIS Admin Service to run the IIS Reset utility automatically if a problem occurs with the service. This allows IIS to recover automatically from most situations that otherwise would have stopped IIS from handling user requests altogether.

You can configure automatic restart of IIS by completing the following steps:

  1. From Administrative Tools, start the Computer Management console, and then connect to the computer whose services you want to manage.

  2. Expand the Services And Applications node by clicking the plus sign (+) next to it and then select Services.

  3. Right-click IIS Admin Service and then select Properties.

  4. Select the Recovery tab. Set the First Failure, Second Failure, and Subsequent Failures fields to Run A Program, as shown in Figure 15-1.

    Figure 15-1: Configure the IIS Admin Service to run the IIS Reset utility.

  5. In the Program field of the Run Program frame, type \%SystemRoot%\ System32\ Iisreset.exe.

  6. Click OK.

Категории