Product Documentation

# The Least Packets Method

Aug 31, 2016

A load balancing virtual server configured to use the least packets method selects the service that has received the fewest packets in the last 14 seconds.

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

• Service-HTTP-1 has handled three packets in last 14 seconds.
• Service-HTTP-2 has handled five packets in last 14 seconds.
• Service-HTTP-3 has handled two packets in last 14 seconds.

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

Figure 1. How the Least Packets Load Balancing Method Works

The NetScaler appliance selects a service by using the number of packets (N) transmitted and received by each service in the last 14 seconds. Using this method, it delivers requests as follows:

• Service-HTTP-3 receives the first request, because this service has the lowest N value.
• Since Service-HTTP-1 and Service-HTTP-3 now have the same N value, the virtual server switches to the round robin method. Service-HTTP-1 therefore receives the second request, Service-HTTP-3 receives the third request, Service-HTTP-1 receives the fourth request, Service-HTTP-3 receives the fifth request, and Service-HTTP-1 receives the sixth request.
• Since Service-HTTP-1, Service-HTTP-2, and Service-HTTP-3 all now have same N value, the virtual server switches to the round robin method for Service-HTTP-2 as well, including it in the round robin list. Therefore, Service-HTTP-2 receives the seventh request, Service-HTTP-3 receives the eighth request, and so on.

The following table summarizes how N is calculated.

Service Selected

Current N Value

Remarks

Request-1

Service-HTTP-3

(N = 2)

N = 3

Service-HTTP-3 has the lowest N value.

Request-2

Service-HTTP-1

(N = 3)

N = 4

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

Request-3

Service-HTTP-3

(N = 3)

N = 4

Request-4

Service-HTTP-1

(N = 4)

N = 5

Request-5

Service-HTTP-3

(N = 4)

N = 5

Request-6

Service-HTTP-1

(N = 5)

N = 6

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

Request-7

Service-HTTP-2

(N = 5)

N = 6

Request-8

Service-HTTP-3

(N = 5)

N = 6

Note: If you enable the RTSP NAT option on the virtual server, the NetScaler uses the number of data and control packets to calculate the number of packets for RTSP services. For more information about RTSP NAT option, see Managing RTSP Connections.

The NetScaler appliance also performs load balancing by using the number of packets and weights when a different weight is assigned to each service. It selects a 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 second, third, fourth, and fifth requests, because this service has the lowest Nw value.
• Service-HTTP-1 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.

The following table summarizes how Nw is calculated.

Service Selected

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

Remarks

Request-1

Service-HTTP-3

(Nw = 5000)

Nw = 5000

Service-HTTP-3 has the lowest Nw value.

Request-2

Service-HTTP-3

(Nw = 5000)

Nw = 7500

Request-3

Service-HTTP-3

(Nw = 7500)

Nw = 10000

Request-4

Service-HTTP-3

(Nw = 10000)

Nw = 12500

Request-5

Service-HTTP-3

(Nw = 12500)

Nw = 15000

Request-6

Service-HTTP-1

(Nw = 15000)

Nw = 20000

Service-HTTP-1 and Service-HTTP-3 have the same Nw value.

Request-7

Service-HTTP-3

(Nw = 15000)

Nw = 17500

Request-8

Service-HTTP-2

(Nw = 16666.67)

Nw = 20000

Service-HTTP-2 has the lowest Nw value.

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

Figure 2. How the Least Packets Method Works When Weights Are Assigned

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