Load balancing method and device based on round-trip delay total value
By calculating and synchronizing the total round-trip delay value between service members in the data center and the local domain name server, the problem that the existing RTT load balancing algorithm fails to effectively consider the load of service members is solved, and better load balancing and system stability are achieved sex.
Patent Information
- Application Number
- CN202411619269.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-02-18
AI Technical Summary
The existing RTT load balancing algorithm fails to effectively consider the load situation of data center service members, resulting in service members being selected when the load is high, resulting in overload and business request failure.
By obtaining the total round trip delay value between service members in the data center and the local domain name server, taking into account the delay time of reverse detection and forward detection, synchronizing the total round trip delay value of all service members in the cluster, and selecting the round trip time based on this Service members with the smallest total value.
It effectively balances the load of service members in the data center, avoids business request failure caused by overloading a single service member, and improves user experience and system stability.
Smart Images

Figure CN119484537A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of load balancing, and in particular to a load balancing method and device based on total round-trip delay. Background Art
[0002] In the global information age, multi-data center architecture has become the norm for large enterprises and service providers to ensure data redundancy and high availability. In the complex network environment of multiple data centers, global server load balancing (GSLB) technology plays a vital role. It uses technologies such as DNS resolution, health checks, and intelligent routing to ensure efficient and stable operation of network services through sophisticated strategies and algorithms.
[0003] GSLB intelligent scheduling supports a load balancing algorithm based on round-trip time (RTT). The common processing solutions for the RTT load balancing algorithm in the industry are as follows:
[0004] Step 1: The GSLB resolution device receives the DNS request message sent by the local domain name server (LDNS) and selects an optimal global address pool based on the load balancing algorithm (such as polling or weighted polling) configured in the zone record;
[0005] Step 2: The GSLB device traverses each pool member of the global address pool to determine whether the round-trip delay information of reverse detection has been generated in the data of these pool members. If it has, the data center service member with the smallest round-trip delay of reverse detection is selected;
[0006] Step 3: If all pool members in the global address pool have not yet generated the round-trip delay information of the reverse detection, a polling algorithm is used to select an available pool member to return. Then, for each pool member, a GSLB device in its data center is selected, and synchronization messages are sent to these GSLB device nodes to trigger these GSLB devices to initiate a reverse detection to the LDNS;
[0007] Step 4: The device nodes in other data centers receive the synchronization message and determine that it is a reverse detection instruction, and then send a reverse detection message to the LDNS server. For example, according to the configuration of the RTT algorithm, the GSLB device sends an ICMP Echo Request message to the LDNS, and the LDNS replies with an Echo Reply response message;
[0008] Step 5: The GSLB device node in the data center records the time point when the reverse detection message is sent, and calculates the reverse detection round-trip delay when receiving the response message, and then synchronizes the reverse detection round-trip delay to other device nodes in the cluster; if the detection times out, the reverse detection round-trip delay between the data center and LDNS is set to 0;
[0009] Step 6: Each device node in the cluster stores the reverse detection round-trip delay between the GSLB devices in each data center and the same LDNS server;
[0010] Step 7: Subsequently, the GSLB devices in each data center periodically perform reverse detection on the LDNS server, update the reverse detection round-trip delay, and then broadcast synchronization in the cluster to ensure the consistency of the reverse detection round-trip delay information of all GSLB device nodes in the cluster;
[0011] Step 8: When the global address pool executes the RTT load balancing algorithm again, the service member in the data center with the smallest non-zero current RTT time is selected.
[0012] See also Figure 1 , the domain name www.abc.com is configured with two global address pools, gPool1 and gPool2, where: gPool1 is configured with service members from three data centers: 10.10.10.10:8080, 20.20.20.20:8080, 30.30.30.30:8080, and the load balancing algorithm is the RTT algorithm. The GSLB-Beijing device node receives the DNS resolution request from Beijing Mobile LDNS for the domain name www.abc.com, first selects gPool1 based on the load balancing algorithm configured in the zone record, then determines that there are service members from three data centers in gPool1, and sends a synchronization message to trigger the two devices GSLB-Shanghai and GSLB-Shenzhen to perform reverse detection on Beijing Mobile LDNS. After obtaining the reverse detection results, the detection results after synchronization within the cluster are: the RTT between GSLB-Beijing and Beijing Mobile LDNS is 5.216 milliseconds, the RTT between GSLB-Shanghai and Beijing Mobile LDNS is 28.521 milliseconds, and the RTT between GSLB-Shenzhen and Beijing Mobile LDNS is 39.615 milliseconds. When the RTT algorithm is executed again on the global address pool, the DNS resolution returns the 10.10.10.10 service member address in the Beijing data center.
[0013] However, the existing RTT algorithm only takes the round-trip delay of reverse detection between the GSLB device and the LDNS server as the sole basis, and does not take into account the load of the data center service members. Therefore, even if the server 10.10.10.10 is highly loaded and responds to services very slowly, since the RTT between GSLB-Beijing and the LDNS is always the smallest, after the TTL expires, Beijing Mobile LDNS initiates a DNS resolution request for the www.abc.com domain name again, and the resolution result is still the service member 10.10.10.10. This ultimately causes the 10.10.10.10 service member to be overloaded and unable to respond to user service requests normally, affecting the user service experience. Summary of the invention
[0014] To this end, the present application provides a load balancing method and device based on the total round-trip delay to solve the problem that the load balancing algorithm in the prior art cannot well balance the load of service members in the data center.
[0015] In order to achieve the above objectives, this application provides the following technical solutions:
[0016] In a first aspect, a load balancing method based on a total round-trip delay value is provided, wherein the load balancing method based on a total round-trip delay value is applied to a global server load balancing device, comprising:
[0017] Step 1: Obtain the forward detection round-trip delay between the service members in the data center;
[0018] Step 2: Obtain the reverse detection round-trip delay between the local domain name server;
[0019] Step 3: Calculate the total round-trip delay between the local domain name server and each service member in the data center according to the forward detection round-trip delay and the reverse detection round-trip delay;
[0020] Step 4: Synchronize the total round-trip latency of all service members in the data center within the cluster;
[0021] Step 5: Select the service member in the data center with the smallest total round-trip delay based on the round-trip delay scheduling algorithm.
[0022] Preferably, in step 1, the forward detection round-trip delay is obtained by the global server load balancing device through a health check.
[0023] Preferably, in step 2, the reverse detection round trip delay is calculated by the global server load balancing device sending a Ping request to the local domain name server through the ICMP protocol and recording the time of sending and receiving the request.
[0024] Preferably, in step 4, a broadcast synchronization method is used when synchronizing the total round-trip delay values of all service members in the data center within the cluster.
[0025] In a second aspect, a load balancing device based on a total round-trip delay includes:
[0026] A forward detection round-trip delay acquisition module is used to obtain the forward detection round-trip delay between the service members in the data center;
[0027] A reverse detection round-trip delay acquisition module is used to obtain the reverse detection round-trip delay between the local domain name server and the local domain name server;
[0028] A round-trip delay total value calculation module, used to calculate the total round-trip delay between the local domain name server and each service member in the data center according to the forward detection round-trip delay and the reverse detection round-trip delay;
[0029] The round-trip delay total value synchronization module is used to synchronize the round-trip delay total values of all service members in the data center within the cluster;
[0030] The scheduling selection module is used to select the service member in the data center with the smallest total round-trip delay based on the round-trip delay scheduling algorithm.
[0031] Preferably, the forward detection round-trip delay is obtained by a global server load balancing device through a health check.
[0032] Preferably, the reverse detection round trip delay is calculated by the global server load balancing device sending a Ping request to the local domain name server through the ICMP protocol and recording the time when the request is sent and received.
[0033] Preferably, the round-trip delay total value synchronization module adopts a broadcast synchronization method when synchronizing the round-trip delay total values of all service members in the data center within the cluster.
[0034] In a third aspect, a computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a load balancing method based on a total round-trip delay.
[0035] In a fourth aspect, a computer program product includes a computer program or instructions, which, when executed by a processor, implements the steps of a load balancing method based on a total round-trip delay.
[0036] Compared with the prior art, this application has at least the following beneficial effects:
[0037] The present application provides a load balancing method and device based on the total round-trip delay value, by obtaining the forward detection round-trip delay between the service members in the data center and the reverse detection round-trip delay between the local domain name server and the data center. The total round-trip delay value between the local domain name server and each service member in the data center is calculated based on the forward detection round-trip delay and the reverse detection round-trip delay. The total round-trip delay value of all service members in the data center is synchronized in the cluster, and the service member in the data center with the smallest total round-trip delay value is selected based on the round-trip delay scheduling algorithm. The present application provides a load balancing method and device based on the total round-trip delay value, which comprehensively considers the current load conditions of the service members in the data center, and can well balance the load of the service members in the data center according to the total value of the reverse detection round-trip delay and the forward detection round-trip delay. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more intuitively illustrate the prior art and the present application, exemplary drawings are given below. It should be understood that the specific shapes and structures shown in the drawings should not generally be regarded as limiting conditions for implementing the present application; for example, those skilled in the art are capable of easily making conventional adjustments or further optimizations to the addition / reduction / attribution division, specific shapes, positional relationships, connection methods, dimensional ratios, etc. of certain units (components) based on the technical concepts and exemplary drawings disclosed in the present application.
[0039] Figure 1 It is a schematic diagram of an existing load balancing algorithm based on round-trip delay;
[0040] Figure 2 A flow chart of a load balancing method based on the total round-trip delay provided in Example 1 of the present application;
[0041] Figure 3 This is a schematic diagram of the structure of an example load balancing method provided in Example 1 of the present application. DETAILED DESCRIPTION
[0042] The present application is further described below in detail through specific embodiments in conjunction with the accompanying drawings.
[0043] In the description of this application: unless otherwise specified, the meaning of "plurality" is two or more. The terms "first", "second", "third", etc. in this application are intended to distinguish the objects referred to, and do not have special meanings in terms of technical connotations (for example, they should not be understood as emphasizing the importance or order, etc.). Expressions such as "including", "comprising", "having", etc. also mean "not limited to" (certain units, components, materials, steps, etc.).
[0044] The terms such as "upper", "lower", "left", "right", "middle", etc. cited in this application are usually used to indicate the general relative position relationship for the convenience of intuitive understanding by referring to the drawings, and are not absolute limitations on the position relationship in the actual product.
[0045] Embodiment 1
[0046] See also Figure 2 This embodiment provides a load balancing method based on the total round-trip delay, which is applied to a global server load balancing (GSLB) device, including:
[0047] S1: Get the round-trip delay of forward detection between the service members in the data center;
[0048] In this step, the forward detection round-trip delay is obtained by the global server load balancing device through health checks. Specifically, the GSLB device will perform periodic health checks on the service members in this data center, determine whether the service members are normal based on the health check results, and also obtain the forward detection round-trip delay.
[0049] S2: Obtain the reverse detection round-trip delay between the local domain name server;
[0050] In this step, the GSLB device and LDNS (local domain name server) will still periodically perform reverse detection to obtain the reverse detection round-trip delay. Specifically, the global server load balancing device can send a Ping request to the local domain name server through the ICMP protocol and record the time when the request is sent and received. The reverse detection round-trip delay can be obtained based on the time when the request is sent and received.
[0051] S3: Calculate the total round-trip delay between the local domain name server and each service member in the data center based on the forward detection round-trip delay and the reverse detection round-trip delay;
[0052] Specifically, the total round-trip delay = reverse detection round-trip delay + forward detection round-trip delay.
[0053] S4: Synchronize the total round-trip latency of all service members in the data center within the cluster;
[0054] Specifically, the broadcast synchronization method is used to synchronize the total round-trip delay of all service members in the data center within the cluster. This step uses the data center as the granularity to synchronize the total round-trip delay of all service members in the data center within the cluster, which can ensure the consistency of the round-trip delay results of each node in the cluster.
[0055] S5: Select a service member in the data center with the smallest total round-trip delay based on the round-trip delay scheduling algorithm.
[0056] Specifically, when the global address pool executes the RTT algorithm, the total round-trip delay value is used as the scheduling basis, and the scheduling returns the pool member with the smallest total round-trip delay value.
[0057] The load balancing method based on the total round-trip delay provided in this embodiment no longer uses the reverse detection round-trip delay between the GSLB device node and the LDNS server as the only criterion. It combines the GSLB device node and the delay of the health check of the service members in this data center, and finally obtains the total RTT value between the LDNS and the service members in each data center, and uses the total RTT value as the scheduling basis to return the pool member with the smallest total RTT value in the global address pool. When a service member in the data center occupies too much resources such as memory, CPU, and network bandwidth, resulting in a longer health check delay between the GSLB device and the service member, the service member can be automatically skipped, and other server resources with a smaller total RTT value can be selected, so as to better achieve the purpose of load balancing of service members in different data centers.
[0058] Example:
[0059] Continue reading Figure 1 When the method provided in this embodiment is not used, the GSLB-Beijing device node receives the DNS resolution request for the domain name www.abc.com from Beijing Mobile LDNS, and the selected global address pool sets the RTT load balancing algorithm. First, an available pool member is returned based on the polling algorithm, for example: 20.20.20.20. Then, GSLB-Beijing triggers GSLB-Shanghai and GSLB-Shenzhen to perform reverse detection on the Beijing Mobile LDNS server at the same time, and finally returns 10.10.10.10 with the smallest RTT delay. During the TTL validity period, the business traffic borne by the service member 10.10.10.10 is getting higher and higher, and the CPU load and network bandwidth are close to the upper limit. After the TTL validity period expires, the client initiates a DNS resolution request for the domain name www.abc.com, and the Beijing Mobile LDNS cache fails. It will initiate a DNS request to the authoritative GSLB device. At this time, since the reverse detection round-trip delay remains basically unchanged, it still returns the service member 10.10.10.10 in the data center-Beijing with the smallest RTT delay. This eventually caused the server 10.10.10.10 to be overloaded, causing response timeouts and business requests to fail.
[0060] In the same scenario, when the method provided in this embodiment is used, the GSLB device node periodically performs health checks on the service members in the data center to obtain the forward detection round-trip delay between the GSLB device node and each service member. The three GSLB device nodes, GSLB-Beijing, GSLB-Shanghai, and GSLB-Shenzhen, respectively perform reverse detection on the Beijing Mobile LDNS server to obtain the reverse detection round-trip delays of the three data centers. The total round-trip delay is calculated for the three data center service members of Beijing-1, Shanghai-1, and Shenzhen-1. Since the service member Beijing-1 bears high business traffic, the CPU load and network bandwidth are close to the upper limit, and the response speed to the health check will be slow. Therefore, although the reverse detection round-trip delay value has not changed, the forward detection round-trip delay of Beijing-1 has increased, and the total round-trip delay of Beijing-1 is greater than the total round-trip delay of the service member Shanghai-1 in the Shanghai data center, and the final dispatch returns to 20.20.20.20. Avoid the problem that business traffic continues to enter 10.10.10.10, causing service resources to overload and cause business requests to fail.
[0061] See also Figure 3 , the device nodes in each data center will perform health checks on the service members of the data center, and obtain the forward detection round-trip delay between the GSLB device and the service members in the same data center through health checks. Due to the high load of the 10.10.10.10 service member, the health check RTT of GSLB-Beijing and Application Service: Beijing-1 reaches 26 milliseconds. The service members in the other two data centers have lower loads and the health check RTT is basically 2 milliseconds or 3 milliseconds. The total RTT between the service members in the three data centers and Beijing Mobile LDNS is: the RTT between Application Service: Beijing-1 and Beijing Mobile LDNS is 31.216 milliseconds, the RTT between Application Service: Shanghai-1 and Beijing Mobile LDNS is 30.521 milliseconds, and the RTT between Application Service: Shenzhen-1 and Beijing Mobile LDNS is 42.615 milliseconds. Finally, the DNS resolution returns the 20.20.20.20 service member address in the Shanghai data center. As the business traffic for www.abc.com is gradually switched to the Shanghai data center, after the load of application service: Beijing-1 decreases, the health check RTT delay will return to normal values, and subsequent DNS requests will return to 10.10.10.10 in the Beijing data center again.
[0062] The load balancing method based on the total round-trip delay provided in this embodiment comprehensively considers the round-trip delay of reverse detection and the round-trip delay of forward detection of periodic health check, covering the current load of data center service members. Compared with the existing RTT method that only includes the single indicator of the round-trip delay of the reverse detection path, this embodiment is more accurate and selects the service member with the smallest total delay value from the perspective of end-to-end round-trip delay, which can avoid a large number of services being concentrated on the service member with the smallest round-trip delay of reverse detection, causing abnormal phenomena such as overload operation and service failure.
[0063] Embodiment 2
[0064] This embodiment provides a load balancing device based on the total round-trip delay value, including:
[0065] A forward detection round-trip delay acquisition module is used to obtain the forward detection round-trip delay between the service members in the data center; wherein the forward detection round-trip delay is obtained by the global server load balancing device through health check;
[0066] The reverse detection round-trip delay acquisition module is used to obtain the reverse detection round-trip delay between the local domain name server; wherein, the reverse detection round-trip delay is calculated by the global server load balancing device sending a Ping request to the local domain name server through the ICMP protocol and recording the time of sending and receiving the request.
[0067] A round trip delay total value calculation module, used to calculate the total round trip delay between the local domain name server and each service member in the data center according to the forward detection round trip delay and the reverse detection round trip delay;
[0068] The round-trip delay total value synchronization module is used to synchronize the round-trip delay total values of all service members in the data center within the cluster; specifically, the broadcast synchronization method is used for synchronization.
[0069] The scheduling selection module is used to select the service member in the data center with the smallest total round-trip delay based on the round-trip delay scheduling algorithm.
[0070] The reverse detection round-trip delay is calculated by the global server load balancing device sending a Ping request to the local domain name server through the ICMP protocol and recording the time it takes to send and receive the request.
[0071] For the specific implementation content of each module in a load balancing device based on the total round-trip delay value, please refer to the above definition of a load balancing method based on the total round-trip delay value, which will not be repeated here.
[0072] Embodiment 3
[0073] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of a load balancing method based on the total round-trip delay are implemented.
[0074] Embodiment 4
[0075] This embodiment provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements steps of a load balancing method based on a total round-trip delay.
[0076] The technical features of the above embodiments may be arbitrarily combined (as long as there is no contradiction in the combination of these technical features). To make the description concise, not all possible combinations of the technical features in the above embodiments are described; these embodiments that are not explicitly written should also be considered to be within the scope of this specification.
Claims
1. A load balancing method based on the total round-trip delay, characterized in that: The load balancing method based on the total round-trip delay is applied to a global server load balancing device, comprising: Step 1: Obtain the forward detection round-trip delay between the service members in the data center; Step 2: Obtain the reverse detection round-trip delay between the local domain name server; Step 3: Calculate the total round-trip delay between the local domain name server and each service member in the data center according to the forward detection round-trip delay and the reverse detection round-trip delay; Step 4: Synchronize the total round-trip latency of all service members in the data center within the cluster; Step 5: Select the service member in the data center with the smallest total round-trip delay based on the round-trip delay scheduling algorithm.
2. The load balancing method based on the total round-trip delay according to claim 1, characterized in that: In step 1, the forward detection round-trip delay is obtained by the global server load balancing device through health check.
3. The load balancing method based on the total round-trip delay according to claim 1, characterized in that: In step 2, the reverse detection round trip delay is calculated by the global server load balancing device sending a Ping request to the local domain name server through the ICMP protocol and recording the time of sending and receiving the request.
4. The load balancing method based on the total round-trip delay according to claim 1, characterized in that: In step 4, a broadcast synchronization method is used to synchronize the total round-trip delay of all service members in the data center within the cluster.
5. A load balancing device based on the total round-trip delay, characterized in that: include: A forward detection round-trip delay acquisition module is used to obtain the forward detection round-trip delay between the service members in the data center; A reverse detection round-trip delay acquisition module is used to obtain the reverse detection round-trip delay between the local domain name server and the local domain name server; A round-trip delay total value calculation module, used to calculate the total round-trip delay between the local domain name server and each service member in the data center according to the forward detection round-trip delay and the reverse detection round-trip delay; The round-trip delay total value synchronization module is used to synchronize the round-trip delay total values of all service members in the data center within the cluster; The scheduling selection module is used to select the service member in the data center with the smallest total round-trip delay based on the round-trip delay scheduling algorithm.
6. The load balancing device based on the total round-trip delay according to claim 5, characterized in that: The forward detection round trip delay is obtained by the global server load balancing device through health checks.
7. The load balancing device based on the total round-trip delay according to claim 5, characterized in that: The reverse detection round trip delay is calculated by the global server load balancing device sending a Ping request to the local domain name server through the ICMP protocol and recording the time when the request is sent and received.
8. The load balancing device based on the total round-trip delay according to claim 5, characterized in that: The round-trip delay total value synchronization module adopts a broadcast synchronization method when synchronizing the round-trip delay total values of all service members in the data center in the cluster.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
10. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.