Citrix NetScaler Load Balancing algorithm

Source: Internet
Author: User
Tags response code snmp netscaler

Citrix NetScaler Load Balancing algorithm

http://blog.51cto.com/caojin/1926308

As we all know, Citrix NetScaler, which delivers products as a new generation of applications, has the industry's leading data control, application delivery capabilities, but as one of the fundamental content of ADC capabilities, it is not possible to adapt to so many scenarios without a robust, diversified equalization algorithm It is also impossible to achieve good application delivery products. Therefore, it is necessary to discuss the more common load balancing algorithms here.

Currently, the latest version of NetScaler supports 17 equalization algorithms, and now discusses the 12 most commonly used

1. Polling Algorithm (Round Robin)

When NetScaler uses a polling load-balancing algorithm, it shifts requests from clients to servers in the background, starting at 1, until N (number of background servers), and then restarting the loop.

If you consider the processing power of the background server is different, you can assign different weights to each server, and adjust the probability of cyclic scheduling by setting the weight ratio.

2. Minimum connection algorithm (Least Connection)

When NetScaler uses the least-connected load-balancing algorithm, it is allocating new connection requests to the server with the smallest number of current connections. The minimum connection algorithm is a dynamic scheduling algorithm, which estimates the server load by the number of connections currently active on the server. The system records the number of connections that have been made to each server, and when a request is dispatched to a server, its number of connections increases by 1, and its number of connections is reduced by one when the connection is aborted.

If the processing power of the background server is considered different, you can assign different weights to each server, and adjust the scheduling probability of the minimum connection algorithm by setting the weight ratio.

3. Minimum response time

When NetScaler uses a load-balancing algorithm with a minimum response time, it is the server that assigns new connection requests to the least current number of connections and the least average response time. The scheduling factor of the minimum response time algorithm actually consists of two parts, i.e. the minimum number of connections per server and the average response time per server (the average response time here is TTFB, that is, the time the first byte arrives, and the HTTP protocol is response Code is 200 of the first byte of data returned time), the product of these two factors as the basis for the algorithm scheduling. The most recent connection request will be sent to the server with the smallest number of connections and the lowest average response time product.

If the processing power of the background server is different, you can assign different weights to each server, and adjust the scheduling probability of the minimum time-to-eat algorithm by setting the weight ratio.

4. Minimum bandwidth algorithm (Least Bandwidth)

When the NetScaler uses the least-bandwidth load-balancing algorithm, it is allocating new connection requests to the server with the smallest current traffic throughput (in bps).

If the processing power of the background server is considered different, you can assign different weights to each server, and adjust the scheduling probability of the minimum bandwidth algorithm by setting the weighting ratio.

5. Minimum packet algorithm (Least Packets)

When NetScaler uses the least-packet load-balancing algorithm, it is allocating the new connection request to the least-packet server. The minimum packet count is calculated by the number of packets processed on each server over the last 14 seconds.

If you consider the processing power of the background server is different, you can assign different weights to each server, and adjust the minimum packet algorithm scheduling probability by setting the weight ratio.

6. Token algorithm (tokens)

When NetScaler uses the token load balancing algorithm, it distributes new connection requests based on token information that accompanies the client request, and requests with the same token are assigned to the same backend server. Token algorithm is a scheduling algorithm based on content information, NetScaler can set the location and size of tokens (token), so that by searching for the same token, and send the request to the same background server.

The token algorithm can be applied to TCP, HTTP, and HTTPS service types, and can even be unique between different services. For the HTTP/HTTPS protocol, tokens can be obtained in the HTTP header or URL or HTTP body. NetScaler can search for configured tokens in up to 24K bytes before TCP payload, and if it is a non-HTTP service, NetScaler can search for the configured token (token) in up to the first 16 packets, but not more than 24K bytes.

7. URL Hash Algorithm

URL hash (hash) Load balancing algorithms are commonly used in cache environments where NetScaler uses a URL hash (hash) load balancing algorithm. NetScaler computes the URL information for this connection request through a hash function and caches the calculated value in the system, while mapping to a server in the background. Then, based on the URL information as hash keys (hash key) hash calculation to get the same value of the request, are sent to the background server.

8, domain name hash algorithm

When NetScaler uses a domain hash (hash) Load balancing algorithm, NetScaler computes the domain name of the connection request through a hash function and caches the calculated value in the system, while mapping to a server in the background. Then, based on the domain name information as hash keys (hash key) hash calculation to get the same value of the request, are sent to the backend server.

9, the source IP address hash algorithm

