COMPRESS (JANUS DEFINE parameter)

From m204wiki
Revision as of 17:07, 24 February 2012 by JAL2 (talk | contribs) (→‎Usage notes)
Jump to navigation Jump to search

<section begin="desc" /> COMPRESS level -- type of outgoing compression<section end="desc" />

COMPRESS is a parameter on JANUS DEFINE, which defines and sets characteristics of a Janus port. See the List of JANUS DEFINE parameters.

Overview

Indicates the type of compression to be performed on outgoing Janus Web Server data. Data compression reduces network bandwidth requirements for the compressed data but requires additional CPU resources to perform the compression. Janus provides deflate compression (RFC 1951), which is implemented on all modern web browsers and which works especially well for data that has frequently repeated, relatively long strings of bytes (for example, structured text data like HTML or XML).

No compression is ever performed on data with a mime-type that starts with image (for example image/gif or image/jpeg). Since most image formats are already compressed, trying to further compress them results in considerable CPU overhead and an increase in the size of the data sent (due to compression infrastructure overhead), but no real compression.

COMPRESS values

0 Perform no compression. This is the default.
1 Perform deflate compression with fixed Huffman codes. This type of deflate compression uses a set of Huffman codes defined by the deflate specification. This can save space for some types of data, since the tables required for decoding are not sent with the data. The fixed code tables work well for text data. The fixed codes are rarely optimal, though, because they must include encodings for each possible character, even when those characters are not present in the data.
2 Perform deflate compression with dynamic Huffman encoding. This type of deflate compression dynamically creates a set of Huffman codes that vary with the input data. This method creates an optimal set of codes for the data, but introduces a slight overhead because the decoding information must be sent with the data. This overhead is usually very small because the decoding tables themselves are also compressed with a special Huffman code. There is also a very slight CPU overhead in generating dynamic tables. Still, in most cases, dynamic codes yield better results than fixed codes. Since most text or character data consists of a relatively small number of characters, text data is usually a good candidate for, and gets fairly good compression with, dynamic Huffman encoding.


Usage notes

  • The COMPRESS setting on a port can be overridden on a URL basis with a JANUS WEB ON rule and on an application basis with $Web_Set('COMPRESS'). However, under Sirius Mods Version 6.3, unless the COMPRESS parameter appears in the JANUS DEFINE command for a port, no compression will be performed no matter what the JANUS WEB ON rule or $Web_Set COMPRESS setting specifies. Under Sirius Mods Version 6.4 and later, no compression is performed unless the NCMPBUF system parameter is set to a non-zero value. If NCMPBUF is set to a non-zero value, the type of compression performed for a URL is determined by the JANUS DEFINE command, which can be overridden by a JANUS WEB ON rule, which can be overridden with $Web_Set.
  • If you want no compression to be the default but want to apply compression selectively for some URLs or applications, you must explicitly specify COMPRESS 0 in the JANUS DEFINE command, and, if Sirius Mods Version 6.4 or later, you must specify a non-zero NCMPBUF value for User 0.
  • Under Sirius Mods 6.3, a JANUS DEFINE COMPRESS setting allocates an extra compression buffer for each of the port's threads. This buffer is allocated at port START time, unless the ALLOCC parameter is specified on the port definition. If ALLOCC is specified, the compression buffer is allocated at the time a thread receives a connection. In either case, the compression buffer is large (almost 64K bytes), so if a port has 30 threads defined, compression requires an extra 30 * 64K, or 1,920K of virtual storage. Under Sirius Mods 6.4 and later, a JANUS DEFINE COMPRESS setting allocates only as many extra buffers as the value of NCMPBUF, but these buffers are nearly five times as large as the 6.3 compression buffers.
  • It is recommended that any site interested in using compression experiment with the COMPRESS parameter to determine compression efficiency and CPU overhead. Janus Web Server issues message MSIR.0690 after compressing any data to indicate the success of the compression. A typical message might look like this:

    MSIR.0690: Janus Web content compressed by 65.2 - percent from 8744 to 3048 bytes

  • The COMPRESS parameter is available in Sirius Mods Version 6.3 and later.

COMPRESS is valid only for WEBSERV ports.

References

See: List of Janus commands | List of JANUS DEFINE parameters.