This article describes how to configure HTTP Compression on the NetScaler appliance to prevent backend Web servers from sending compressed responses.
HTTP Compression is an available feature on the NetScaler appliance that you can enable to partially using compression policies, or fully offload compression normally performed on backend Web servers.
Compression is performed using GZIP/DEFLATES in compliance with RFC 1950, 1951, and 1952 to reduce bandwidth requirements and increase speed for client Web connections. To fully offload this functionality from the backend Web servers to the NetScaler, two available options are:
Note: This article reviews the steps necessary to complete the second option.
When the NetScaler appliance receives a compressed HTTP response from a backend server, the appliance does not attempt to compress the response. Compression statistics reflects this.
By removing the Accept Encoding header in the HTTP client requests, assuming that the backend server does not forcibly compress all responses, the server responds with an uncompressed response allowing the appliance to compress the response back to the client.
This effectively offloads the compression workload from the backend Web servers to the appliance because the uncompressed response is then processed by the appliance.
To ensure HTTP compression is offloaded to the appliance without disabling native HTTP compression on backend servers, you must modify an HTTP compression option. This is to ensure that it properly removes the Accept Encoding HTTP header from all client requests that are sent to NetScaler services with compression enabled.
If the client requests do not have the Accept Encoding header, all backend Web server responses will be uncompressed. This allows the appliance to process HTTP compression instead of the backend Web servers saving processing cycles on the servers.
The global parameter that controls whether this header is removed (or not) is the -serverCmp option using the set cmp parameter command. To enable this option, run the following command from the NetScaler command line interface:
set cmp parameter -serverCmp OFF
The preceding command results in the following output if you run the show cmp parameter command:
> show cmp parameter Configured compression parameters: Compression level: optimal Quantum size: 57344 Server-side compression: OFF Minimum HTTP response size for compression: 0 CPU load at which to bypass compression: 100% Compression on PUSH: DISABLED Compression policy type: CLASSIC Vary header insertion: DISABLED Disable external cache: NO
The following is the output of the command when the default settings are still applied:
> show cmp parameter Configured compression parameters: Compression level: optimal Quantum size: 57344 Server-side compression: ON Minimum HTTP response size for compression: 0 CPU load at which to bypass compression: 100% Compression on PUSH: DISABLED Compression policy type: CLASSIC Vary header insertion: DISABLED Disable external cache: NO
When completed, ensure that you enable the compression feature on the individual services sending Web traffic to the backend servers.
Run the following command to enable compression on an individual service:
set service Test-Service -CMP YES
Run the following command to verify if you have enabled compression on an individual service:
> show service Test-Service Test-Service (1.1.1.1:80) - HTTP State: DOWN Last state change was at Fri Feb 22 04:49:18 2013 Time since last state change: 14 days, 18:09:52.240 Server Name: TestServer Server ID : None Monitor Threshold : 0 Max Conn: 0 Max Req: 0 Max Bandwidth: 0 kbits Use Source IP: NO Client Keepalive(CKA): NO Access Down Service: NO TCP Buffering(TCPB): NO HTTP Compression(CMP): YES Idle timeout: Client: 180 sec Server: 360 sec Client IP: DISABLED Cacheable: NO SC: OFF SP: OFF Down state flush: ENABLED Appflow logging: ENABLED
After you verify the configuration, run the following command to save the configuration:
save config