When NetScaler uses the source IP address hash (hash) Load balancing algorithm, NetScaler computes the source IP address information for this connection request through a hash function and caches the computed value in the system, while mapping to a server in the background. Then, based on the source IP address as hash keys (hash key) hash calculation to obtain the same value of the request, are sent to the background server.

10, the purpose of IP address hash algorithm

When NetScaler uses the destination IP address hash (hash) Load balancing algorithm, NetScaler computes the destination IP address information for this connection request through a hash function and caches the computed value in the system, while mapping to a server in the background. Then, based on the destination IP address as hash keys (hash key) hash calculation to obtain the same value of the request, are sent to the backend server.

11, Source IP and destination IP address hash algorithm

When NetScaler uses the source IP and destination IP address hash (hash) Load balancing algorithm, NetScaler computes the source IP address and destination IP address information for this connection request through a hash function and caches the computed value in the system, while mapping to a server in the background. Then, based on the source IP address and destination IP address as hash keys (hash key) hash calculation to obtain the same value of the request, are sent to the background server.

The source IP address and destination IP address hash (hash) algorithm is often applied in the firewall cluster load balancing environment, which can guarantee the uniqueness of traffic access.

12. Customized SNMP-based judgment algorithm (custom Load)

When NetScaler uses a custom load balancing algorithm, NetScaler obtains relevant server operating parameters through the SNMP protocol, such as CPU utilization, memory usage, server connectivity, and response time, in accordance with a custom policy. Finally, a pre-policy-set parameter matrix (metric) is adopted to determine which backend server The new connection request is sent to.

Maybe someone will ask how NetScaler does not support the weighted algorithm? In other ADCs the weighting will appear as a separate algorithm, and it can only support one or two types. However, in NetScaler, the weighting is in the service setting, and other existing algorithms will be combined, to some extent, become more algorithms, it becomes the 12+12 weighted = 24 equalization algorithm. The following is only discussed with the weighted minimum connection

Minimum number of connections

When NetScaler uses the least-connected load-balancing algorithm, it is allocating new connection requests to the server with the smallest number of current connections. The minimum connection algorithm is a dynamic scheduling algorithm, which estimates the server load by the number of connections currently active on the server. The system records the number of connections that have been made to each server, and when a request is dispatched to a server, its number of connections increases by 1, and its number of connections is reduced by one when the connection is aborted.

If the processing power of the background server is considered different, you can assign different weights to each server, and adjust the scheduling probability of the minimum connection algorithm by setting the weight ratio.

No weight participation

Service1 weight =4

Servcie2 Weight =2

nw= Current number of connections * (10000/weight)

service1nw= Number of connections *2500

service2nw= Number of connections *5000

Allocation of requests after adding weights

Number of requests

Service1 NW

Service2 NW

Current NW

0

0

0

0

1

2500

0

2500

2

2500

5000

5000

3

5000

5000

10000

4

5000

10000

12500

5

7500

10000

17500

6

10000

10000

20000

7

10000

15000

22500

8

12500

15000

27500

9

15000

15000

30000

10

15000

20000

32500

11

17500

20000

37500

12

20000

20000

40000

13

20000

25000

42500

14

22500

25000

45000

15

25000

25000

47500

16

25000

30000

50000

17

27500

30000

55000

18

30000

30000

57500

19

30000

35000

60000

Comments:

When the service's NW is the same, it follows the polling algorithm, which is why the first period differs from the weight ratio.

Current NW calculation method: nw= The current number of connections * (10000/weight) but in the calculation of the current NW (not service NW), the last request for service weight is used to calculate. For example, request 3-"4, because the weight of the request 3 falls on the Service1,servcie1 is 4 (10000/4=2500) then the NW on the 4th request is calculated with the last nw+10000/weight = 12500. In 4-"5 when the last time it landed on the Service2, the 5th request to calculate the NW with the last nw+10000/weight (with the weight of servcie2) = 17500.

In order to clearly see the impact of the weight, the following table with 1:5 weight to reflect

Service1 weight =5

Servcie2 Weight =1

nw= Current number of connections * (10000/weight)

service1nw= Number of connections *2000

service2nw= Number of connections *10000

Number of requests

Service1 NW

Service2 NW

Current NW

0

0

0

0

1

2000

0

2000

2

2000

10000

4000

3

4000

10000

14000

4

6000

10000

16000

5

8000

10000

18000

6

10000

10000

20000

7

10000

20000

22000

8

12000

20000

32000

9

14000

20000

34000

10

16000

20000

36000

11

18000

20000

38000

12

20000

20000

40000

13

20000

30000

42000

14

22000

30000

52000

15

24000

30000

54000

16

26000

30000

56000

17

28000

30000

58000

18

30000

30000

60000

19

32000

30000

62000

Citrix NetScaler Load Balancing algorithm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.