COMPRESS (JANUS DEFINE parameter): Difference between revisions
m (→References) |
m (misc cleanup) |
||
(12 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<span class="pageSubtitle"> COMPRESS level — type of outgoing compression</span> | |||
<span class="pageSubtitle" | |||
<var>COMPRESS</var> is a parameter on [[JANUS DEFINE]], which defines and sets characteristics of a Janus port. | <var>COMPRESS</var> is a parameter on <var>[[JANUS DEFINE]]</var>, which defines and sets characteristics of a Janus port. | ||
==Overview== | ==Overview== | ||
Indicates the type of compression to be performed on outgoing <var class="product">[[Janus Web Server]]</var> 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). | |||
Indicates the type of compression to be performed on outgoing | <p class="note"> | ||
'''Note:''' 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.</p> | |||
==COMPRESS values== | ==COMPRESS values== | ||
<table class=" | <table class="thJustBold"> | ||
<tr><th>0</th> | <tr><th>0</th> | ||
<td>Perform no compression. This is the default.</td></tr> | <td>Perform no compression. This is the default.</td></tr> | ||
<tr><th>1</th> | <tr><th>1</th> | ||
<td>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.</td></tr> | <td>Perform deflate compression with fixed Huffman codes. | ||
<p> | |||
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.</p></td></tr> | |||
<tr><th>2</th> | <tr><th>2</th> | ||
<td>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. | <td>Perform deflate compression with dynamic Huffman encoding. | ||
</td></tr> | <p> | ||
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. </p></td></tr> | |||
</table> | </table> | ||
Line 26: | Line 29: | ||
<ul> | <ul> | ||
<li>The <var>COMPRESS</var> setting on a port can be overridden on a URL basis with a <var>JANUS WEB ON</var> rule and on an application basis with <code>[[$Web_Set]]('COMPRESS')</code>. However, under <var class="product">Sirius Mods</var> Version 6.3, unless the <var>COMPRESS</var> parameter appears in the <var>JANUS DEFINE</var> command for a port, no compression will be performed no matter what the <var>JANUS WEB ON</var> rule or <var>$Web_Set</var> <var>COMPRESS</var> setting specifies. | |||
<p> | |||
Under <var class="product">Sirius Mods</var> Version 6.4 and later, '''no''' compression is performed unless the <var>[[NCMPBUF parameter|NCMPBUF]]</var> system parameter is set to a non-zero value. If <var>NCMPBUF</var> is set to a non-zero value, the type of compression performed for a URL is determined by the <var>[[JANUS DEFINE]]</var> command, which can be overridden by a <var>JANUS WEB ON</var> rule, which can be overridden with <var>$Web_Set</var>. </p></li> | |||
<li> | <li>If you want no compression to be the default but want to apply compression selectively for some URLs or applications, you '''must''' explicitly specify <code>COMPRESS 0</code> in the <var>JANUS DEFINE</var> command, and, if <var class="product">Sirius Mods</var> Version 6.4 or later, you must specify a non-zero <var>NCMPBUF</var> value for User 0. </li> | ||
Under | <li>Under <var class="product">Sirius Mods</var> 6.3, a <var>JANUS DEFINE COMPRESS</var> setting allocates an extra compression buffer for each of the port's threads. This buffer is allocated at port START time, unless the <var>[[ALLOCC (JANUS DEFINE parameter)|ALLOCC]]</var> parameter is specified on the port definition. If <var>ALLOCC</var> 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. | ||
<p> | |||
Under <var class="product">Sirius Mods</var> 6.4 and later, a <var>JANUS DEFINE COMPRESS</var> setting allocates only as many extra buffers as the value of <var>NCMPBUF</var>, but these buffers are nearly five times as large as the 6.3 compression buffers. </p></li> | |||
<li>It is recommended that any site interested in using compression experiment with the <var>COMPRESS</var> parameter to determine compression efficiency and CPU overhead. <var class="product">Janus Web Server</var> issues message MSIR.0690 after compressing any data to indicate the success of the compression. | |||
<li>It is recommended that any site interested in using compression experiment with the <var>COMPRESS</var> parameter to determine compression efficiency and CPU overhead. | |||
A typical message might look like this: | A typical message might look like this: | ||
<p class="code"> MSIR.0690: Janus Web content compressed by 65.2 | <p class="code"> MSIR.0690: Janus Web content compressed by 65.2 percent from 8744 to 3048 bytes | ||
</p></li> | |||
</p> | |||
<li> | <li><var>COMPRESS</var> is valid only for <var>[[JANUS DEFINE#type|WEBSERV]]</var> ports.</li> | ||
</ul> | </ul> | ||
==See also== | ==See also== |
Latest revision as of 15:25, 23 April 2015
COMPRESS level — type of outgoing compression
COMPRESS is a parameter on JANUS DEFINE, which defines and sets characteristics of a Janus port.
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).
Note: 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
- COMPRESS is valid only for WEBSERV ports.