Sun Java System Web Server 7.0 Administrator's Guide

Configuring the Server for Content Compression

Sun Java System Web Server 7.0 supports HTTP content compression. Content compression allows you to increase delivery speed to clients and serve higher content volumes without increasing your hardware expenses. Content compression reduces content download time, a benefit most apparent to users of dialup and high-traffic connections.

With content compression, your Web server sends out compressed data and instructs the browser to decompress the data on the fly, thus reducing the amount of data sent and increasing page display speed.

Configuring the Server to Serve Pre-compressed Content

You can configure Sun Java System Web Server to generate and store pre-compressed versions of files in a specified directory. When configured, and only if an Accept-encoding: gzip header is received, all requests for files from a directory configured to serve pre-compressed content are redirected to requests for an equivalent compressed file from that directory if such a file exists. For example, if the Web server receives a request for myfile.html, and both myfile.html and myfile.html.gz exist, then those requests with an appropriate Accept-encoding header receive the compressed file.

To configure your server to serve pre-compressed content, perform the following steps:

ProcedureTo Change Pre-compressed Content Settings

  1. From the virtual server page, click the Content Management tab.

  2. Click General sub tab.

  3. Go to Compression > Precompressed Content section and select from the following options.

    • Precompressed Content — Enable/Disable. Allows you to instruct the server to serve pre-compressed content for the selected resource.

    • Age Checking — Specify whether to check if the compressed version is older than the non-compressed version.

      If selected, then the compressed version, even if it is older than the non-compressed version, will not be selected.

      If not selected, then the compressed version, even if it is older than the non-compressed version, will always be selected.

    • Insert Vary Header — Specifies whether to use a Vary: Accept-encoding header.

      If selected, then a Vary: Accept-encoding header is always inserted when a compressed version of a file is selected.

      If not selected, then a Vary: Accept-encoding header is never inserted.

  4. Click Save.

Configuring the Server to Compress Content on Demand

You can also configure the Sun Java System Web Server 7.0 to compresses transmission data on the fly. A dynamically generated HTML page doesn’t exist until a user asks for it. This is particularly useful for e-commerce-based Web applications and database-driven sites.

To configure your server to compress content on demand, perform the following steps:

ProcedureTo Compress Content on Demand

  1. From the virtual server page, click the Content Handling tab.

  2. Click General sub tab. Go to Compress Content on Demand section under Compression section.

  3. Select from the following options:

    • On—Demand Compression — Enable/Disable on-demand compression for the selected resource.

    • Insert Vary Header — Specify whether to insert a Vary: Accept-encoding header.

      If selected, then a Vary: Accept-encoding header is always inserted when a compressed version of a file is selected.

      If not selected, then a Vary: Accept-encoding header is never inserted.

    • Fragment Size — Specifies the memory fragment size in bytes to be used by the compression library (zlib) to control how much to compress at a time. The default value is 8096.

    • Compression Level — Specifies the level of compression. Choose a value between 1 and 9. The value 1 yields the best speed; the value 9 the best compression. The default value is 6, a compromise between speed and compression.

  4. Click Save.


    Note –

    Using CLI

    For enabling compression on demand through CLI, execute the following command.


    wadm> enable-on-demand-compression --user=admin 
    --password-file=admin.pwd --host=serverhost --port=8989 --config=config1 
    --vs=config1_vs_1 --insertvaryheader=true 
    --fragment-size=100 --compression-level=5

    See CLI Reference, enable-on-demand-compression(1).