Citrix ADC

Priority order for GSLB services

The priority order for services feature enables you to prioritize the order for services or service groups based on the load balancing selection preferences. You can configure the priority order when you do the following:

  • Bind a service to a GSLB virtual server.
  • Bind a service group to a GSLB virtual server. 
  • Bind a service group member to the GSLB service group. 

Currently, you can configure the priority order for services using the following approaches. However, these approaches have the following limitations:  

  • Configuring a backup virtual server chain: The number of configuration lines is high, and you must run the show command several times to know the state of all the GSLB services for each virtual server.

  • Configuring the preferred location:  You must create location entries for all your application endpoints.

The priority order for services feature addresses the preceding limitations with fewer configuration commands, and helps you to accomplish the preferred location configuration without the need of location representation of all GSLB services’ IP addresses.

Configure priority order for GSLB services

To configure the priority order for GSLB services, the -order <number> parameter is added to the bind commands. 

Note:

The lowest order number has the highest priority.

Command:

bind gslb vserver <vservername> -servicename/servicegroupname <servicename/servicegroupname> -order <number>

For example, consider a set of services that are bound to a GSLB virtual server (gv1). Using the  - order <number> parameter, you can prioritize the order of selection of services as follows:

  • Set 1 (s1, s2) bound to gv1 – order 1 
  • Set 2 (s3, s4) bound to gv1 – order 2 
  • Set 3 (s5, s6) bound to gv1 – order 3 

After you bind the services to gv1, and when gv1 receives the client traffic, the order of selection of services is as follows:

  • The virtual server (gv1)  selects the services in set 1 (s1 and s2) with order number 1, because this set is assigned the lowest order number. By default, the lowest order number has the highest priority.
  • If all the services in set 1 are DOWN, gv1 selects set 2 (s3 and s4) with order number 2.
  • If all the services in set 1 and set 2 are down, gv1 selects set 3 (s5 and s6) with order number 3.

Configure priority order for GSLB services using the CLI 

To configure the priority order for the GSLB services, type the following commands at the command prompt: 

  1. Add GSLB sites.

    add gslb site site1 1.1.1.1

    add gslb site site2 1.1.1.2

  2. Add a GSLB virtual server.

    add gslb vserver gv1 HTTP

  3. Add GSLB services. 

    add gslb service gsvc1 1.1.1.3 http 80 -sitename site1

    add gslb service gsvc2 1.1.1.4 http 80 -sitename site2

    add gslb service gsvc3 1.1.1.5 http 80 -sitename site1

    add gslb service gsvc4 1.1.1.6 http 80 -sitename site2

    add gslb service gsvc5 1.1.1.7 http 80 -sitename site1

    add gslb service gsvc6 1.1.1.8 http 80 -sitename site2

  4. Set the order number and bind the services to the GSLB virtual server. 

    bind gslb vserver gv1 gsvc1 -order 1

    bind gslb vserver gv1 gsvc2 -order 1

    bind gslb vserver gv1 gsvc3 -order 2

    bind gslb vserver gv1 gsvc4 -order 2

    bind gslb vserver gv1 gsvc5 -order 3

    bind gslb vserver gv1 gsvc6 -order 3

Configure priority order for GSLB services using the GUI 

Prerequisites:

  • You have created GSLB sites.
  • You have created a GSLB virtual server.
  • You have created GSLB services.

To configure the priority order for GSLB services and bind them to the GSLB virtual server, do the following:

  1. Navigate to Traffic Management > GSLB > Virtual Servers and double-click the GSLB virtual server.

  2. In GSLB Virtual Server, under the GSLB Services and GSLB Service Group Binding section, click GSLB Virtual Server to GSLB Service Bindings.

  3. In the GSLB Services and GSLB Service Group Binding dialog, click Add Binding. 

  4. In the GSLB Service Binding dialog box, select a service.

  5. Type a number in the Order field to set the priority order for the service.

    Configure priority order and bind GSLB service

  6. Click Bind. 

  7. Repeat steps 1–6 to configure different priority order number for different services.

Configure priority order for GSLB services using LB policy commands

