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).