ADC

Least response time method

When the load balancing virtual server is configured to use the least response time method, it selects the service with the fewest active connections and the lowest average response time. You can configure this method for HTTP and Secure Sockets Layer (SSL) load balancing virtual servers only. The response time (also called Time to First Byte, or TTFB) is the time interval between sending a request packet to a service and receiving the first response packet from the service. The NetScaler appliance uses response code 200 to calculate TTFB.

The following example shows how a virtual server selects a service for load balancing by using the least response time method. Consider the following three services:

  • Service-HTTP-1 is handling three active transactions and TTFB is two seconds.
  • Service-HTTP-2 is handling seven active transactions and TTFB is one second.
  • Service-HTTP-3 is not handling any active transactions and TTFB is two seconds.

The following diagram illustrates how the NetScaler appliance uses the least response time method to forward the connections.

Figure 1. How the Least Response Time Load Balancing Method Works

Least response time mechanism

The virtual server selects a service by multiplying the number of active transactions by the TTFB for each service and then selecting the service with the lowest result. For the example shown above, the virtual server forwards requests as follows:

  • Service-HTTP-3 receives the first request, because the service is not handling any active transactions.
  • Service-HTTP-3 also receives the second and third requests, because the result is the lowest of the three services.
  • Service-HTTP-1 receives the fourth request. Since Service-HTTP-1 and Service-HTTP-3 have the same result, the NetScaler appliance chooses between them by applying the Round Robin method.
  • Service-HTTP-3 receives the fifth request.
  • Service-HTTP-2 receives the sixth request, because at this point it has the lowest result.
  • Because Service-HTTP-1, Service-HTTP-2, and Service-HTTP-3 all have the same result at this point, the appliance switches to the round robin method, and continues to distribute connections using that method.

The following table explains how connections are distributed in the three-service load balancing setup described earlier.

Request Received Service Selected Current N Value (Number of Active Transactions * TTFB) Remarks
Request-1 Service-HTTP-3;(N = 0) N = 2 Service-HTTP-3 has the lowest N value.
Request-2 Service-HTTP-3; (N = 2) N = 4 Service-HTTP-3 has the lowest N value.
Request-3 Service-HTTP-3; (N = 4) N = 6 Service-HTTP-3 has the lowest N value.
Request-4 Service-HTTP-1; (N = 6) N = 8 Service-HTTP-1 and Service-HTTP-3 have the same N values. The appliance uses the round robin method to distribute the requests.
Request-5 Service-HTTP-3; (N = 6) N = 8 Service-HTTP-1 and Service-HTTP-3 have the same N values.
Request-6 Service-HTTP-2; (N = 7) N = 8 Service-HTTP-2 has the lowest N value.
Request-7 Service-HTTP-3; (N = 8) N = 10 Service-HTTP-1,Service-HTTP-2 and Service-HTTP-3 have the same N values. The NetScaler appliance uses the round robin method to distribute the requests.
Request-8 Service-HTTP-1; (N = 8) N = 10 Service-HTTP-1 and Service-HTTP-2 have the same N values, the appliance uses the round robin method to distribute the requests.

Service-HTTP-1 is again selected for load balancing when it completes its active transactions or when its N value is less than the other services (Service-HTTP-2 and Service-HTTP-3).

Selection of services when weights are assigned

The following diagram illustrates how the NetScaler appliance uses the least response time method when weights are assigned.

Figure 2. How the Least Response Time Load Balancing Method Works When Weights Are Assigned

LRT weights

The virtual server selects a service by using the value (Nw) in the following expression:

Nw = (N) * (10000 / weight), where N = (number of active transactions * TTFB)

Suppose Service-HTTP-1 is assigned a weight of 2, Service-HTTP-2 is assigned weight of 3, and Service-HTTP-3 is assigned weight of 4.

The NetScaler appliance distributes requests as follows:

  • Service-HTTP-3 receives the first request, because it is not handling any active transactions.

    If the services are not handling any active transactions, the appliance selects them regardless of the weights assigned to them.

  • Service-HTTP-3 receives the second, third, fourth, and fifth requests, because this service has the lowest Nw value.

  • Service-HTTP-2 receives the sixth request, because this service has the lowest Nw value.

  • Service-HTTP-3 receives the seventh request, because this service has the lowest Nw value.

  • Service-HTTP-2 receives the eighth request, because this service has the lowest Nw value.

Service-HTTP-1 has the lowest weight and therefore the highest Nw value, so the virtual server does not select it for load balancing.

The following table explains how connections are distributed in the three-service load balancing setup described earlier.

Request Received Service Selected Current Nw Value = (N) * (10000 / Weight) Remarks
Request-1 Service-HTTP-3; (Nw = 0) Nw = 5000 Service-HTTP-3 has the lowest Nw value.
Request-2 Service-HTTP-3; (Nw = 5000 Nw = 10000 Service-HTTP-3 has the lowest Nw value.
Request-3 Service-HTTP-3; (Nw = 10000) Nw = 15000 Service-HTTP-3 has the lowest Nw value.
Request-4 Service-HTTP-3; (Nw = 15000) Nw = 20000 Service-HTTP-3 has the lowest Nw value.
Request-5 Service-HTTP-3; (Nw = 20000) Nw = 25000 Service-HTTP-3 has the lowest Nw value.
Request-6 Service-HTTP-2; (Nw = 23333.34) Nw = 26666.67 Service-HTTP-2 has the lowest Nw value.
Request-7 Service-HTTP-3; (Nw = 25000) Nw= 30000 Service-HTTP-3 has the lowest Nw value.
Request-8 Service-HTTP-2; (Nw = 26666.67) Nw = 30000 Service-HTTP-2 has the lowest Nw value.

Service-HTTP-1 is selected for load balancing when it completes its active transactions or when its Nw value is less than other services (Service-HTTP-2 and Service-HTTP-3).

To configure the least response time load balancing method by using the CLI

At the command prompt type;

set lb vserver <name> -lbMethod LEASTRESPONSETIME
<!--NeedCopy-->

Example:

set lb vserver Vserver-LB-1 -lbMethod LEASTRESPONSETIME
<!--NeedCopy-->

To configure the least response time load balancing method by using the GUI

  1. Navigate to Traffic Management > Load Balancing > Virtual Servers, and open a virtual server.
  2. In Advanced Settings, select LEASTRESPONSETIME.

For more information about configuring monitors, see Configuring Monitors in a Load Balancing Setup.

Least response time method