If you are looking for faster web page downloads, you can use HTTP
compression feature which compresses your content to speed it up. It is especially beneficial for
low bandwidth connections. This also reduces the number of bytes
transferred and improves the overall server performance.

How it Works

Browsers that support compressed content send an Accept-encoding header with
value gzip, deflate.
Our Web Server sees the header and chooses to provide compressed
content, and sends Content-encoding:
gzip response header. The browser on seeing this header tries to
decompress the content and renders it.

Now the question is how to enable HTTP compression feature can be
configured in obj.conf. Let me explain that in detail in this blog.

HTTP Compression of Static Files

For dynamic compression of static files in Sun
Java System Web Server
7.0 Update 2, we need to use compress-file
SAF with find-compressed
SAF.

The compress-file
function creates the compressed file in the subdirectory specified if
the file size is in between min-size
and max-size the first
time a request is sent on the URI. If Web Server needs to compress that
static file for every
static request then it may not really improve performance. It will
reduce the
network traffic but will cause more CPU usage. So content compression
will only happen once or until the uncompressed original file is
modified. If check-age is
set to true, it
recreates the compressed file if the compressed version is not as
recent as the non-compressed version. The find-compressed
function checks if a compressed
version of the requested file is available. If the following conditions
are met, find-compressed changes
the path to point to the compressed file:

A compressed version is available.

The compressed version is as recent as the non-compressed
version.

The client supports compression.

If the HTTP method is GET or HEAD.

Example

This is an example of how server compresses html
files and places them
in .compressed directory (relative to the original file location).
Modify the default object of obj.conf as shown below

However, if you plan to put precompressed
content in the location where the original file is present yourself,
you can just use find-compressed
SAF . A compressed version of a file must have
the same file name as the non-compressed version but with a .gz
suffix.
For example, the compressed version of a file named /httpd/docs/index.html
would be named /httpd/docs/index.html.gz. To
compress files, you can use the freely available gzip program.

HTTP Compression of Dynamic Content

The http-compression
filter compresses
outgoing dynamic content such as the output from SHTML
pages, CGI programs, or pages created with JavaServer PagesTM
(JSPTM) technology that
need to be interpreted by the server.

How do I test if my configuration is working or not

You can use telnet to submit HTTP requests,
impersonating a web
browser. The stuff in bold is the stuff I typed. Here's
an example on a Solaris machine testserver,
where I have a Web Server instance running on port 2600: