Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed introduction of Citrix Netscaler load balancing algorithm

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

The following will give you a detailed introduction of Citrix Netscaler load balancing algorithm, hoping to give you some help in practical application. Load balancing involves many things, and there are not many theories. There are many books on the Internet. Today, we will use the accumulated experience in the industry to do an answer.

As we all know, as a new generation of application delivery products, Citrix Netscaler has the ability of industry-leading data control and application delivery. However, as one of the fundamental functions of ADC, it is impossible to adapt to so many application scenarios without powerful and diversified equalization algorithms, let alone achieve good application delivery products. Therefore, it is necessary for us to discuss the commonly used load balancing algorithms here.

At present, the latest version of Netscaler supports 17 equalization algorithms, and the 12 most commonly used ones are discussed first.

1. Polling algorithm (Round Robin)

When NetScaler uses the polling load balancing algorithm, it allocates requests from the client to the CVM in the background in turn, starting from 1 to N (number of backend servers), and then starts the cycle again.

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

2. Least join algorithm (Least Connection)

When NetScaler uses the minimum connection load balancing algorithm, it allocates new connection requests to the server with the smallest number of connections currently. The minimum connection algorithm is a dynamic scheduling algorithm, which estimates the load of the server by the current number of active connections of the server. The system records the number of connections established by each server. When a request is dispatched to a server, the number of connections is increased by 1, and when the connection is terminated, the number of connections is reduced by one.

