When
discussing performance, there are many factors to consider, such as
hardware, other applications running, network bandwidth, and so on. We
are going to focus on four options in IIS 7.0 that can be used to
improve performance:
Output Caching
If
you enable output caching, IIS will keep a copy of previously requested
pages in memory. Subsequent requests will be returned from memory and
will not be reprocessed by IIS. You can really appreciate the
advantages of this feature when you’re using it with dynamic web
content (for example, with an ASP.NET page that queries a SQL database
for data to return to the client).
There are two output caching modes:
Keep in mind the following when using kernel mode:
Kernel
mode will not cache modules that run in user mode, such as
authentication or authorization. For example, if you are using basic
authentication with the kernel mode option, the content will not be
cached.
Kernel mode supports the varyByHeaders attribute but not varyBYQuerystring.
Output
caching can be configured on the web server or within individual
websites on the server. You also have the option to choose when you
would like to time out what is cached and force the server to reprocess
the content. The timeout interval relies on how often the data changes
in the web content. You can configure the File Caching Monitor to time
out what is cached after either a specified amount of time or when a
file changes. You can also define what file extensions the caching will
apply to, as shown in Figure 1.
Compression
You
can use HTTP compression to improve transmission of data by utilizing
less bandwidth. Compression can be applied to static files and/or
dynamic applications (see Figure 2). So in what type of scenarios would you use compression, and what are some things to keep in mind? Consider the following:
Static compression:
You use static compression when you need to improve transmission times
and when working with graphic-intensive sites. Keep in mind that you
use some CPU power for static compression, but compressed content can
be cached.
Dynamic compression:
You use dynamic compression when you have a small number of requests
and/or limited network bandwidth. Keep in mind that you use CPU power
and RAM for dynamic compression, and compressed content cannot be
cached.
Compression can be configured at the web server level or at each individual website.
Note
Dynamic
Content Compression is not installed with the default installation of
the Web Server role. To add this functionality, you need to first add
the Dynamic Content Compression role service in Server Manager, under
the Web Server role.
Logging Frequency
Logging
too much information has a negative impact on performance. A best
practice with logging is to log as little information as possible for
day-to-day normal utilization. If you are having issues with your site
or web server, then it might be time to turn up the logging level to
include failed request tracing and try to determine what is going on.
To enable failed request tracing in IIS Manager, do the following:
1. | Select the website on which you would like to enable failed request tracing.
|
2. | In
the Actions pane, click Failed Request Tracing to bring up the Edit Web
Site Failed Request Tracing Settings dialog box, shown in Figure 3.
|
3. | Click
the Enable box and select the directory where you would like to create
the log files and the maximum number of trace files desired. It is a
good idea to move the log file creation to a separate volume because
you usually do not want logging files to grow on your system drive.
|
To configure other day-to-day logging, use the Logging applet to set items such as the following:
Format
Directory
Encoding
Log file rollover
Windows Server Resource Manager (WSRM)
WSRM
enables you to control how server resources such as CPU and RAM are
allocated to applications, services, and processes. You can use this
tool to allocate CPU to application pools in IIS. You can see more
information on WSRM and its use with IIS 7.0 at http://learn.iis.net/page.aspx/449/using-wsrm-to-manage-iis-70-apppool-cpu-utilization/.