Product Documentation

LRTM method

Note: LRTM stands for Least response time method using monitors (LRTM).

When a load balancing virtual server is configured to use the LRTM method, it uses the existing monitoring infrastructure to get the fastest response time. The load balancing virtual server then selects the service with the smallest number of active transactions and lowest response time. Before you use the LRTM method, you must bind application-specific monitors to each service and enable LRTM mode on these monitors. The NetScaler appliance then makes load balancing decisions based on the response times it calculates from monitoring probes. You can use the LRTM method to load balance non-HTTP and non-HTTPS services also. 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 LRTM method. 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 1. How the LRTM Method Works

least-response-time-mechanism

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 * 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-3; (N = 6) N = 8 Service-HTTP-3 has the lowest N value.
Request-5 Service-HTTP-2; (N = 7) N = 8 Service-HTTP-2 has the lowest N value..
Request-6 Service-HTTP-3; (N = 8) N = 10 Service-HTTP-2 and Service-HTTP-3 have the same N values. Citrix ADC appliance switches to the round robin method and selects Service-HTTP-3
Request-7 Service-HTTP-2; (N = 8) N = 9 Service-HTTP-2 has the lowest N value.
Request-8 Service-HTTP-2; (N = 9) N = 10 Service-HTTP-2 has the lowest N value.

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

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

The following diagram illustrates how the virtual server uses the LRTM method when weights are assigned.

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

LRTweights

In this 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, 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 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 (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 LRTM load balancing method by using the CLI

At the command prompt type;

set lb vserver <name> [-lbMethod <lbMethod>]

Example:

set lb vserver Vserver-LB-1 -lbMethod LRTM

To configure the LRTM 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 LRTM.

To enable the LRTM option in monitors by using the CLI

At the command prompt type;

set lb monitor <monitorName> <type> [-LRTM ( ENABLED | DISABLED )]

Example:

set lb monitor monitor-HTTP-1 HTTP -LRTM ENABLED

To enable the LRTM option in monitors by using the GUI

  1. Navigate to Traffic Management > Load Balancing > Monitors, and open a monitor.
  2. In Advanced Parameters, select LRTM (Least Response Time using Monitoring).

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

LRTM method