If you consider the different processing capacity of the background server, you can also 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 minimum response time, it allocates new connection requests to the server with the lowest current number of connections and the lowest average response time. The scheduling factor of the minimum response time algorithm actually consists of two parts, namely, the current minimum number of connections on each server and the average response time per server (where the average response time is TTFB, that is, the time of arrival of the first byte, and the return time of the first byte of Http protocol response code is 200. the product of these two factors is used as the basis for judging the scheduling of the algorithm. The latest connection request will be sent to the server with the lowest product of the minimum number of connections and the average response time.

If you consider the different processing capacity of the background server, you can also assign different weights to each server, and adjust the scheduling probability of the minimum enjoyment time algorithm by setting the weight ratio.

4. Minimum bandwidth algorithm (Least Bandwidth)

When NetScaler uses the minimum bandwidth load balancing algorithm, it allocates new connection requests to the server with the lowest current traffic throughput (in bps).

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

5. Least data packet algorithm (Least Packets)

When NetScaler uses the load balancing algorithm with the least number of packets, it allocates new connection requests to the server with the least packets. The minimum packet is calculated by the number of packets processed on each server in the past 14 seconds.

If you consider the different processing capacity of the background server, you can also assign different weights to each server, and adjust the scheduling probability of the least data packet algorithm by setting the weight ratio.

6. Token algorithm (Token)

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

Token algorithm can be applied to TCP, http and Https service types, and even achieve uniqueness among different services. For the Http/Https protocol, the Token can be obtained in Http header or URL or Http body. Netscaler can search for configured Token in front of TCP Payload up to 24K bytes, and if it is a non-Http service, Netscaler can search for configured Token in up to the first 16 packets, but not more than 24K bytes.

7. URL Hash algorithm

URL Hash load balancing algorithm is often used in Cache environment. When NetScaler uses URL Hash load balancing algorithm, NetScaler calculates the URL information requested by this connection through a Hash function, caches the calculated value in the system, and maps it to a server in the background. Then the request for the same value calculated by Hash based on the URL information as a hash key (Hash Key) is sent to this background server.

8. Domain name Hash algorithm

When NetScaler uses the domain name hash (Hash) load balancing algorithm, NetScaler calculates the domain name (Domain) information of the connection request through a Hash function, caches the calculated value in the system, and maps it to a server in the background. Subsequently, requests for the same value calculated by Hash based on the domain name information as hash key (Hash Key) are sent to this backend server.

9. Source IP address Hash algorithm

When NetScaler uses the source IP address hash (Hash) load balancing algorithm, NetScaler calculates the source IP address information of the connection request through a Hash function, caches the calculated value in the system, and maps it to a server in the background. Then the request for the same value calculated by Hash based on the source IP address as the hash key (Hash Key) is sent to this background server.

10. Destination IP address Hash algorithm

When NetScaler uses the destination IP address hash (Hash) load balancing algorithm, NetScaler calculates the destination IP address information of the connection request through a Hash function, caches the calculated value in the system, and maps it to a server in the background. Then the request for the same value calculated by Hash based on the destination IP address as the hash key (Hash Key) is sent to this background 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 calculates the source IP address and destination IP address information of the connection request through a Hash function, caches the calculated value in the system, and maps it to a server in the background. Then the request for the same value calculated by Hash based on the source IP address and the destination IP address as the hash key (Hash Key) is sent to this background server.

Source IP address hashing and destination IP address hashing (Hash) algorithms are often used in firewall cluster load balancing environment, which can ensure the uniqueness of traffic entry and exit.

12. Custom SNMP-based judgment algorithm (Custom Load)

When NetScaler uses a custom load balancing algorithm, NetScaler obtains relevant server operation parameters through the SNMP protocol according to the custom policy, such as CPU utilization, memory usage, server connection and response time, and finally determines which background server to send the new connection request to through the parameter matrix (metric) set by the pre-policy.

Some people may ask why Netscaler does not support weighting algorithms. Weighting appears as a separate algorithm in other ADC, and can only support one or two. But in Netscaler, weighting is set by service, and it will be combined with other existing algorithms, and to some extent, it becomes more algorithms, that is, 12-12 weighting = 24 equalization algorithms. The following is discussed only in terms of the weighting of the minimum connection

Minimum number of connections

When NetScaler uses the minimum connection load balancing algorithm, it allocates new connection requests to the server with the smallest number of connections currently. The minimum connection algorithm is a dynamic scheduling algorithm, which estimates the load of the server by the current number of active connections of the server. The system records the number of connections established by each server. When a request is dispatched to a server, the number of connections is increased by 1, and when the connection is terminated, the number of connections is reduced by one.

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

No right to re-participate

Service1 weight = 4

Servcie2 weight = 2

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

Number of service1NW= connections * 2500

Number of service2NW= connections * 5000

Allocation of requests after adding weights

Number of requests

Service1 NW

Service2 NW

Current NW

0

0

0

0

one

2500

0

2500

two

2500

5000

5000

three

5000

5000

10000

four

5000

10000

12500

five

7500

10000

17500

six

10000

10000

20000

seven

10000

15000

22500

eight

12500

15000

27500

nine

15000

15000

30000

ten

15000

20000

32500

eleven

17500

20000

37500

twelve

20000

20000

40000

thirteen

20000

25000

42500

fourteen

22500

25000

45000

fifteen

25000

25000

47500

sixteen

25000

30000

50000

seventeen

27500

30000

55000

eighteen

30000

30000

57500

nineteen

30000

35000

60000

Note:

The polling algorithm is followed when the NW of service is the same, which is the reason why the weight ratio is different in the first cycle.

The current NW calculation method: the current number of connections of NW= * (10,000 / weight), but when calculating the current NW of the system (not the NW of service), it will use the weight of the last requested Service to calculate. For example, request 3-"4, since the weight of request 3 falls on the service1,servcie1 is 4 (10000 NW+10000/ 40002500), then the last NW+10000/ weight = 12500 is used in calculating the fourth request's NW+10000/. At 4-"5, since it fell on service2 last time, the NW for the fifth request is calculated 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 is reflected in the weight at 1:5

Service1 weight = 5

Servcie2 weight = 1

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

Number of service1NW= connections * 2000

Number of service2NW= connections * 10000

Number of requests

Service1 NW

Service2 NW

Current NW

0

0

0

0

one

2000

0

2000

two

2000

10000

4000

three

4000

10000

14000

four

6000

10000

16000

five

8000

10000

18000

six

10000

10000

20000

seven

10000

20000

22000

eight

12000

20000

32000

nine

14000

20000

34000

ten

16000

20000

36000

eleven

18000

20000

38000

twelve

20000

20000

40000

thirteen

20000

30000

42000

fourteen

22000

30000

52000

fifteen

24000

30000

54000

sixteen

26000

30000

56000

seventeen

28000

30000

58000

eighteen

30000

30000

60000

nineteen

32000

30000

62000

After reading the above detailed introduction of Citrix Netscaler load balancing algorithm, if you have anything else you need to know, you can find what you are interested in in the industry information or find our professional technical engineer to answer, the technical engineer has more than ten years of experience in the industry.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report