ADC

Priority order for load balancing 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 load balancing virtual server.
  • Bind a service group to a load balancing virtual server. 
  • Bind a service group member to the load balancing 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 LB 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 load balancing services’ IP addresses.

Configure priority order for load balancing services

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

Note:

The lowest order number has the highest priority.

Command:

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

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

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

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

  • The virtual server (vs1) first 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, vs1 selects set 2 (s3 and s4) with order number 2.
  • If all the services in set 1 and set 2 are down, vs1 selects set 3 (s5 and s6) with order number 3.

Configure priority order for load balancing services using the CLI 

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

  1. Add an LB virtual server.

    add lb vserver vs1 HTTP 1.1.1.1 80

  2. Add LB services. 

    add service s[1-6] 2.2.2.[1-6] HTTP 80

  3. Set the order number and bind the services to the LB virtual server. 

    bind lb vserver vs1 s1 -order 1

    bind lb vserver vs1 s2 -order 1

    bind lb vserver vs1 s3 -order 2

    bind lb vserver vs1 s4 -order 2

    bind lb vserver vs1 s5 -order 3

    bind lb vserver vs1 s6 -order 3

Configure priority order for load balancing services using the GUI 

Prerequisites:

  • You have created a load balancing virtual server.
  • You have created services.

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

  1. Navigate to Traffic Management > Load Balancing > Virtual Servers, and double-click the load balancing virtual server.

  2. In Load Balancing Virtual Server, under the Services and Service Groups section, click Load Balancing Virtual Server Service Binding.

  3. In the Load Balancing Virtual Server Service Binding dialog box, click Add Binding. 

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

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

  6. Click Bind. 

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

Configure priority order for load balancing 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 virtual server (vs1). Using the - order <number> parameter, you have configured the priority order for services as follows: 

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

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

  • Set 3 (s5, s6) bound to vs1 – 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 vs1.

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 NetScaler 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 NetScaler 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 load balancing virtual server (vs1) 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 lb vserver vs1 -policyName pol1 -priority 10

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

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

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

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

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

To configure priority order for load balancing 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 an LB virtual server. 

    add lb vserver vs1 HTTP 1.1.1.1 80

  4. Bind the LB policy to the LB virtual server. 

    bind lb vs vs1 -policyName pol1 -priority 10

  5. Add LB services. 

    add service s[1-6] 2.2.2.[1-6] HTTP 80

  6. Set the order and bind the services to the LB virtual server. 

    bind lb vserver vs1 s1 -order 1

    bind lb vserver vs1 s2 -order 1

    bind lb vserver vs1 s3 -order 2

    bind lb vserver vs1 s4 -order 2

    bind lb vserver vs1 s5 -order 3

    bind lb vserver vs1 s6 -order 3

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

Prerequisites:

  • You have created a load balancing 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
    • Type
    • Value

      Note:

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

  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 LB virtual server:

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

  2. In Advanced Settings, click Policies.

  3. In the Policies section, click the plus (+) icon.

  4. In the Choose Type dialog box, specify values for the following parameters:

    • Choose Policy: LB
    • Choose Type: Request
  5. Click Add Binding.

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

    • Select Policy
    • Priority
    • Goto Expression
    • Invoke LabelType
  7. Click Bind.

Step 4 - Configure priority order for load balancing services:

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

Persistence settings for services 

If persistence is configured for a service, then 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 lb param –overridePersistencyforOrder <YES/NO>

Let’s consider the following example: 

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

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

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

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

set lb 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 lb vserver -toggleorder<Ascending/Descending>

  • set lb 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 lb 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.