System load balancing method and system based on network connection regular detection

By regularly detecting the size of the pending content of the socket buffer in the network connection of the device, and calculating the comprehensive priority for connection allocation, the problem of unbalanced load of the connection unit cluster in the power Internet of Things scenario is solved, and the overall data processing efficiency of the system is improved.

CN119484415APending Publication Date: 2025-02-18NARI TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411608435.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

In the power IoT scenario, the connection relationship between the device and the platform causes unbalanced load of data transmission pressure in the connection unit cluster, resulting in waste of resources or abnormal operation of protocol proxy components. Prior art such as polling algorithms and minimum connection algorithms cannot effectively solve this problem.

Method used

By regularly detecting and counting the size of content to be processed in the socket buffer of the network connection device, calculating historical and real-time priorities, and comprehensively allocating the connection, realizing dynamic load balancing of business pressure among the service instances of the connection unit.

Benefits of technology

It realizes load balancing of service data transmission pressure in the connection unit cluster, improves the overall data processing efficiency of the system, overcomes the shortcomings of the minimum connection algorithm, and is suitable for application scenarios with large equipment/network connections.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119484415A_ABST
    Figure CN119484415A_ABST
Patent Text Reader

Abstract

The invention discloses a system load balancing method and system based on network connection regular detection. The method comprises the following steps: (1) acquiring actual service load pressure as a distribution index; (2) obtaining the number of connection unit instances in the target cluster, setting a historical load coefficient and a real-time load coefficient, and setting a priority adjustment period; (3) calculating a historical priority; (4) calculating a real-time priority; (5) calculating a comprehensive priority and carrying out distribution connection; (6) repeating the step (3) to the step (5) until the service load level is relatively balanced among the instances; according to the invention, dynamic load balancing of the business pressure between the service instances of the connection units is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electric power Internet of Things, and in particular to a system load balancing method and system based on periodic detection of network connections. Background Art

[0002] The smart terminal devices (terminals) and edge IoT proxy devices (edge ​​devices) in the power IoT have the functions of collecting and processing data respectively. After the terminal collects business data regularly, it will report the data to the edge device for unified processing, and then report it to the cloud IoT platform through the edge device for further transmission or processing. The connection relationship between devices and platforms in the power IoT scenario is roughly as follows: Figure 1 As shown in the figure, from bottom to top, the data collection frequency and collection message size of different types of terminals are different; the number of terminals connected to each edge device is not fixed; the edge device is connected to the IoT platform through the connection unit. Due to the large number of devices, the connection unit is often deployed in a cluster. Each connection unit service integrates the IoT protocol proxy component. For example, if the edge device supports access via the MQTT protocol, the MQTT protocol proxy component needs to be integrated in the connection unit.

[0003] Due to the differences in the number and type of devices connected to each connection unit, the data transmission pressure between the connection units will be unevenly distributed. Overall, if too few devices are connected to a connection unit, it will lead to idle and wasted resources; if too many devices are connected to a connection unit, it may cause abnormal operation of the IoT protocol proxy component, thereby affecting the normal operation of the business. To address this problem, the current common solution is to use polling algorithms and minimum connection algorithms. However, the polling algorithm cannot identify device disconnection and reconnection. If the devices on a connection unit are often disconnected, these devices will be evenly distributed on all connection units in a polling manner when they reconnect. The number of devices on the original connection unit will continue to decrease as this situation occurs; the minimum connection algorithm simply uses the number of device connections as a business load measurement indicator, which is obviously not used in the above-mentioned power IoT scenario.

[0004] Therefore, in the scenario of massive device connections in the power Internet of Things, how to achieve load balancing of business data transmission pressure in the connection unit cluster and improve the overall data processing efficiency of the system is a problem that needs to be solved urgently. Summary of the invention

[0005] Purpose of the invention: The purpose of the present invention is to provide a system load balancing method and system based on periodic detection of network connections, which realizes dynamic load balancing of business pressure among connection unit service instances by periodically detecting and counting the size of content to be processed in the device network connection socket buffer, thereby solving the problems existing in the background technology.

[0006] Technical solution: The system load balancing method based on periodic network connection detection described in the present invention comprises the following steps:

[0007] (1) Obtaining the actual business load pressure as the allocation indicator;

[0008] (2) obtaining the number of connection unit instances in the target cluster, setting the historical load factor and the real-time load factor, and setting a priority adjustment period;

[0009] (3) Calculate historical priority;

[0010] (4) Calculate real-time priority;

[0011] (5) Calculate the comprehensive priority and allocate connections;

[0012] (6) Repeat steps (3) to (5) until the business load level is relatively balanced among the instances.