By default, the lowest order number has the highest priority. However, you can defer this default behavior using the new LB action and policy commands. You can configure the service selection order based on the incoming client traffic or client data.

For example, consider a set of services that are bound to a GSLB virtual server (gv1). Using the - order <number> parameter, you have configured the priority order for services as follows: 

  • Set 1 (s1, s2) bound to gv1 – order 1 

  • Set 2 (s3, s4) bound to gv1 – order 2 

  • Set 3 (s5, s6) bound to gv1 – order 3 

By default, the lowest order number has the highest priority. Therefore, the default priority order of preference is 1, 2, and 3 for services in set 1, set2, and set3, respectively. However, for a specific client traffic, you want to change the priority order to 3, 1, and 2. To achieve this, you can add an LB policy and bind it to gv1.

An LB policy command consists of two elements: a rule, and an action. The rule is associated with an action, which is performed if a request matches the rule. 

Note:

The LB policy commands are common for both LB and GSLB configuration and are applicable for the requests handled by the Citrix ADC appliance.

LB action

Expression:

add lb action <name> <type> <string>

Example:

add lb action act1 -type SELECTIONORDER -value 3 2 1

Parameters:

  • name: Name of the action. 

  • type: Type of action. 

  • string: Value for the specified action.

LB policy

Expression:

add lb policy <name> <rule> <action> <undefaction>

Example:

add lb policy pol1 -rule CLIENT.IP.SRC.EQ(8.8.8.8) -action act1

Parameters:

  • name: Name of the policy. 

  • rule: A rule consists of one or more expressions. The rule is associated with an action, which is performed if the request matches the rule. 

  • action: DROP, NOLBACTION, and RESET are supported. 

  • undefaction: The Citrix ADC appliance generates an undefined event (UNDEF event) when a request does not match a policy. You can use the set lb param -undefAction <action> command to set the undefined action. You can assign these actions to an undefined event: DROP, NOLBACTION, and RESET. 

Let’s consider an example where you add an LB action, LB policy, and bind the policy to a GSLB virtual server (gv1) as follows:

add lb action act1 -type SELECTIONORDER -value 3 1 2

add lb policy pol1 -rule CLIENT.IP.SRC.EQ(8.8.8.8) -action act1

bind gslb vserver gv1 -policyName pol1 -priority 20 - gotoPriorityExpression END -type REQUEST

The rule selects the client traffic that matches the IP address, 8.8.8.8, and sends that traffic to gv1. The LB action type (SELECTIONORDER) defines the service selection order. After you bind the LB policy to gv1, and when gv1 receives the client traffic from the IP address 8.8.8.8, the services are selected in the following order: 

  1. The virtual server (gv1) selects services in set 3 (s5 and s6) with priority order 3. 

  2. If all the services in set 3 are DOWN, gv1 selects set 1 (s1 and s2) with priority order 2.

  3. If all the services in set 3 and set 2 are down, the gv1 selects set 1 (s1 and s2) with order 1.

Configure priority order for GSLB services with LB policy commands using the CLI 

To configure priority order for GSLB services using LB policy commands, type the following commands at the command prompt: 

  1. Add an LB action. 

    add lb action act1 -type SELECTIONORDER -value 3 1 2

  2. Add an LB policy. 

    add lb policy pol1 -rule CLIENT.IP.SRC.EQ(8.8.8.8) -action act1

  3. Add GSLB sites.

    add gslb site site1 1.1.1.1

    add gslb site site2 1.1.1.2

  4. Add a GSLB virtual server. 

    add gslb vserver gv1 HTTP

  5. Bind the LB policy to the GSLB virtual server. 

    bind gslb vserver gv1 -policyName pol1 -priority 20 - gotoPriorityExpression END -type REQUEST

  6. Add GSLB services. 

    add gslb service gsvc1 1.1.1.3 http 80 -sitename site1

    add gslb service gsvc2 1.1.1.4 http 80 -sitename site2

    add gslb service gsvc3 1.1.1.5 http 80 -sitename site1

    add gslb service gsvc4 1.1.1.6 http 80 -sitename site2

    add gslb service gsvc5 1.1.1.7 http 80 -sitename site1

    add gslb service gsvc6 1.1.1.8 http 80 -sitename site2

  7. Set the order and bind the services to the GSLB virtual server. 

    bind gslb vserver gv1 gsvc1 -order 1

    bind gslb vserver gv1 gsvc2 -order 1

    bind gslb vserver gv1 gsvc3 -order 2

    bind gslb vserver gv1 gsvc4 -order 2

    bind gslb vserver gv1 gsvc5 -order 3

    bind gslb vserver gv1 gsvc6 -order 3

