Load balancing method, storage medium and electronic device
By obtaining device performance monitoring information and data packet information in a large-capacity cluster simulation system, building a priority list and selecting high-performance devices as forwarding paths, the problems of resource waste and packet loss in complex systems are solved, and more efficient and stable load balancing is achieved.
Patent Information
- Application Number
- CN202311177835.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-12
- Publication Date
- 2025-03-14
AI Technical Summary
Existing load balancing algorithms are prone to waste of resources or packet loss when the system is complex and the number of requests is huge, and they cannot effectively utilize the actual status information of the device.
When the cluster equipment changes, the performance monitoring information of multiple receiving devices and the information of the pending data packets are obtained, the priority list of the target data packet is constructed, and the target receiving device of the target data packet is determined based on the priority list.
By adaptively adjusting the traffic load of the variable equipment, high-performance receiving equipment is preferred as the new forwarding path, avoiding resource waste and packet loss, making full use of system resources, and improving system performance and stability.
Smart Images

Figure CN119621228A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communications, and in particular to a load balancing method, a storage medium, and an electronic device. Background Art
[0002] A large-capacity cluster simulation system is usually composed of hundreds of simulation devices, and each device in the simulation system can handle a large number of requests. In order to truly simulate the problems of equipment going online and offline due to equipment failure, maintenance, updates, etc. in actual applications, the large-capacity cluster simulation system will also perform irregular online or offline operations on the simulation devices. These operations often cause fluctuations in the system load. For example, some nodes may be overloaded while other nodes may be underloaded, which will affect the performance of the simulation system. In order to deal with such problems and ensure the stability and efficiency of the cluster simulation system, it is necessary to effectively handle the online and offline operations of the devices to achieve traffic load balancing.
[0003] At present, large-capacity cluster simulation systems often use random request allocation algorithms or polling-based load balancing algorithms to set forwarding paths for traffic in the simulation system when devices are online or offline. The random request allocation algorithm refers to randomly allocating requests to available devices for processing, so that each device has an equal probability of obtaining a request, so as to achieve uniform distribution of traffic load in the system. The polling-based load balancing algorithm refers to allocating requests to available devices for processing in turn according to a predetermined order, so as to ensure that each device can process requests evenly and avoid uneven load distribution.
[0004] However, these algorithms have certain limitations and are not suitable for systems with complex scale and large number of requests. There are two main reasons. First, it is easy to cause waste of resources. The random request allocation algorithm and the polling-based load balancing algorithm do not take into account the actual status information of the device. In the actual production environment, the performance of each node is different, and the device with faster task processing may be idle for a long time. Second, the random request allocation algorithm and the polling-based load balancing algorithm are simple load balancing algorithms, which are only suitable for specific application scenarios, such as when the processing capabilities of each node are similar and the workload of each task is not much different. If there is a large difference, the node with slower task processing may have a backlog of requests, and ultimately cannot bear the excessive load and cause packet loss.
[0005] In summary, there is no good solution to the above problems. Summary of the invention
[0006] The embodiments of the present application provide a load balancing method, a storage medium, and an electronic device to at least solve the problem in the related art that the load balancing algorithm easily causes resource waste or packet loss.
[0007] According to one embodiment of the present application, a load balancing method is provided, the method comprising: when a cluster device changes, obtaining multiple groups of performance monitoring information of multiple receiving devices and data packet information of at least one data packet to be processed, wherein the data packet to be processed is a data packet to be processed by the cluster device that has changed; constructing a priority list of target data packets based on the multiple groups of performance monitoring information and the data packet information, wherein the target data packet is one of the data packets to be processed, and the priority list includes the processing priorities of the multiple receiving devices for the target data packet; and determining the target receiving device of the target data packet from the multiple receiving devices based on the priority list.
[0008] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program executes the steps of any of the above method embodiments when executed by a processor.
[0009] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0010] Through the embodiments of the present application, the traffic load of the changing device can be adaptively adjusted when the device goes online or offline, and high-performance receiving devices can be preferentially selected as new forwarding paths, thereby solving the problem that the load balancing algorithm in the related technology easily causes waste of resources or packet loss, avoiding load backlog or packet loss caused by the device going online or offline, and making full use of system resources to improve the performance and stability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 is a hardware structure block diagram of the load balancing method of an embodiment of the present application;
[0012] Figure 2 is a flow chart of a load balancing method according to an embodiment of the present application;
[0013] Figure 3 is a structural block diagram of a large-capacity cluster simulation system according to an embodiment of the present application;
[0014] Figure 4 is a schematic diagram of traffic load balancing when a receiving device goes offline according to an embodiment of the present application;
[0015] Figure 5 is a flow chart of a load balancing method when a receiving device goes offline according to an embodiment of the present application;
[0016] Figure 6is a schematic diagram of traffic load balancing when a sending device is online according to an embodiment of the present application;
[0017] Figure 7 It is a flowchart of a load balancing method when a sending device goes online according to an embodiment of the present application. DETAILED DESCRIPTION
[0018] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0019] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0020] The method embodiments provided in the embodiments of the present application can be applied to network element devices of a distributed computing system and executed in a mobile terminal, a computer terminal, a server or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 is a hardware structure diagram of the load balancing method of the embodiment of the present application, such as Figure 1 As shown, the hardware board may include one or more ( Figure 1 Only one is shown in the figure) a processor 12 (the processor 12 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device) and a memory 14 for storing data, wherein the mobile terminal may also include a transmission device 16 for communication functions and an input and output device 18. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0021] The memory 14 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the load balancing method in the embodiment of the present application. The processor 12 executes various functional applications and load balancing methods by running the computer programs stored in the memory 14, that is, implementing the above method. The memory 14 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 14 may further include a memory remotely arranged relative to the processor 12, and these remote memories can be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0022] The transmission device 16 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider. In one example, the transmission device 16 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 16 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.
[0023] In one embodiment of the present application, a load balancing method is provided. Figure 2 is a flow chart of a load balancing method according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:
[0024] Step S202, when a cluster device changes, obtaining multiple groups of performance monitoring information of multiple receiving devices and data packet information of at least one data packet to be processed, wherein the data packet to be processed is a data packet to be processed by the cluster device that has changed;
[0025] Step S204, constructing a priority list of target data packets according to the multiple groups of performance monitoring information and the data packet information, wherein the target data packet is one of the to-be-processed data packets, and the priority list includes the processing priorities of the multiple receiving devices for the target data packet;
[0026] Step S206: determining a target receiving device for the target data packet from among the multiple receiving devices according to the priority list.
[0027] In an embodiment of the present application, through the above steps S202 to S206, the traffic load of the changing device can be adaptively adjusted when the device goes online or offline, and high-performance receiving devices can be preferentially selected as new forwarding paths, thereby solving the problem that the load balancing algorithm in the related technology easily causes waste of resources or packet loss, avoiding load backlog or packet loss caused by the device going online or offline, and making full use of system resources to improve system performance and stability.
[0028] In some embodiments, step S204 may include the following steps:
[0029] Step S2042, determining the processing priority of the corresponding receiving device according to the data packet information of the target data packet and each group of the performance monitoring information;
[0030] Step S2044: sort the processing priorities of the multiple receiving devices in ascending order to obtain the priority list.
[0031] In some embodiments, the performance monitoring information includes at least one of the following: processing performance coefficient, forwarding performance coefficient, central processing unit (CPU) processing speed and forwarding bandwidth; the data packet information includes at least one of the following: data packet size, requested CPU size. According to the load balancing requirements, other performance data can also be obtained to evaluate the processing priority of the device, which is not limited in this application.
[0032] In some embodiments, step S2042 may include the following steps: determining the processing delay of the receiving device based on the data packet size, the CPU processing speed and the requested CPU size; determining the forwarding delay of the receiving device based on the data packet size and the forwarding bandwidth; determining the processing priority of the receiving device based on the processing performance coefficient, the forwarding performance coefficient, the processing delay and the forwarding delay.
[0033] In some embodiments, step S2042 may also be implemented by the following formula.
[0034] Formula 1:
[0035] Among them, T i proc is the processing delay of the i-th receiving device, is the CPU processing speed of the i-th receiving device, Data j is the packet size of the jth target packet, The CPU size requested for the jth target packet;
[0036] Formula 2:
[0037] Among them, T i fwd is the forwarding delay of the i-th receiving device, is the forwarding bandwidth of the i-th receiving device;
[0038] Formula 3:
[0039] Among them, Q i is the processing priority of the i-th receiving device, is the processing performance coefficient of the i-th receiving device, is the forwarding performance coefficient of the i-th receiving device.
[0040] In this embodiment, i and j are positive integers. If there are M data packets to be processed and N receiving devices, then 1≤i≤N, 1≤j≤M.
[0041] In some embodiments, step S206 may include: based on the performance monitoring information and the data packet information, determining from the priority list a receiving device that meets the target data packet requirements and has the lowest processing priority as the target receiving device, wherein the lower the processing priority, the better the processing performance of the receiving device.
[0042] In some embodiments, according to the performance monitoring information and the data packet information, determining from the priority list a receiving device that meets the target data packet requirements and has the lowest processing priority as the target receiving device may include the following steps:
[0043] Step S2062, determining a receiving device with the lowest processing priority from the multiple receiving devices according to the priority list;
[0044] Step S2064, judging whether the receiving device with the lowest processing priority meets the target data packet requirement according to the performance monitoring information and the data packet information;
[0045] Step S2066, if the judgment result is yes, determining the receiving device with the lowest processing priority as the target receiving device;
[0046] Step S2068, if the judgment result is no, other receiving devices are judged in sequence according to the order of the priority list until any receiving device meets the target data packet requirement, and the receiving device that meets the target data packet requirement is determined as the target receiving device.
[0047] In another embodiment, if none of the receiving devices in the priority list meets the requirements of the target data packet, the target data packet may be put back into the cache queue storing data packets to be processed, waiting for an idle receiving device to appear.
[0048] In some embodiments, the performance monitoring information includes but is not limited to: CPU idleness, memory idleness, and network bandwidth idleness, and the data packet information includes but is not limited to data packet size and requested CPU size.
[0049] In some embodiments, step S2064 may include: determining whether the CPU idle level of the receiving device is greater than the requested CPU size; determining whether the memory idle level of the receiving device is greater than the data packet size; determining the transmission data size of the receiving device per unit time based on the network bandwidth idle level, and determining whether the transmission data size per unit time is greater than the data packet size; if the judgment results are all yes, determining that the receiving device meets the target data packet requirements, otherwise, determining that the receiving device does not meet the target data packet requirements.
[0050] In this embodiment, the specific conditions for determining whether the receiving device with the lowest processing priority meets the requirements of the target data packet in step S2064 can be adjusted according to actual needs, and the present application is not limited to the above-mentioned determination conditions.
[0051] In some embodiments, before step S204, the method further includes step S203, sorting a plurality of data to be processed, and taking each data packet to be processed as a target data packet in turn.
[0052] In this embodiment, step S203 may include the following steps:
[0053] Step S2032, sorting the to-be-processed data packets according to the queuing time in the data packet information;
[0054] Step S2034, according to the sorting result, the to-be-processed data packets are sequentially placed into a queue to be forwarded;
[0055] Step S2036, taking out a data packet to be processed from the head of the queue to be forwarded as the target data packet.
[0056] In some embodiments, after step S206, the method further includes:
[0057] Step S2072, updating the performance monitoring information of the target receiving device according to the data packet information of the target data packet;
[0058] Step S2074, determining whether there are any remaining data packets to be processed in the queue to be forwarded;
[0059] Step S2076: If the result of the judgment is yes, a new data packet to be processed is taken out from the head of the queue to be forwarded as the target data packet.
[0060] In an exemplary embodiment, step S2072 may include removing the resources occupied by the target data packet from the performance monitoring information of the target receiving device to obtain new performance monitoring information. For example, the new CPU idleness can be calculated by subtracting the CPU size requested by the target data packet from the original CPU idleness. Through this step, the accurate update of the performance monitoring information can be directly achieved without interacting with the performance monitoring device, and the processing stage of the next data packet can be entered.
[0061] In some embodiments, step S202 may include:
[0062] Step S2022, when any receiving device goes offline, obtaining data packet information of at least one to-be-processed data packet to be sent to the target offline device;
[0063] Alternatively, step S2024, when any sending device is online, obtaining data packet information of at least one to-be-processed data packet to be sent by the target sending device;
[0064] Step S2026, when any receiving device goes offline or any sending device comes online, multiple groups of performance monitoring information of multiple receiving devices are obtained.
[0065] In the embodiment of the present application, changes in cluster devices are mainly divided into four situations: sending devices going online or offline, receiving devices going online or offline, among which, when the sending device goes offline or the receiving device goes online, there is no problem of data packet backlog, and traffic load fluctuations will not be caused. The receiving device going offline will cause the data packets originally intended to be sent to the device to not be received normally, and the sending device going online will generate new data packets, which will cause data packet backlog or packet loss. Through the embodiment of the present application, it is possible to avoid load backlog or packet loss caused by devices going online and offline, thereby solving the problem that the load balancing algorithm in the related technology is prone to waste of resources or packet loss.
[0066] The traffic load balancing method in the embodiment of the present application is mainly applied to a distributed computing environment that needs to process a large number of requests. The environment may have the following basic conditions:
[0067] Large-capacity cluster simulation system: This application environment can be composed of a large-capacity cluster simulation system with a large number of high-performance simulation devices. The underlying infrastructure consists of servers, switches, routers, etc. to process and forward a large amount of traffic. Each simulation device needs to have high-speed CPU computing resources, sufficient memory space, high-speed network bandwidth and large-capacity forwarding queues to meet the needs of traffic load balancing. At the same time, each simulation device also needs to support real-time monitoring and reporting of its own performance indicators so that the algorithm can perform intelligent traffic distribution and adaptive load balancing.
[0068] High-speed network communication environment: The application environment can have a high-speed, efficient and stable network environment to ensure fast transmission and response of traffic. The network environment needs to support high-speed data transmission protocols, such as TCP / IP protocol or high-performance data plane communication framework, such as Data Plane Development Kit (DPDK), to ensure the reliability and stability of data transmission.
[0069] Monitoring and control system: The application environment can have the ability to monitor and control the system in real time, so as to monitor and control the network load, device performance, traffic distribution, etc. In particular, a real-time monitoring and control system is required to monitor and report the performance indicators of each simulated device in real time.
[0070] Figure 3is a structural block diagram of a large-capacity cluster simulation system according to an embodiment of the present application, such as Figure 3 As shown, the system includes the following structure:
[0071] A simulation sending device 32 , a simulation receiving device 34 and a real-time status monitoring device 36 .
[0072] In this embodiment, the simulation sending device and the simulation receiving device are important components of the large-capacity cluster simulation system, and are respectively used to simulate the data sending and receiving processes in the network.
[0073] The simulation sending device 32 is used to simulate the data sending process in the network, and is usually composed of multiple virtual machines, containers or processes. They can simulate different sending sources and sending destinations, and send various types of data packets through the network. In a large-capacity cluster simulation system, the simulation sending device can be used to test performance indicators such as reliability, bandwidth, delay, and throughput of network transmission, and can simulate different network load and traffic scenarios to evaluate the performance and stability of the system.
[0074] The simulated receiving device 34 is used to simulate the data receiving process in the network, and is usually composed of multiple virtual machines, containers or processes. They can receive data packets from the simulated sending device and perform corresponding processing and response.
[0075] The real-time status monitoring device 36 is a software device for monitoring the status of the simulation device. It can collect and analyze various performance indicators of the simulation device, such as CPU idleness, memory idleness, network bandwidth idleness, etc., so as to timely discover and respond to the status changes of the simulation device, and monitor and update the above performance indicators in real time during the operation and online and offline process of the device.
[0076] In this embodiment, in order to solve the traffic load fluctuation problem caused by the online and offline devices in the large container cluster simulation system, it is assumed that there are multiple simulated sending devices and multiple simulated receiving devices in the simulation system, and each simulated sending device has a data path to any simulated receiving device, that is, the number of uplinks of each simulated sending device is equal to that of the simulated receiving device. This problem can be divided into the following four cases for discussion:
[0077] Case 1: The simulated sending device is offline:
[0078] When a device goes offline in the system and the device that goes offline is a simulated sending device, the simulated sending device will no longer generate new data packets and will send the remaining data packets. If the destination address of the remaining data packets to be sent contains the address of a simulated receiving device that has gone offline, it will be processed according to situation two. After the remaining data packets successfully reach the destination simulated receiving device, the simulated sending device will notify the real-time monitoring device to stop monitoring it and complete the offline process.
[0079] Case 2: The simulated receiving device is offline:
[0080] When a device goes offline in the system and the device that goes offline is a simulated receiving device, the forwarding path is replanned for the traffic to be sent to the offline simulated receiving device according to the steps in any of the above method embodiments.
[0081] Case 3: The simulated receiving device is online:
[0082] When a device goes online in the system and the device that goes online is a simulated receiving device, the real-time status monitoring device is notified to monitor, and all simulated sending devices are notified by broadcast, and data packets can be sent to the receiving device to complete the online operation. In particular, when there are still data packets in the cache queue of the simulated sending device, the forwarding path of the data packets in the cache queue can be replanned according to the steps in any of the above method embodiments.
[0083] Case 4: Simulation sending device online:
[0084] When a device goes online in the system and the device that goes online is a simulated sending device, a forwarding path is planned for the newly generated traffic in the simulated system according to the steps in any of the above method embodiments.
[0085] Figure 4 is a schematic diagram of traffic load balancing when a receiving device is offline according to an embodiment of the present application, such as Figure 4 As shown in FIG. 1 , when the receiving device goes offline, the traffic to be sent to the offline simulated receiving device is re-planned as a new forwarding path through traffic load balancing. The single arrow with a dotted line represents the original forwarding path, and the single arrow with a solid line represents the forwarding path after traffic load balancing.
[0086] In this embodiment, when the receiving device a2 goes offline, the data packets originally intended to be sent to a2 are redistributed to other receiving devices after load balancing.
[0087] Figure 5 is a flow chart of a load balancing method when a receiving device goes offline according to an embodiment of the present application. Figure 5 As shown, the load balancing method when the receiving device is offline may include the following steps:
[0088] Step S500, receiving a device application to go offline;
[0089] Step S501, obtain the real-time performance monitoring information of all online simulation receiving devices, including the number of all online receiving devices Num recv , the idle CPU computing resource size of each simulated receiving device (i.e. CPU idleness) freecpu i, free memory size (i.e. memory freeness) freemem i , the size of the idle network bandwidth (i.e. the degree of idle network bandwidth) freenet i , and the size of the packet receiving queue that can be accommodated at the current moment freequeue i , where 0<i≤Num recv .
[0090] Step S502: Obtain the number of all data packets Num to be sent to the simulated receiving device that is about to go offline from the cache queue. send , the data size of each data packet Data j and waiting time Furthermore, the information obtained in step S501 and step S502 may be used as input for subsequent processing.
[0091] Step S503: according to the queuing time of the data packet The packets with longer queue time are put into the queue to be forwarded first.
[0092] Step S504: Take a data packet from the head of the queue to be forwarded, and calculate the forwarding priority (i.e., processing priority) Q of each simulated receiving device according to the obtained real-time monitoring information of the simulated device. i (0<i≤Num recv ). According to the forwarding priority of each simulated receiving device, a priority list of the simulated receiving devices of the data packet can be constructed. i The smaller the value, the better the performance of the corresponding receiving device.
[0093] In an exemplary embodiment, the priority calculation formula is as follows:
[0094]
[0095]
[0096]
[0097] Among them, T i proc represents the processing delay of the simulated receiving device i, T i fwd represents the forwarding delay of the simulated receiving device i, They represent the processing performance coefficient and forwarding performance coefficient of the simulated receiving device i, respectively. j represents the packet size of packet j, Indicates the CPU processing speed of the simulated receiving device i, Indicates the CPU resource size requested by data packet j, Indicates the forwarding bandwidth of the simulated receiving device i.
[0098] Step S505: Select the priority Q according to the priority list in step S504. i The smallest simulated receiving device that meets freemem i >Data j , freenet i >Data j , the data packet is forwarded to the simulated receiving device. If the CPU idleness, memory idleness or network bandwidth idleness of the simulated receiving device does not meet the above conditions, the next priority simulated receiving device is selected until the CPU idleness, memory idleness and network bandwidth idleness of the selected simulated receiving device meet the request of the data packet, the sending device identification (Identity document, referred to as ID) and the receiving device ID are recorded, and the forwarding path is output.
[0099] Step S506: The real-time status monitoring device updates the corresponding simulation receiving device status information. freequeue i =freequeue i -1,freemem i =freemem i -Data j , freenet i =freenet i -Data j .
[0100] Step S507: if there are still data packets in the queue to be forwarded after step S505, the operations of step S504 to step S506 are repeated until all data packets in the queue to be forwarded are sent.
[0101] Step S508: If there are still remaining data packets that have not been sent after steps S504 to S507, they are temporarily stored in the cache queue and wait for an idle simulated receiving device to appear, and then steps S502 to S507 are repeated.
[0102] Figure 6 is a schematic diagram of traffic load balancing when a sending device is online according to an embodiment of the present application, such as Figure 6 As shown in FIG. 1 , when the sending device is online, a forwarding path is planned for the newly generated traffic in the simulation system through traffic load balancing. The single arrow with a solid line represents the forwarding path after traffic load balancing.
[0103] In this embodiment, when the sending device b5 comes online, the newly generated data packets of b5 are distributed to the online receiving devices after load balancing.
[0104] Figure 7 is a flow chart of a load balancing method when a sending device is online according to an embodiment of the present application, such as Figure 7 As shown, the load balancing method when the sending device is online may include the following steps:
[0105] Step S700, sending a device application to go online;
[0106] Step S701, obtain the real-time performance monitoring information of all online simulation receiving devices, including the number of all online receiving devices Num recv , the idle CPU computing resource size of each simulated receiving device (i.e. CPU idleness) freecpu i , free memory size (i.e. memory freeness) freemem i , the size of the idle network bandwidth (i.e. the degree of idle network bandwidth) freenet i , and the size of the packet receiving queue that can be accommodated at the current moment freequeue i , where 0<i≤Num recv .
[0107] Step S702: Obtain the number of all data packets Num generated by the newly online simulated sending device from the cache queue send , the data size of each data packet Data j and waiting time Furthermore, the information obtained in step S701 and step S702 may be used as input for subsequent processing.
[0108] Step S703: according to the queuing time of the data packet The packets with longer queue time are put into the queue to be forwarded first.
[0109] Step S704: Take a data packet from the head of the queue to be forwarded, and calculate the forwarding priority (i.e., processing priority) Q of each simulated receiving device according to the obtained real-time monitoring information of the simulated device. i (0<i≤Num recv ). According to the forwarding priority of each simulated receiving device, a priority list of the simulated receiving devices of the data packet can be constructed. i The smaller the value, the better the performance of the corresponding receiving device.
[0110] In an exemplary embodiment, the priority calculation formula is as follows:
[0111]
[0112]
[0113]
[0114] Among them, T i proc represents the processing delay of the simulated receiving device i, T i fwd represents the forwarding delay of the simulated receiving device i, They represent the processing performance coefficient and forwarding performance coefficient of the simulated receiving device i, respectively. j represents the packet size of packet j, Indicates the CPU processing speed of the simulated receiving device i, Indicates the CPU resource size requested by data packet j, Indicates the forwarding bandwidth of the simulated receiving device i.
[0115] Step S705: Select the priority Q according to the priority list in step S704. i The smallest simulated receiving device that meets freemem i >Data j , freenet i >Data j , the data packet is forwarded to the simulated receiving device. If the CPU idleness, memory idleness or network bandwidth idleness of the simulated receiving device does not meet the above conditions, the next priority simulated receiving device is selected until the CPU idleness, memory idleness and network bandwidth idleness of the selected simulated receiving device meet the request of the data packet, the sending device identification (Identity document, referred to as ID) and the receiving device ID are recorded, and the forwarding path is output.
[0116] Step S706: The real-time status monitoring device updates the corresponding simulation receiving device status information. freequeue i =freequeue i -1,freemem i =freemem i -Data j , freenet i =freenet i -Data j .
[0117] Step S707: if there are still data packets in the queue to be forwarded after step S705, the operations of steps S704 and S706 are repeated until all data packets in the queue to be forwarded are sent.
[0118] Step S708: If there are still remaining data packets that have not been sent after steps S704 to S707, they are temporarily stored in the cache queue and wait for an idle simulated receiving device to appear, and then steps S702 to S707 are repeated.
[0119] The embodiments of the present application are mainly aimed at traffic load balancing when cluster devices change dynamically, and realize adaptive configuration adjustment to changes in devices going online and offline. In actual applications, static load balancing or other load balancing methods can also be combined to cope with traffic load balancing after the cluster devices are stabilized.
[0120] The embodiments of the present application can be applied to scenarios in which load balancing of traffic in a large-capacity cluster simulation system is required when a simulation device goes online or offline, including but not limited to the following scenarios:
[0121] Scenario 1: Dynamically balance traffic load in a simulation system of high-capacity and high-speed communication equipment when traffic fluctuations are caused by the simulation chip going online or offline.
[0122] Scenario 2: Dynamically balance traffic load in a large-scale drone self-organizing network simulation system when traffic fluctuations are caused by the online and offline simulation of drones.
[0123] Scenario three: In a large-scale satellite network simulation system, dynamic traffic load balancing is performed to deal with traffic fluctuations caused by the online and offline operation of simulated satellites.
[0124] The traffic load balancing method in the embodiment of the present application has the following beneficial effects:
[0125] By adopting real-time dynamic load monitoring technology and load balancing algorithm based on real-time status information of simulation equipment, the traffic load can be dynamically adjusted according to the real-time traffic load situation, thereby achieving a more balanced load distribution.
[0126] By using a load balancing algorithm based on a priority mechanism, high-performance simulated receiving devices are selected as the new forwarding path for data packets when the simulated devices are online or offline, which can fully utilize system resources and improve system performance and efficiency. It can also solve problems such as device idling and packet loss, further improving system performance and efficiency.
[0127] Adopting an adaptive load balancing method, when some devices fail or go offline, the traffic load can be automatically transferred to other devices, thus ensuring the reliability and stability of the system.
[0128] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program executes the steps of any of the above method embodiments when executed by a processor.
[0129] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0130] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0131] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0132] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0133] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0134] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A load balancing method, characterized in that: The method comprises: When a cluster device changes, multiple groups of performance monitoring information of multiple receiving devices and data packet information of at least one data packet to be processed are obtained, wherein the data packet to be processed is a data packet to be processed by the cluster device that has changed; Constructing a priority list of target data packets according to the multiple groups of performance monitoring information and the data packet information, wherein the target data packet is one of the data packets to be processed, and the priority list includes the processing priorities of the multiple receiving devices for the target data packet; A target receiving device for the target data packet is determined from among the plurality of receiving devices according to the priority list.
2. The method according to claim 1, characterized in that Constructing a priority list of target data packets according to the multiple groups of performance monitoring information and the data packet information, including: Determine the processing priority of the corresponding receiving device according to the data packet information of the target data packet and each group of the performance monitoring information; The processing priorities of the multiple receiving devices are sorted in ascending order to obtain the priority list.
3. The method according to claim 2, characterized in that The performance monitoring information includes at least one of the following: processing performance coefficient, forwarding performance coefficient, CPU processing speed and forwarding bandwidth; the data packet information includes at least one of the following: data packet size, requested CPU size.
4. The method according to claim 3, characterized in that Determining the processing priority of the corresponding receiving device according to the data packet information of the target data packet and each group of the performance monitoring information, including: Determining a processing delay of the receiving device according to the data packet size, the CPU processing speed, and the requested CPU size; Determining a forwarding delay of the receiving device according to the data packet size and the forwarding bandwidth; The processing priority of the receiving device is determined according to the processing performance coefficient, the forwarding performance coefficient, the processing delay, and the forwarding delay.
5. The method according to claim 4, characterized in that Determining the processing delay of the receiving device according to the data packet size, the CPU processing speed, and the requested CPU size includes: Among them, T i proc is the processing delay of the i-th receiving device, is the CPU processing speed of the i-th receiving device, Data j is the packet size of the jth target packet, The CPU size requested for the jth target packet; Determining the forwarding delay of the receiving device according to the data packet size and the forwarding bandwidth includes: Among them, T i fwd is the forwarding delay of the i-th receiving device, is the forwarding bandwidth of the i-th receiving device; Determining the processing priority of the receiving device according to the processing performance coefficient, the forwarding performance coefficient, the processing delay, and the forwarding delay includes: Among them, Q i is the processing priority of the i-th receiving device, is the processing performance coefficient of the i-th receiving device, is the forwarding performance coefficient of the i-th receiving device.
6. The method according to claim 1, characterized in that Determining a target receiving device of the target data packet from the plurality of receiving devices according to the priority list includes: According to the performance monitoring information and the data packet information, the receiving device that meets the target data packet requirements and has the lowest processing priority is determined from the priority list as the target receiving device, wherein the smaller the processing priority, the better the processing performance of the receiving device.
7. The method according to claim 6, characterized in that According to the performance monitoring information and the data packet information, determining from the priority list a receiving device that meets the target data packet requirements and has the lowest processing priority as the target receiving device, comprising: Determining a receiving device with the lowest processing priority from among the plurality of receiving devices according to the priority list; Determining whether the receiving device with the lowest processing priority meets the target data packet requirement according to the performance monitoring information and the data packet information; If the judgment result is yes, determining the receiving device with the lowest processing priority as the target receiving device; When the judgment result is no, other receiving devices are judged in turn according to the order of the priority list until any receiving device meets the target data packet requirement, and the receiving device that meets the target data packet requirement is determined as the target receiving device.
8. The method according to claim 7, characterized in that The performance monitoring information includes: CPU idleness, memory idleness, and network bandwidth idleness; the data packet information includes data packet size and requested CPU size; judging whether the receiving device with the lowest processing priority meets the target data packet requirement based on the performance monitoring information and the data packet information includes: Determine whether the CPU idleness of the receiving device is greater than the requested CPU size; Determining whether the memory free space of the receiving device is greater than the size of the data packet; Determine the size of data transmitted by the receiving device in a unit time according to the idleness of the network bandwidth, and judge whether the size of data transmitted in the unit time is greater than the size of the data packet; If the judgment results are all yes, it is determined that the receiving device meets the target data packet requirement; otherwise, it is determined that the receiving device does not meet the target data packet requirement.
9. The method according to claim 1, characterized in that: Before constructing a priority list of target data packets according to the multiple sets of performance monitoring information and the data packet information, the method further includes: Sorting the to-be-processed data packets according to the queuing time in the data packet information; According to the sorting result, the to-be-processed data packets are sequentially placed into a queue to be forwarded; A data packet to be processed is taken from the head of the queue to be forwarded as the target data packet.
10. The method according to claim 9, characterized in that After determining the target receiving device of the target data packet from the plurality of receiving devices according to the priority list, the method further includes: Updating the performance monitoring information of the target receiving device according to the data packet information of the target data packet; Determine whether there are any remaining data packets to be processed in the queue to be forwarded; If the judgment result is yes, a data packet to be processed is taken out from the head of the queue to be forwarded again as the target data packet.
11. The method according to claim 1, characterized in that: When a cluster device changes, obtaining multiple groups of performance monitoring information of multiple receiving devices and data packet information of at least one data packet to be processed includes: When any receiving device goes offline, obtaining data packet information of at least one to-be-processed data packet to be sent to a target offline device; When any sending device is online, obtaining data packet information of at least one data packet to be processed that the target sending device is ready to send; When any receiving device goes offline or any sending device goes online, multiple groups of performance monitoring information of multiple receiving devices are obtained.
12. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program executes the method described in any one of claims 1 to 11 when executed by a processor.
13. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 11.