[0013] Furthermore, step (2) is specifically as follows: obtain the number of connection unit instances T in the target cluster, set the historical load factor α and the real-time load factor β; where α, β∈[0,1], α+β=1 and set a priority adjustment period P; within the initial period P0, assume that there is no connection on each instance and the instance priority is set to 1.

[0014] Furthermore, step (3) is as follows: In each cycle P i , i ≥ 1, for each connection unit instance, the sum of the amount of data to be processed in all socket receive buffers corresponding to its bearer network connection is calculated once every interval I. j ,in Waiting period P i At the end, calculate all D j The average value D average :

[0015]

[0016] For all instances of D average Sort by D average The smaller the number, the less busy the instance is, and the higher the historical priority is set; the historical priority value range is [1, T], and the smaller the number, the higher the priority.

[0017] Furthermore, step (4) is as follows: In the next cycle P i+1At the beginning, after a new connection request arrives and before connection allocation, the sum D of the amount of data to be processed in the socket receive buffer corresponding to the current bearer network connection is calculated for each instance; consistent with the calculation method in step 2, the D value of each instance is sorted. The smaller D is, the higher the real-time priority is, and its value range is [1, T].

[0018] Furthermore, the comprehensive priority of step (5) is as follows:

[0019] Let L h Indicates historical priority, L n represents the real-time priority, then the comprehensive priority of the service instance L c The formula is as follows:

[0020] L c =α*L h +β*L n .

[0021] Furthermore, in step (5), the connections are sequentially assigned to the threads with the highest current comprehensive priority; wherein, L c The smaller the value, the higher the overall priority.

[0022] The system load balancing system based on periodic network connection detection described in the present invention comprises:

[0023] Allocation indicator module: used to obtain the actual business load pressure as the allocation indicator;

[0024] Initialization module: used to obtain the number of connection unit instances in the target cluster, set the historical load factor and real-time load factor, and set a priority adjustment cycle;

[0025] Historical priority module: used to calculate historical priority;

[0026] Real-time priority module: used to calculate real-time priority;

[0027] Comprehensive priority module: used to calculate comprehensive priority and allocate connections;

[0028] Iteration module: used to repeatedly calculate the historical priority module, real-time priority module, and comprehensive priority module until the business load level is relatively balanced among the instances.

[0029] An electronic device described in the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is loaded into the processor, it implements any one of the system load balancing methods based on periodic network connection detection.

[0030] A storage medium described in the present invention stores a computer program, and when the computer program is executed by a processor, it implements any one of the system load balancing methods based on periodic network connection detection.

[0031] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages: First, the present invention uses the amount of data to be processed in the network connection socket, that is, the actual load condition of the system as a measurement indicator, which can overcome the shortcomings of the minimum connection algorithm and achieve business load balancing in a practical sense. Secondly, when calculating the business load, the present invention takes into account both the current operating conditions of the system and the historical operating conditions in the past period of time, and can try to avoid the error influence of the peaks or troughs on the system pressure curve on the load balancing result. Finally, the present invention adopts a regular network detection method to realize the collection of load conditions, which has the advantages of high efficiency and accuracy, and is suitable for application scenarios with a large amount of equipment / network connections. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 It is a simplified diagram of the connection relationship of the present invention;

[0033] Figure 2 It is a flow chart of the equalization method of the present invention. DETAILED DESCRIPTION

[0034] The technical solution of the present invention is further described below in conjunction with the accompanying drawings.

[0035] like Figure 1 As shown, the embodiment of the present invention provides a system load balancing method based on periodic network connection detection, starting from the actual massive data transmission business requirements of the current power Internet of Things, and drawing on the design concept of the minimum connection algorithm, using the actual business load pressure as the allocation indicator, including the following steps:

[0036] (1) Initialization: Get the number of connection unit instances T in the target cluster, set the historical load factor α and the real-time load factor β (α, β∈[0,1], α+β=1), and set a priority adjustment period P. In the initial period P0, there is no connection on each instance, and the instance priority is set to 1. At this time, connections are allocated to instances in a round-robin manner.

[0037] (2) Calculate the historical priority: In each of the following cycles P i (i≥1), for each connection unit instance, the sum of the amount of data to be processed in all socket receive buffers corresponding to its network connection is calculated once every time interval I. Waiting period P i At the end, calculate all D j The average value D average :

[0038]

[0039] For all instances of D average Sort by D average The smaller the number, the less busy the instance is, and the higher the historical priority is. The historical priority value range is [1, T], and the smaller the number, the higher the priority.

[0040] (3) Calculate the real-time priority: the next cycle P i+1 At the beginning, after a new connection request arrives, before connection allocation, the sum of the amount of data to be processed in the socket receive buffer corresponding to the current bearer network connection is calculated for each instance. The D value of each instance is sorted according to the historical priority in step 2. The smaller D is, the higher the real-time priority is, and its value range is also [1, T].

