Product Documentation

The Least Response Time Method

Aug 31, 2016

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

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 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 NetScaler 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 above.

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

 

Request-3

Service-HTTP-3

(N = 3)

N = 6

 

Request-4

Service-HTTP-1

(N = 6)

N = 8

Service-HTTP-1 and Service-HTTP-3 have the same N values.

Request-5

Service-HTTP-3

(N = 6)

N = 8

Request-6

Service-HTTP-2

(N = 7)

N = 8

Service-HTTP-2 has the lowest N value.

Request-7

Service-HTTP-1

(N = 8)

N = 15

Service-HTTP-1, Service-HTTP-2, and Service-HTTP-3 have the same N values.

Request-8

Service-HTTP-2

(N = 8)

N = 9

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

Nw = (N) * (10000 / weight)

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 services are not handling any active transactions, the NetScaler 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 above.

Request Received

Service Selected

Current Nw Value (Number of Active Transactions) * (10000 / Weight)

Remarks

Request-1

Service-HTTP-3

(Nw = 0)

Nw = 2500

Service-HTTP-3 has the lowest Nw value.

Request-2

Service-HTTP-3

(Nw = 2500

Nw = 5000

 

Request-3

Service-HTTP-3

(Nw = 5000)

Nw = 15000

 

Request-4

Service-HTTP-3

(Nw = 15000)

Nw = 20000

 

Request-5

Service-HTTP-3

(Nw = 20000)

Nw = 25000

 

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 = 33333.34

Service-HTTP-2 has the lowest Nw value.

Service-HTTP-1 is selected for load balancing when it completes its active transactions or when the Nw values of other services (Service-HTTP-2 and Service-HTTP-3) are equal to 105000.

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

To configure the least response time method, see Configuring a Load Balancing Method that Does Not Include a Policy.

When a load balancing virtual server is configured to use the least response time method with monitors, it uses the existing monitoring infrastructure to select the service with the smallest number of active transactions and the fastest average response time. Before you use the least response time method with monitoring, you must bind application-specific monitors to each service and enable least response time method mode on these monitors. The NetScaler appliance then makes load balancing decisions based on the response times it calculates from monitoring probes. For more information about configuring monitors, see Configuring Monitors in a Load Balancing Setup.

You can use the least response time method with monitors to select non-HTTP and non-HTTPS services. You can also use this method when several monitors are bound to a service. Each monitor determines the response time by using the protocol that it measures for the service that it is bound to. The virtual server then calculates an average response time for that service by averaging the results.

The following table summarizes how response times are calculated for various monitors.

Monitor

Response Time Calculation

PING

Time difference between the ICMP ECHO request and the ICMP ECHO response.

TCP

Time difference between the SYN request and the SYN+ACK response.

HTTP

Time difference between the HTTP request (after the TCP connection is established) and the HTTP response.

TCP-ECV

Time difference between the time the data send string is sent and the data receive string is returned.

A tcp-ecv monitor without the send and receive strings is considered to have an incorrect configuration.

HTTP-ECV

Time difference between the HTTP request and the HTTP response.

UDP-ECV

Time difference between the UDP send string and the UDP receive string.

A udp-ecv monitor without the receive string is considered to have an incorrect configuration.

DNS

Time difference between a DNS query and the DNS response.

TCPS

Time difference between a SYN request and the SSL handshake completion.

FTP

Time difference between the sending of the user name and the completion of user authentication.

HTTPS (monitors HTTPS requests)

Time difference is same as for the HTTP monitor.

HTTPS-ECV (monitors HTTPS requests)

Time difference is same as for the HTTP-ECV monitor

USER

Time difference between the time when a request is sent to the dispatcher and the time when the dispatcher response is received.

The following example shows how the NetScaler appliance selects a service for load balancing by using the least response time method with monitors. Consider the following three services:

  • Service-HTTP-1 is handling 3 active transactions and the response time is five seconds.
  • Service-HTTP-2 is handling 7 active transactions and the response time is one second.
  • Service-HTTP-3 is not handling any active transactions and the response time is two seconds.

The following diagram illustrates the process that the NetScaler appliance follows when it forwards requests.

Figure 3. How the Least Response Time Load Balancing Method Works When Using Monitors

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

N = Number of active transactions * Response time that is determined by the monitor

The virtual server delivers requests as follows:

  • Service-HTTP-3 receives the first request, because this service is not handling any active transaction.
  • Service-HTTP-3 receives the second, third, and fourth requests, because this service has the lowest N value.
  • Service-HTTP-2 receives the fifth request, because this service has the lowest N value.
  • Since both Service-HTTP-2 and Service-HTTP-3 currently have the same N value, the NetScaler appliance switches to the round robin method Therefore, Service-HTTP-3 receives the sixth request.
  • Service-HTTP-2 receives the seventh and eighth requests, because this service has the lowest N value.

Service-HTTP-1 is not considered for load balancing, because it is more heavily loaded (has the highest N value) when compared to the other two services. However, if Service-HTTP-1 completes its active transactions, the NetScaler appliance again considers that service for load balancing.

The following table summarizes how N is calculated for the services.

Request Received

Service Selected

Current N Value (Number of Active Transactions)

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

 

Request-3

Service-HTTP-3

(N = 4)

N = 6

 

Request-4

Service-HTTP-3

(N = 6)

N = 8

 

Request-5

Service-HTTP-2

(N = 7)

N = 8

Service-HTTP-1 and Service-HTTP-3 have the same N values.

Request-6

Service-HTTP-3

(N = 8)

N = 10

Request-7

Service-HTTP-2

(N = 8)

N = 9

Service-HTTP-2 has the lowest N value.

Request-8

Service-HTTP-1

(N = 9)

N = 10

 

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

The NetScaler appliance also performs load balancing by using the number of active transactions, response time, and weights if different weights are assigned to services. The NetScaler appliance selects the service by using the value (Nw) in the following expression:

Nw = (N) * (10000 / weight)

As in the preceding example, suppose Service-HTTP-1 is assigned a weight of 2, Service-HTTP-2 is assigned a weight of 3, and Service-HTTP-3 is assigned a weight of 4.

The NetScaler appliance delivers requests as follows:

  • Service-HTTP-3 receives the first request, because it is not handling any active transactions.
  • Service-HTTP-3 receives the second, third, and fourth requests, because this service has the lowest Nw value.
  • Service-HTTP-2 receives the fifth request, because this service has the lowest Nw value.
  • Service-HTTP-3 receives the sixth request, because this service has the lowest Nw value.
  • Service-HTTP-2 receives the seventh and the eighth requests, because this service has the lowest Nw value.

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

The following table summarizes how Nw is calculated for various monitors.

Request Received

Service Selected

Current Nw Value (Number of Active Transactions) * (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

 

Request-3

Service-HTTP-3

(Nw = 15000)

Nw = 20000

 

Request-4

Service-HTTP-3

(Nw = 20000)

Nw = 25000

 

Request-5

Service-HTTP-2

(Nw = 23333.34)

Nw = 26666.67

Service-HTTP-2 has the lowest Nw value.

Request-6

Service-HTTP-3

(Nw = 25000)

Nw = 30000

Service-HTTP-3 has the lowest Nw value.

Request-7

Service-HTTP-2

(Nw = 23333.34)

Nw= 26666.67

Service-HTTP-2 has the lowest Nw value.

Request-8

Service-HTTP-2

(Nw =25000)

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 the Nw value of the other services (Service-HTTP-2 and Service-HTTP-3) is equal to 75000.

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

Figure 4. How the Least Response Time Load Balancing Method with Monitors Works When Weights Are Assigned

To configure the least response time method using monitors, see Configuring a Load Balancing Method that Does Not Include a Policy.