Sun Java System Web Server 7.0 Update 7 Administrator's Guide

Configuring the Server for Content Compression

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

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

Configuring the Server to Serve Pre-Compressed Content

You can configure the 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 the General sub tab.

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

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

    • Age Checking — Specifies 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 checked.

    • 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 server 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 the 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 the General sub tab. Go to Compression > Compress Content on Demand.

  3. Select from the following options:

    • On—Demand Compression — Enables/Disables on-demand compression for the selected resource.

    • Insert Vary Header — Specifies 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

    To enable 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).