Total Pageviews

Monday, August 20, 2012

Optimize IIS Performance (IIS 7)

IIS 7 provides a powerful, unified facility for output caching by integrating the dynamic output-caching capabilities of ASP.NET with the static output-caching capabilities that were present in IIS 6.0. IIS also lets you use bandwidth more effectively and efficiently by using common compression mechanisms such as Gzip and Deflate. Performance includes the following features:
  • Compression
  • Output Caching
HTTP compression lets you make more efficient use of bandwidth and enhances the performance of sites and applications. You can configure HTTP compression for both static and dynamic sites.

Output caching allows you to manage output caching rules and to control the caching of served content. In IIS Manager, you can create caching rules, edit existing caching rules, and configure output cache settings.

http://technet.microsoft.com/en-us/library/cc771003(v=ws.10)

If your sites use lots of bandwidth, or if you want to use bandwidth more effectively, enable compression to provide faster transmission times between IIS and compression-enabled browsers. If your network bandwidth is restricted, as it is, for example, with mobile phones, compression can improve performance.
IIS provides the following compression options:
  • Static files only
  • Dynamic application responses only
  • Both static files and dynamic application responses
Compression of dynamic application responses can affect CPU resources because IIS does not cache compressed versions of dynamic output. If compression is enabled for dynamic responses and IIS receives a request for a file that contains dynamic content, the response that IIS sends is compressed every time it is requested. Because dynamic compression consumes significant CPU time and memory resources, use it only on servers that have slow network connections but that have CPU time to spare.
Unlike dynamic responses, compressed static responses can be cached without degrading CPU resources.
Enable Output Caching (IIS 7)
The procedures for configuring output caching can be performed at the following levels in IIS:
  • Web Server
  • Site
  • Application
  • Physical and virtual directories
  • File (URL)
Modules and Handlers
The necessary modules and handlers must be installed on the Web server and enabled at the level at which you perform this procedure.
noteNote
Modules can be enabled at only the Web server, site, and application level, but handlers can be enabled at all levels.
The following modules are required:
  • FileCacheModule
  • HTTPCacheModule
  • SiteCacheModule
  • TokenCacheModule
  • UriCacheModule
The following handler is required:
  • None
Required Permissions
If you perform this procedure by using IIS Manager, you must be a member of the following IIS administrative role or roles:
  • Web Server Administrator
  • Site Administrator
  • Application Administrator
noteNote
If you are an IIS Manager user, you might not be able to perform this procedure if the related configuration elements are locked.
If you perform this procedure by using the Appcmd.exe, running WMI scripts, or editing configuration files, you must have write access to the target configuration file or files.


You can improve performance on your site or application by enabling output caching. Caching decreases the amount of processing time for requests made to your site or application by returning a processed copy of a Web page from the cache.
You should enable output caching if your site or application content requires complex or lengthy processing. For example, you might want to enable caching if your application retrieves information from a database. This will let you avoid making a call to the database every time that a particular Web page is requested. In addition to enabling output caching, you must also set up output cache rules to specify how you want content to be cached.

Optimize Output Caching for Dynamic Web Pages (IIS 7)

Internet Information Services (IIS) 7.0 has an output cache feature that caches dynamic content in memory (for example, output from your Microsoft® ASP.NET, classic Active Server Pages (ASP), PHP, or other dynamic pages). This helps to improve performance because the script used to generate dynamic output does not need to run for each request. The cache is able to vary the output that is cached, based on query string values and HTTP headers that are sent from the client to the server. The cache is also integrated with the HTTP.sys kernel mode driver to help improve performance speed.
IIS automatically caches static content (HTML pages, images, and style sheets) since these types of content do not change from request to request. IIS also detects changes in updated files and flushes the cache as needed.
The output from dynamic pages can now be cached in memory as well. However, not every dynamic page can use the output cache effectively. Pages that can be personalized, such as shopping cart or e-commerce transactions, cannot use the output cache because the dynamic output will probably not be requested repeatedly. Content output that results from a POST-type request to an HTML form also cannot be cached.
The output cache works well for pages that are semi-dynamic in nature, for example, when data is generated dynamically but is not likely to change from request to request based on the URL or the header information. Photo gallery applications, for instance, dynamically resize images for display on Web pages and can use the output cache to prevent the server from having to reprocess image resizing for each request.

http://technet.microsoft.com/en-us/library/dd239248(v=ws.10)

IIS supports two types of invalidation schemes for dynamic content. The first is a simple time-out period, using the configuration property CacheForTimePeriod. The other way to invalidate the cache is for IIS to detect a change to the underlying resource. The configuration property for this is CacheUntilChange. Use this type of invalidation scheme

No comments:

Post a Comment