[0041] (4) Calculate the comprehensive priority: Let L h Indicates historical priority, L n represents the real-time priority, then the comprehensive priority of the service instance L c The calculation method is:

[0042] L c =α*L h +β*L n

[0043] (5) Allocation connection: L c The smaller the value, the higher the overall priority, and the connections are assigned to the thread with the highest overall priority.

[0044] (6) Repeat steps 2 to 5. As existing devices reconnect and new devices initiate connection requests, the system will enter a self-correcting state, continuously switching from a relatively unbalanced business load level among instances to a relatively balanced one.

[0045] The embodiment of the present invention further provides a system load balancing system based on periodic detection of network connections, comprising:

[0046] Allocation indicator module: used to obtain the actual business load pressure as the allocation indicator;

[0047] Initialization module: used to obtain the number of connection unit instances in the target cluster, set the historical load factor and real-time load factor, and set a priority adjustment cycle;

[0048] Historical priority module: used to calculate historical priority;

[0049] Real-time priority module: used to calculate real-time priority;

[0050] Comprehensive priority module: used to calculate comprehensive priority and allocate connections;

[0051] Iteration module: used to repeatedly calculate the historical priority module, real-time priority module, and comprehensive priority module until the business load level is relatively balanced among the instances.

[0052] An embodiment of the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is loaded into the processor, the system load balancing method based on periodic detection of network connections as described in any one of the above is implemented.

[0053] An embodiment of the present invention further provides a storage medium storing a computer program. When the computer program is executed by a processor, the system load balancing method based on periodic network connection detection is implemented.

Claims

1. A system load balancing method based on periodic detection of network connections, characterized in that: The following steps are involved: (1) Obtaining the actual business load pressure as the allocation indicator; (2) obtaining the number of connection unit instances in the target cluster, setting the historical load factor and the real-time load factor, and setting a priority adjustment period; (3) Calculate historical priority; (4) Calculate real-time priority; (5) Calculate the comprehensive priority and allocate connections; (6) Repeat steps (3) to (5) until the business load level is relatively balanced among the instances.

2. A system load balancing method based on periodic network connection detection according to claim 1, characterized in that: Step (2) is as follows: obtain the number of connection unit instances T in the target cluster, set the historical load factor α and the real-time load factor β; where α, β∈[0,1], α+β=1 and set a priority adjustment period P; within the initial period P0, assume that there is no connection on each instance and the instance priority is set to 1.

3. A system load balancing method based on periodic network connection detection according to claim 1, characterized in that: Step (3) is as follows: In each cycle P i , i ≥ 1, for each connection unit instance, the sum of the amount of data to be processed in all socket receive buffers corresponding to its bearer network connection is calculated once every interval I. j ,in Waiting period P i At the end, calculate all D j The average value D average : For all instances of D average Sort by D average The smaller the number, the less busy the instance is, and the higher the historical priority is set; the historical priority value range is [1, T], and the smaller the number, the higher the priority.

4. A system load balancing method based on periodic network connection detection according to claim 1, characterized in that: Step (4) is as follows: In the next cycle P i+1 At the beginning, after a new connection request arrives and before connection allocation, the sum D of the amount of data to be processed in the socket receive buffer corresponding to the current bearer network connection is calculated for each instance; Consistent with the calculation method in step 2, sort the D value of each instance. The smaller the D, the higher the real-time priority. Its value range is [1, T].

5. A system load balancing method based on periodic network connection detection according to claim 1, characterized in that: The comprehensive priorities of step (5) are as follows: Let L h Indicates historical priority, L n represents the real-time priority, then the comprehensive priority of the service instance L c The formula is as follows: L c =α*L h +β*L n 。 6. A system load balancing method based on periodic network connection detection according to claim 5, characterized in that: In step (5), the connections are assigned to the threads with the highest current comprehensive priority in turn; where L c The smaller the value, the higher the overall priority.

7. A system load balancing system based on periodic detection of network connections, characterized in that: include: Allocation indicator module: used to obtain the actual business load pressure as the allocation indicator; Initialization module: used to obtain the number of connection unit instances in the target cluster, set the historical load factor and real-time load factor, and set a priority adjustment cycle; Historical priority module: used to calculate historical priority; Real-time priority module: used to calculate real-time priority; Comprehensive priority module: used to calculate comprehensive priority and allocate connections; Iteration module: used to repeatedly calculate the historical priority module, real-time priority module, and comprehensive priority module until the business load level is relatively balanced among the instances.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the computer program is loaded into the processor, the system load balancing method based on periodic detection of network connections according to any one of claims 1 to 6 is implemented.

9. A storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, a system load balancing method based on periodic network connection detection according to any one of claims 1 to 6 is implemented.

Citation Information

Cited By

  • Load balancing calculation method and system for electric power internet of things

    CN120614359A