When IIS receives a request, it first checks whether the browser
is compression-enabled or not. If the compression is enabled, IIS then checks
the file name extension to see if the requested file is a static file or
contains dynamic content. If the file contains static content, IIS checks to
see if the file has previously been requested and is already stored in a
compressed format in the temporary compression directory. If the file is not
stored in a compressed format, IIS sends the uncompressed file to the browser
and adds a compressed copy of the file to the temporary compression directory.
If the file is stored in a compressed format, IIS sends the compressed file to
the browser. Files are compressed only when they have been requested at least one
time by a browser.
If the file contains dynamic content, IIS compresses the
file as it is generated and sends the compressed file to the browser. Unlike
static content, no copy of the file is stored.
The cost of compressing a static file is modest and is typically incurred only
one time because the file is then stored in the temporary compression
directory. The cost of compressing dynamically generated files is a little
higher because they are not stored and must be regenerated with each request.
The cost of expanding the file at the browser is minimal. The download of compressed
files is faster and it is particularly beneficial to the performance of any
browser that uses a network connection with restricted bandwidth (a modem for
example).