What is HTTP compression?
Short answer
HTTP compression is the reduction of the amount of transferred data by compressing the response body before it is sent to the client; it is especially effective on text content such as HTML, CSS, JavaScript and JSON. The client states the algorithms it supports with the Accept-Encoding header in the request; if the server compresses the response, it indicates the algorithm it used with the Content-Encoding header. In TR7, compression is done through the Compression field of the HTTP vService, with the Compression profile assigned to it: the profile determines the algorithm (Compression Algorithm; default GZIP), the content types to be compressed (File Types), the level (Compression Level) and whether the compression is performed only by TR7 (Offloading). If the client does not state the algorithm in the profile in Accept-Encoding, the response is sent uncompressed.
Where It Is Used in TR7
| Where | Field / label | What for |
|---|---|---|
| Load Balancer → Profiles (L4-L7 Behavior Sets) → Compression | Compression Algorithm (GZIP default, DEFLATE) | The compression algorithm of the response |
| Same profile | File Types (default text/plain) | The content types to be compressed (Content-Type) |
| Same profile | Compression Level | The balance between the compression ratio and CPU usage |
| Same profile | Offloading (off by default) | The compression being performed only by TR7 instead of the Backend Service |
| Load Balancer → Load Balancer vService List → HTTP vService form | Compression | Assigning the profile to the vService; it exists only on the HTTP vService |
Common Misconceptions
- "All content must be compressed." Image, video and archive files are already compressed; compressing them again spends CPU and gains no size. TR7 compresses only the types in the File Types list.
- "Compression is independent of the client's support." TR7 looks at Accept-Encoding; a client that does not support the algorithm in the profile receives an uncompressed response.
- "The File types default covers HTML, CSS and JavaScript." A new profile comes with only
text/plain; the other types are added manually (How is compression (GZIP / DEFLATE) enabled; which content types should be compressed?).
How it is done in the documentation