Configure priority order for GSLB services with the LB policy commands using the GUI 

Prerequisites:

  • You have created GSLB sites.
  • You have created a GSLB virtual server.
  • You have created services.

Step 1 - Create an LB Action:

  1. Navigate to AppExpert > LB > Actions.

  2. In LB Actions, click Add.

  3. In the Create LB Actions dialog box, specify values for the following parameters:

    • Action Name: act1
    • Type: SELECTIONORDER
    • Value: 3 1 2

      Note:

      The numbers in the Value field are separated by a space.

    Add LB action

  4. Click Create.

Step 2 - Create an LB Policy:

  1. Navigate to AppExpert > LB > Policies.

  2. In LB Policies, click Add.

  3. In the Create LB Policies dialog box, specify values for the following parameters:

    • Name: pol1
    • Action: act1
    • Undefined-Result Action: NOLBACTION
    • Expression: CLIENT.IP.SRC.EQ(8.8.8.8)

    Add LB policy

  4. Click Create.

Step 3 - Bind the LB policy to the GSLB virtual server:

  1. Navigate to Traffic Management >GSLB > Virtual Servers and double-click the GSLB virtual server.

  2. In GSLB Virtual Server, under the Advanced Settings section, click Policies.

  3. In the Policies section, click GSLB Virtual Server LB Policy Binding.

  4. In the Policy Binding dialog box, specify values for the following parameters:

    • Select Policy: pol 1
    • Priority: 10
    • Goto Expression: END

    Bind LB policy

  5. Click Bind.

Step 4 - Configure priority order for GSLB services:

To configure priority order for GSLB, see the Configure priority order for GSLB services using the GUI procedure.

Persistence settings for services 

If persistence is configured for a service, then the preference is always given to persistence, by default.

For example, consider a service with persistence configured and priority order 1. If a service with priority order 0 is UP, then preference is always given to the service with priority order 1. 

However, you can override this default behavior with the following CLI command: 

set gslb param -overridePersistencyforOrder<YES/NO>

Let’s consider the following example: 

A set of services is bound to a GSLB virtual server (gv1) with the following priority order: 

  • Set 1 (s1, s2) bound to gv1 – order 1 

  • Set 2 (s3, s4) bound to gv1 – order 2 

Type the following command at the command prompt to override persistency: 

set gslb parameter -overridePersistencyforOrder YES

If set 1 (services with persistence is configured) is DOWN, then set 2 services handle all the requests until set 1 services are UP. A persistence entry for priority 2 is created.

Let’s assume that after some time, the set 1 services are UP. Now, both set 1 and set 2 services are UP to handle the requests. In this scenario, new load balancing decisions are made as higher order services are UP. The persistence entry is overridden with a new load balancing entry. 

Priority toggle

With the priority toggle feature, you can toggle all the traffic to a low-priority service during version upgrade for a service with a higher priority order. You can use the following commands to toggle priority:

  • set gslb vserver –toggleorder <Ascending/Descending>

  • set gslb vserver v1 -orderthreshold 80

For example, let’s consider that there are two services with the following priorities: 

  • Service 1- order 0 
  • Service 2 – order 1 

By default, service 1 handles all the traffic. If service 1 needs to be upgraded, then the traffic needs to be rerouted to service 2. 

At the command prompt, type the following commands to toggle priority: 

set gslb vserver –toggleorder Descending

By default, 0 has higher priority. However, after priority toggling, 1 is considered as a higher priority. If persistence entry is present for the service, the persistence preference behavior is as explained in the Persistence settings for services section.