ADC

Customize the hash algorithm for persistence across virtual servers

The Citrix ADC appliance uses hash-based algorithms for maintaining persistence across virtual servers. By default, the hash-based load balancing method uses a hash value of the IP address and port number of the service. If a service is made available at different ports on the same server, the algorithm generates different hash values. Therefore, different load balancing virtual servers might send requests for the same application to different services, breaking the pseudo-persistence.

As an alternative to using the port number to generate the hash value, you can specify a unique hash identifier for each service. For a service, the same hash identifier value must be specified on all the virtual servers. If a physical server serves more than one type of application, each application type should have a unique hash identifier.

The algorithm for computing the hash value for a service works as follows:

  • By default, a global setting specifies the use of port number in a hash calculation.
  • If you configure a hash identifier for a service, it is used, and the port number is not, regardless of the global setting.
  • If you do not configure a hash identifier, but change the default value of the global setting so that it does not specify use of the port number, the hash value is based only on the IP address of the service.
  • If you do not configure a hash identifier or change the default value of the global setting to use the port number, the hash value is based on the IP address and the port number of the service.

You can also specify hash identifiers when using the CLI to bind services to a service group. In the configuration utility, you can open a service group and add hash identifiers on the Members tab.

To change the use-port-number global setting by using the CLI

At the command prompt, type:

set lb parameter -usePortForHashLb (YES NO)

Example:

> set lb parameter -usePortForHashLb NO
 Done
>show lb parameter
Global LB parameters:
        Persistence Cookie HttpOnly Flag: DISABLED
        Use port for hash LB: NO
 Done
<!--NeedCopy-->

To change the use-port-number global setting by using the GUI

  1. Navigate to Traffic Managment > Load Balancing > Configure Load Balancing parameters.
  2. Select or clear Use Port for Hash Based LB Methods.

To create a new service and specify a hash identifier for a service by using the CLI

At the command prompt, type the following commands to set the hash ID and verify the setting:

add service < name > (< ip > < serverName >) < serviceType > < port > -hashId < positive_integer >
show service <name>
<!--NeedCopy-->

Example:

> add service flbkng 10.101.10.1 http 80 -hashId 12345
 Done
>show service flbkng
        flbkng (10.101.10.1:80) - HTTP
        State: DOWN
        Last state change was at Thu Nov  4 10:14:52 2010
        Time since last state change: 0 days, 00:00:15.990
        Server Name: 10.101.10.1
        Server ID : 0   Monitor Threshold : 0

        Down state flush: ENABLED
        Hash Id: 12345

1)      Monitor Name: tcp-default
                State: DOWN     Weight: 1

 Done
<!--NeedCopy-->

To specify a hash identifier for an existing service by using the CLI

Type the set service command, the name of the service, and -hashID followed by the ID value.

To specify a hash identifier while adding a service group member

To specify a hash identifier for each member to be added to the group and verify the setting, at the command prompt, type the following commands (Be sure to specify a unique hashID for each member.):

bind servicegroup <serviceGroupName> <memberName> <port> -hashId <positive_integer>

show servicegroup <serviceGroupName>
<!--NeedCopy-->

Example:

 bind servicegroup http_svc_group 10.102.27.153 80 -hashId 2222222

>show servicegroup SRV
        SRV - HTTP
        State: ENABLED  Monitor Threshold : 0
        …

        1)         1.1.1.1:80   State: DOWN     Server Name: 1.1.1.1    Server ID: 123  Weight: 1
        Hash Id: 32211

                Monitor Name: tcp-default       State: DOWN
        …

        2)         2.2.2.2:80   State: DOWN     Server Name: 2.2.2.2    Server ID: 123  Weight: 1
        Hash Id: 12345

                Monitor Name: tcp-default       State: DOWN
        …
Done

<!--NeedCopy-->

To specify a hash identifier for a service by using the GUI

  1. Navigate to Traffic Management > Load Balancing > Services.
  2. Create a new service, or open an existing service and specify the hash ID.

To specify a hash identifier for an already configured service group member by using the GUI

  1. Navigate to Traffic Management > Load Balancing > Service Groups.
  2. Open a member and type a unique hash ID.