Output Caching
The <caching> element
allows you to enable or disable page output caching for an Internet Information
Services (IIS) application. This element also allows you to configure whether
IIS caches page output in user mode, kernel mode, or both and what, if any,
output caching limits you want to impose.
The <caching> element
also contains a <profiles> element that
contains a collection of output cache settings that you can apply to ASP.NET
pages.
Page output caching stores a response of a dynamic
page, such as an ASP page or an ASP.NET page, in memory after a browser
requests it.
Page output caching reduces server load and
response time. Output caching works best with pages that are semi-dynamic, such
as an ASP.NET page that is dependent on a database table that does not change
often.
Output caching is unnecessary for static files,
such as HTML, JPG, or GIF files, and can cause more memory overhead for dynamic
ASP.NET or PHP pages that read from a database that changes frequently.
Web content can be divided into two main
categories: static content and dynamic content.
·
Static content does not change from request to
request. The content that gets returned to the Web browser is always the same.
Examples of static content include HTML, JPG, or GIF files.
·
Dynamic content is output that changes with every
request. Examples include ASP.NET or PHP content.
To configure output caching
1.
Open IIS Manager, and then move to the server level.
2.
Double-click Output Caching.
3.
In the Actions pane,
click Add.
4.
In the Add Cache Rule dialog box, in the File name extension text box, type .php.
5.
Select the User-mode caching check box.
6.
Click Advanced.
7.
In the Advanced Output Cache Rule Settings
dialog box, select the Query string variable(s) check box, and then type your variables
in the text box.
8.
Click OK to close
the Advanced Output Cache Rule Settings and Add Cache Rule dialog boxes.
IIS provides two
options to enable caching.
1- Kernel-mode
level
2- User-mode
caching.
What is HTTP.sys here?
HTTP.sys is kernel mode device
driver which act as HTTP Listener which listens HTTP and HTTPs requests
directly from the network and then pass it to user mode for further processing.
If we cache
something at kernel mode then it will be very fast as it picks the request
direct from the network and return from here only if it is cached. It will even
save the whole IIS and ASP.NET pipeline.
It provides some
options while enabling it
1- File Change
notifications
2- Provide time
interval – Based on the provided time interval cache will be invalidated.
3- No cache
User-mode cache:
User mode caching is maintained at worker process
(w3wp.exe) level so it is more powerful and provide some more options than
kernel mode caching.
No comments :
Post a Comment