ADC

Least requests method

A load balancing virtual server configured to use the least request method selects the service that has received the fewest requests.

For example, consider three services, Service-HTTP-1, Service-HTTP-2, and Service-HTTP-3.

  • Service-HTTP-1 is handling 3 requests.
  • Service-HTTP-2 is handling 15 requests.
  • Service-HTTP-3 is not handling any requests.

The following diagram illustrates how NetScaler uses the least requests method to choose a service for each request that it receives.

Figure 1. How the Least Request Load Balancing Method Works

leastrequest-working

In this example, the virtual server selects the service for each incoming request by choosing the server with the fewest requests.

Requests are forwarded as follows:

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

    Note: The service with no request is selected first.

  • Service-HTTP-3 receives the second and third requests because the service has the next least number of requests.

  • Service-HTTP-1 receives the fourth request because Service-HTTP-1 and Service-HTTP-3 have the same number of requests, the virtual server uses the round robin method to choose between them.

  • Service-HTTP-3 receives the fifth request.

  • Service-HTTP-1 receives the sixth request, and so on, until both Service-HTTP-1 and Service-HTTP-3 are handling the same number of requests as Service-HTTP-2. Then, NetScaler starts forwarding requests to Service-HTTP-2 when it is the least loaded service or its turn comes up in the round robin queue.

Note:

If requests to Service-HTTP-2 is completed, it might get new request before each of the other two services has 15 requests.

The following table explains how requests are distributed among the services in the load balancing setup.

Incoming requests Service selected Current number of requests Remarks
Request-1 Service-HTTP-3; (N = 0) 1 Service-HTTP-3 has the fewest requests.
Request-2 Service-HTTP-3; (N = 1) 2 Service-HTTP-3 has the fewest requests.
Request-3 Service-HTTP-3; (N = 2) 3 -
Request-4 Service-HTTP-1; (N = 3) 4 Service-HTTP-1 and Service-HTTP-3 have the same number of requests.
Request-5 Service-HTTP-3; (N = 3) 4 Service-HTTP-1 and Service-HTTP-3 have the same number of requests.
Request-6 Service-HTTP-1;(N = 4) 5 -
Request-7 Service-HTTP-3; (N = 4) 5 -
Request-8 Service-HTTP-1; (N = 5) 6 -

Service-HTTP-2 is selected for load balancing when it completes all the requests, or when the other services (Service-HTTP-1 and Service-HTTP-3) have 15 or more requests each.

NetScaler can also use the least request method when weights are assigned to services. It selects a service by using the value (Nw) of the following expression:

Nw = (Number of active requests) * (10000 / weight)

The following example shows how NetScaler selects a service for load balancing by using the least request method when weights are assigned to services. 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. Requests are forwarded as follows:

  • Service-HTTP-3 receives the first request because the service is not handling any requests.

    Note: If the services are not handling any requests, NetScaler uses the round robin method regardless of the weights assigned to each of the services.

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

  • Service-HTTP-1 receives the seventh request. Because Service-HTTP-1 and Service-HTTP-3 now have the same Nw value, the appliance performs load balancing in a round robin manner. Therefore, Service-HTTP-3 receives the eighth request.

The following table explains how requests are distributed on the three-service load balancing setup that is described earlier.

Request Received Service Selected Current Nw (Number of requests) * (10000 / weight) value 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 = 7500
Request-4 Service-HTTP-3; (Nw = 7500) Nw = 10000
Request-5 Service-HTTP-3; (Nw = 10000) Nw = 12500
Request-6 Service-HTTP-3; (Nw = 12500) Nw = 15000
Request-7 Service-HTTP-1; (Nw = 15000) Nw = 20000 Service-HTTP-1 and Service-HTTP-3 have the same Nw values
Request-8 Service-HTTP-3; (Nw = 15000) Nw = 17500

Service-HTTP-2 is selected for load balancing when it completes its requests or when the Nw value of other services (Service-HTTP-1 and Service-HTTP-3) is equal to 50000.

The following diagram illustrates how NetScaler uses the least request method when weights are assigned to the services.

Figure 2. Mechanism of the Least Requests Load Balancing Method when Weights are Assigned

Assign weights and methods

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

Least requests method

In this article