CTX108857
NetScaler
NetScaler_all
Other
2016-04-15
2015-02-12
This article contains information about the NetScaler Compression feature.

Information

This article contains information about the NetScaler Compression feature.

Background

The compression feature in a NetScaler appliance enables a NetScaler server to compress HTTP responses to compression-aware browsers. Virtually all current Web browsers are able to translate compressed HTTP data.

Initially, an administrator can see if compression is enabled through configurable policies by running the show ns feature command from the NetScaler Command Line Interface (CLI), or verify the GUI administration tool. Examples of each of these methods are in the following screen shots:

`User-added image

User-added image

A NetScaler server is configured to compress text in HTML, XML, plain text, CSS (Cascading Style Sheets), and Microsoft Office documents. NetScaler appliance does not compress images in GIF or JPG format. The major benefits of compressed traffic include reduced bandwidth costs, WAN latency reduction, and better server performance. There are many other benefits, and you can research these in various Marketing and Technical NetScaler documents.

NetScaler Compression Function

The NetScaler compression feature is based on GZIP/deflate-compatible compression (RFCs 1950/1951/1952). NetScaler compression can compress HTML data at a rate of about 3:1, depending on the type of data being compressed. Data with heavy formatting compresses well. Compression ratios, however, are not linear with data size.

Using COMPRESS and NO COMPRESS command line actions, NetScaler Administrators can define compression policies to enable or disable compression of specific types of responses. You can see this in the preceding screen shot. Responses that are sent back to clients are compressed, not requests.

Virtually all current NetScaler customers using the compression feature have compression enabled in Inline mode, which basically indicates that compression runs at the NetScaler server that is acting as a network traffic manager. At the highest level, server responses are checked by the NetScaler traffic manager server to see if they contain data that can be compressed. If the data can be compressed, the NetScaler compression engine first compresses the data, and then modifies the response header to indicate the type of compression completed. The data is then forwarded to the client. The following diagram is an example of an inline compression environment setup:

User-added image

Alternatively, compression can be enabled on non traffic-manager NetScaler servers. This method requires the customer to purchase several NetScaler servers. Therefore, the NetScaler traffic manager server forwards the compression work to NetScaler servers set up as pure compression accelerators. The compression engine(s) on these servers then handle compression duties. The following diagram illustrates an example of this environment:

User-added image

To set up this type of compression environment, compression is first configured on the NetScaler server acting as the traffic manager, and then it is set up on the NetScaler server acting as a pure accelerator.

Commands Used to Set Up Compression

To set up compression at the service level, run the set service command as follows:
set service <servicename> -cmp YES

When you configure a NetScaler appliance to perform inline compression, run the following commands from the CLI of the appliance to complete the following actions:

  1. Run the following command to enable both compression and load balancing feature:
    enable ns feature lb cmp

  2. Run the following commands to add HTTP services:
    add service cmpsvc_1 10.101.2.23 HTTP 80
    add service cmpsvc_2 10.101.2.24 HTTP 80

  3. Run the following command to define a virtual server for the load balancing:
    add lb vserver http_lb HTTP 10.101.2.106 80

  4. Run the following command to bind the services to the load balancing virtual server.
    bind lb vserver http lb cmpsvc_1
    bind lb vserver http_lb cmpsvc_2

When you configure a NetScaler appliance to perform compression on a dedicated NetScaler compression server, run the following commands from the CLI to complete the following tasks. The actual commands are dependent on SSL being configured or not. This article focuses on SSL enabled virtual servers.

  1. Run the following commands to configure the NetScaler server acting as the network traffic manager:
    enable ns feature ssl lb cs
    add cs vserver vip_origin SSL 10.101.2.25 443
    add lb vserver cmp lb HTTP
    add lb vserver http_lb HTTP 10.101.2.28 80
    add service cmp_1 10.101.2.40 HTTP 80
    add service cmp_2 10.101.2.42 HTTP 80
    bind lb vserver cmp_lb cmp1
    bind lb vserver cmp_lb cmp2
    add service svr_1 10.101.2.50 HTTP 80
    add service svr_2 10.101.2.52 HTTP 80
    bind lb vserver http_lb svr_1
    bind lb vserver http_lb svr_2
    add?? expression html_expr URL EQ "/*.html”
    add expression asp_expr URL EQ "/*.asp"
    add cs policy cmp_pol -rule ns_cmpc1ient &&
    (html_expr || asp_expr)”
    bind cs vserver vip_origin cmp_lb -policyname cmp_pol
    bind cs vserver vip_origin http_lb
    add certkey cert1 -cert /var/cert/certificate.pem
    -key /var/cert/key.pem
    bind certkey vip_origin cert1

  2. Run the following command to configure the NetScaler server acting as a compression accelerator:
    enable ns feature lb cmp
    add lb vserver cmp_1 HTTP 10.101.2.40 80
    add service http_lb 10.101.2.28 HTTP 80
    bind lb vserver cmp_1 http_lb

  3. If an environment has more than one compression accelerator NetScaler server configured (like the image above), run the following commands to configure the additional servers the same way you did the first, with the only difference being the name of the compression accelerator virtual server:
    enable ns feature lb cmp
    add lb vserver cmp_1 HTTP 10.101.2.40 80
    add service http_lb 10.101.2.28 HTTP 80
    bind lb vserver cmp_1 http_lb

Compression Policies

Compression policies can be configured to set conditions under which compression is preformed. By default, NetScaler appliance enables several policies when you enable compression at a global level. These policies can also be set to specific virtual servers.

To see what compression policies are set on the NetScaler appliance, run the show cmp global command from the CLI?? as displayed in the following screen shot: the description for each one of these policies is also detailed.

User-added image

Run the show cmp policy command to view all configured compression policies.

ns_nocmp_mozilla_4

This policy causes the NetScaler appliance not to compress CSS files when the request comes from the Mozilla Web browser.

ns_cmp_mscss

This policy causes the NetScaler appliance to compress CSS files when the request comes from Microsoft Internet Explorer.

ns_cmp_msapp

This policy causes the NetScaler appliance to compress files generated by the following Microsoft applications:

  • Microsoft Office Word

  • Microsoft Office Excel

  • Microsoft Office PowerPoint

ns_cmp_content_type

This policy causes the NetScaler appliance to compress text using the GZIP algorithm.

 > show cmp policy   5 Compression policies: 1)        Name: ns_cmp_content_type      Rule: ns_content_type           Response action: COMPRESS      Hits: 0 2)        Name: ns_cmp_msapp      Rule: (ns_msie && ns_msword || (ns_msexcel || ns _msppt))           Response action: COMPRESS      Hits: 0 3)        Name: ns_cmp_mscss Rule: (ns_msie && ns_css)           Response action: COMPRESS      Hits: 0 4)        Name: ns_nocmp_mozilla_47 (ns_mozilla_47 && ns_css)           Response action: NOCOMPRESS    Hits: 0 5)        Name: ff1     Rule: (REQ.HTTP.URL == /testsite/ file5.html && RES.HTTP. HEADER Server EXISTS)           Response action: GZIP    Hits: 0 Done

Configuring Customized Compression Policies

It is possible to also create custom policies using expressions and actions. The four compression actions a NetScaler appliance can perform are COMPRESS, NOCOMPRESS, GZIP, and DEFLATE. Custom policies can be made from both the GUI and the CLI. Using the GUI to complete this avoids the majority of possible syntax errors.

COMPRESS – When this action is selected, the NetScaler appliance uses the GZIP algorithm to compress data.

NOCOMPRESS – When this action is selected, the NetScaler appliance does not compress data.

GZIP – Same as COMPRESS.

DEFLATE – When this action is selected, the NetScaler appliance uses the DEFLATE algorithm to compress data.


Applicable Products


 

Join the conversation

Citrix Discussions

Open a case

Citrix Support

特别说明


本文来源为Citrix.com所有,翻译后版权归翻译者所有.如需转载请注明出处.

文档版本


.

广告招租


最新留言


.

广告招租


.