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.
Visual Basic
Concepts
What is an IIS Application?
An IIS
(Internet Information Server) application is a Visual Basic application that
lives on a Web server and responds to requests from the browser. An IIS
application uses HTML to present its user interface and uses compiled Visual
Basic code to process requests and respond to events in the browser.
To the
user, an IIS application appears to be made up of a series of HTML pages. To
the developer, an IIS application is made up of a special type of object called
a webclass, that in turn
contains a series of resources called webitems. The webclass acts as the central
functional unit of the application, processing data from the browser and
sending information to the users. You define a series of procedures that
determine how the webclass responds to these requests. The webitems are the
HTML pages and other data the webclass can send to the browser in response to a
request.
IIS
Applications vs. ASP Applications
IIS
applications bear a superficial resemblance to Active Server Pages
applications. Both types of applications present dynamic Web sites and perform
their processing on the server rather than the client. However, each has its
unique advantages. Active Server Pages are for script developers interested in
authoring Web pages, and offer the unique capability of intermingling script
with HTML. IIS applications are for Visual Basic developers building Web-based
applications, rather than Web pages. IIS applications allow for complicated
business processing and easy access from almost any browser or platform.
IIS Applications
vs. DHTML Applications
An IIS
application is also similar to another type of Internet application you can
create in Visual Basic — a DHTML application. Like IIS applications, DHTML
applications also allow you to respond to events in an HTML page. However,
there are several key differences between the two types of applications:
- Dependency —
DHTML applications are intended for use on intranets, and are dependent on
Internet Explorer 4.0 or later, while IIS applications can be used on the
Internet or an intranet. End users of an IIS application do not need a
specific operating system or browser.
- Object model —
DHTML applications use a different object model than IIS applications to
access and work with the elements on an HTML page. While IIS applications
use the Active Server Pages object model, DHTML applications use the
object model.
- Location of
processing — IIS applications are designed to perform most of their
processing on the Web server, but DHTML applications perform most of their
processing on the browser machine. You do not create any Web server
components when you create a DHTML application.
What is an Application Pool?
An Application Pool is a mechanism used by IIS to isolate
Web Applications, allowing you to have different configurations (security,
resource usage, etc) and preventing misbehaving applications from interfering
with other applications.
Generally, each Application Pool corresponds to one
worker process. A worker process is a windows process (w3wp.exe) which runs Web
Applications, and is responsible for handling requests sent to a Web Server for
a specific application pool.
What is Application Pool Recycling in IIS?
Recycling means the worker process that handles requests
for that application pool is terminated and a new one started. This is
generally done to avoid unstable states that can lead to application crashes,
hangs, or memory leaks.
By default IIS will use overlapped recycle method, which
keeps the old process up until the current requests are finished processing (or
a set timeout elapses) while the new process handles new requests. This ensures
service continuity so that you usually do not notice a recycle.
Where can I configure Automatic Application Pool
Recycling?
In Windows 2003
Go to Start -> Administrative Tools -> Internet
Information Services (IIS) Manager. Expand the server and the “Application
Pools” Group. Right-click the Application Pool you wish to configure and select
“Properties”. In the first tab you will find the recycling settings.
In Windows 2008 R2
Go to Start -> Administrative Tools -> Internet
Information Services (IIS) Manager. Expand the server and click on “Application
Pools”. In the center window right-click the Application Pool you wish to
configure and select “Recycling...” ( be careful not to click “Recycle...”
which will start a recycle).
You will be shown a two-step “wizard”. In the first half you will select which settings to use and in the second, which you want to log (in windows event logs) in case they are triggered.
What are the recommended values to use for Out Systems
Applications?
You can check the base initial recommended values for an
Out Systems Platform Installation in the Installation Checklist.
These values are only initial guidelines: you should
fine-tune your memory configuration by collecting performance data from
each application pool and adjusting these values accordingly.
The values should be:
- High enough not to cause unnecessary recycles under
load;
- Low enough that the recycle is triggered before it
affects other application pools.
After collecting data on real-world usage, you can parcel the available memory proportionally between the application pools. You should review these values periodically as the usage of your applications changes or you deploy new applications.
The <httpCompression> element
specifies the HTTP compression settings for Internet Information Services (IIS)
7. HTTP compression can provide faster transmission times between IIS and
client browsers that can accept compressed files.
Note: An HTTP client must initiate
communication for compressed content by sending the appropriate HTTP
Accept-encoding header. If a client is not capable of HTTP compression, it will
not pass that header and IIS 7 will always return uncompressed content.
There are two different types of compression that IIS 7 uses:
·
Static Compression:
IIS 7 caches compressed static content in the path that is specified by
the directory attribute, which increases compression
performance by eliminating the need to recompress content that has already been
compressed. After IIS 7 has compressed a file, subsequent requests are given
the compressed copy of the file from the cache directory.
The staticCompressionEnableCpuUsage and staticCompressionDisableCpuUsage attributes
specify when IIS 7 will compress static files based on CPU usage.
You should use
static compression with files that do not typically change, such as HTML files
(*.html, *.htm), text files (*.txt), Microsoft Office documents (*.doc, *.xls,
*.ppt), etc. The size of these files can be reduced through compression, which
reduces download times for client requests and reduces bandwidth on the server.
Note: Image files such
as *.jpg and *.png files are also static files, but typically they do not
benefit from HTTP compression because these image files are already compressed.
·
Dynamic Compression:
Unlike static
compression, IIS 7 performs dynamic compression each time a client requests the
content, but the compressed version is not cached to disk. This change is made
because of the primary difference between static and dynamic content. Static
content does not change. However, dynamic content is typically content that is
created by an application and therefore changes often, such as Active Server
Pages (ASP) or ASP.NET content. Since dynamic content should change often, IIS
7 does not cache it.
The dynamicCompressionEnableCpuUsage and dynamicCompressionDisableCpuUsage attributes
specify when IIS 7 will compress dynamic files based on CPU usage.
WINDOWS SERVER 2012 OR WINDOWS SERVER 2012 R2
On the taskbar, click Server Manager.
In Server
Manager, click the Manage menu,
and then click Add Roles and
Features.
In the Add
Roles and Features wizard, click Next.
Select the installation type and click Next.
Select the destination server and click Next.
On the Server
Roles page, expand Web
Server (IIS), expand Web
Server, expand Performance,
and then select Static Content
Compression and/or Dynamic
Content Compression. Click Next.
On the Select
features page, click Next.
On the Confirm
installation selections page, click Install.
On the Results page,
click Close.
Get Worker Processes ( w3wp.exe) List :
To get
list of running worker process, Open IIS Manager ( Run > Inetmgr ), Select root level from left site navigation
tree and from “Features View Panel” select “Worker Processes”
So from
the above list of worker processes you can get the details of Application Pool Name, Process ID, state of worker processes
along with CPU uses and memory uses.
Attach
Worker Processes (w3wp.exe) For Debugging :
From Visual studio Attach Process window you
will find the same list of worker process with the same Process ID. So
based on your application Pool name you can attach the process and start the
debugging.
What
else we can have from Worker Processes lists in IIS 7 Manager?
We have already identified the worker process
and Application Pool name which are more than enough for us to attach a process
from Visual Studio. Now what else we can get out of this list ? Yes we can have
enough information regarding worker process like
§
Worker
Process Current State
§
CPU
Uses by the worker process
§
Memory
uses by worker process
§
Current
Request Handling by Worker Process
What about the current Worker Process (w3wp.exe ) State ?
You can get the current status of worker
process from status column. Worker processes having 3 status as listed below
1.
Running
2.
Stopping
3.
Starting

What is the difference between Web Farm and Web Garden ?
If You have
configured your site as Web Garden, you can also get the list of all the
worker process in the worker processes list with the different worker
Process ID but all worker process should have a “Single Application
Pool “ .
Note: You will able to see only the worker process which are
in running state .