If you are using IIS 6.0, there is a nice little feature
called kernel caching that does not require any code changes to ASP.NET. When a
request is output-cached by ASP.NET, the IIS kernel cache receives a copy of
the cached data. When a request comes from the network driver, a kernel-level
driver (no context switch to user mode) receives the request, and if cached,
flushes the cached data to the response, and completes execution.
The following default setting in the Machine.config file
ensures that dynamically generated ASP.NET pages can use kernel mode caching,
subject to the requirements listed below.
Listing 2
<httpRunTime enableKernelOutputCache="true" . . ./>
Dynamically generated ASP.NET pages are automatically cached
subject to the following restrictions:
·
Pages must be retrieved by using HTTP GET requests. Responses to
HTTP POST requests are not cached in the kernel.
·
Query strings are ignored when responses are cached. If you want
a request for http://abc.com/myapp.aspx?id=1234 to be cached in the kernel, all
requests for http://abc.com/myapp.aspx are served from the cache, regardless of
the query string.
·
Pages must have an expiration policy. In other words, the pages
must have an Expires header.
·
Pages must not have VaryByParams.
·
Pages must not have VaryByHeaders.
·
The page must not have security restrictions. In other words, the
request must be anonymous and not require authentication. The HTTP.sys driver
only caches anonymous responses.
·
There must be no filters configured for the W3wp.exe file
instance that are unaware of the kernel cache.