A load balancing method, system, device, and computer-readable storage medium

By identifying overloaded and unloaded computing engines in a multi-core device, allocating data to the unloaded engines, and marking engine status, the problem of load imbalance between computing engines is solved, thus improving device performance.

CN115098267BActive Publication Date: 2026-07-17SANGFOR TECH INC

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SANGFOR TECH INC
Filing Date
2022-07-18
Publication Date
2026-07-17

Smart Images

  • Figure CN115098267B_ABST
    Figure CN115098267B_ABST
Patent Text Reader

Abstract

This application discloses a load balancing method, system, device, and computer-readable storage medium applied to load balancing scenarios. The method involves: acquiring target data to be allocated; determining the overloaded and unloaded computing engines in a multi-core device at the current moment; selecting a computing engine among the unloaded computing engines that has not been allocated data as the target computing engine at the current moment; allocating the target data to the target computing engine at the current moment; marking overloaded computing engines among the unloaded computing engines as overloaded computing engines; and marking unloaded computing engines among the overloaded computing engines as unloaded computing engines. This application avoids the load imbalance among multiple computing engines caused by re-allocating target data to overloaded computing engines. Furthermore, it can update the overload and unloaded states of computing engines in a timely manner, facilitating accurate data allocation based on the overload and unloaded states of computing engines in the next moment, thus facilitating load balancing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of load balancing technology, and more specifically, to a load balancing method, system, device, and computer-readable storage medium. Background Technology

[0002] With the development of computer technology, multi-core devices are being used more and more widely. Multicore refers to integrating two or more complete computing engines (cores) into a single processor. With the help of multicore technology, devices can process data in parallel, thereby improving processing efficiency.

[0003] However, during the operation of a multi-core device, there is a need to distribute tasks to multiple computing engines. If the task distribution among multiple computing engines is uneven, it will lead to an imbalance in the load between the multiple computing engines, which may cause network lag and other issues, affecting the performance of the multi-core device.

[0004] In summary, how to achieve load balancing among computing engines in multi-core devices is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] The purpose of this application is to provide a load balancing method that can, to some extent, solve the technical problem of how to achieve load balancing among computing engines in a multi-core device. This application also provides a load balancing system, an electronic device, and a computer-readable storage medium.

[0006] To achieve the above objectives, this application provides the following technical solution:

[0007] A load balancing method, comprising:

[0008] Obtain the target data to be assigned;

[0009] Identify the overloaded and non-overloaded computing engines in a multi-core device at the current moment;

[0010] The computing engine that has not been allocated data is selected from the unloaded computing engines as the target computing engine at the current moment;

[0011] Assign the target data to the target computing engine at the current moment;

[0012] The computing engines that are overloaded in the non-overloaded computing engines are marked as the overloaded computing engines;

[0013] The computing engines that are not overloaded in the overloaded computing engines are marked as the unoverloaded computing engines.

[0014] Preferably, determining the overloaded and non-overloaded computing engines in the multi-core device at the current moment includes:

[0015] Determine the overload queue and scheduling queue in the multi-core device at the current time. The overload queue is used to record the overloaded computing engines, and the scheduling queue is used to record the non-overloaded computing engines.

[0016] Preferably, selecting the computing engine that has not been allocated data from the unoverloaded computing engines as the target computing engine at the current moment includes:

[0017] In the scheduling queue, the computing engine pointed to by the scheduling cursor at the current moment is taken as the target computing engine at the current moment;

[0018] After selecting the computing engine without allocated data from the unoverloaded computing engines as the target computing engine for the current moment, the method further includes:

[0019] The scheduling cursor at the next moment is controlled to point to the next computing engine in the scheduling queue that is the target computing engine at the current moment;

[0020] Wherein, if the target computing engine at the current moment is the last computing engine in the scheduling queue, then the next computing engine after the target computing engine at the current moment is the first computing engine in the scheduling queue.

[0021] Preferably, marking the overloaded computing engines among the non-overloaded computing engines as the overloaded computing engines includes:

[0022] Determine whether the target computing engine was overloaded in the previous moment;

[0023] If the target computing engine in the previous time step is overloaded, then the target computing engine in the scheduling queue in the previous time step is transferred to the tail of the overload queue.

[0024] Preferably, marking the unoverloaded computing engines among the overloaded computing engines as the unoverloaded computing engines includes:

[0025] In the overload queue, determine whether the computing engine corresponding to the overload cursor at the current moment is not overloaded;

[0026] If the computing engine corresponding to the overload cursor at the current moment is not overloaded, then the computing engine corresponding to the overload cursor at the current moment in the overload queue is transferred to the tail of the scheduling queue.

[0027] After marking the unoverloaded computing engines in the overloaded computing engines as the unoverloaded computing engines, the method further includes:

[0028] The overload cursor at the next moment is controlled to point to the next computing engine in the overload queue corresponding to the overload cursor at the current moment.

[0029] Preferably, after controlling the scheduling cursor to point to the next computing engine in the scheduling queue for the target computing engine at the current moment, the method further includes:

[0030] If the scheduling cursor in the next moment points to the first computing engine in the scheduling queue, then the overload cursor in the next moment is controlled to point to the first computing engine in the overload queue.

[0031] Preferably, in the scheduling queue, selecting the computing engine pointed to by the current scheduling cursor as the target computing engine at the current moment includes:

[0032] Determine whether the current scheduling cursor is locked;

[0033] If the current scheduling cursor is unlocked, then the current scheduling cursor is locked, and the computing engine pointed to by the current scheduling cursor is set as the target computing engine in the scheduling queue.

[0034] After marking the unoverloaded computing engines in the overloaded computing engines as the unoverloaded computing engines, the method further includes:

[0035] Release the lock on the current scheduling cursor.

[0036] A load balancing system, comprising:

[0037] The data acquisition module is used to acquire the target data to be assigned.

[0038] The computing engine determination module is used to determine the overloaded and non-overloaded computing engines in a multi-core device at the current moment.

[0039] The target computing engine determination module is used to select the computing engine that has not been allocated data from the unoverloaded computing engines as the target computing engine at the current moment.

[0040] The allocation module is used to allocate the target data to the target computing engine at the current moment;

[0041] An overloaded computing engine transfer module is used to mark the overloaded computing engine in the non-overloaded computing engines as the overloaded computing engine;

[0042] An unloaded computing engine transfer module is used to mark the unloaded computing engines among the overloaded computing engines as the unloaded computing engines.

[0043] An electronic device, comprising:

[0044] Memory, used to store computer programs;

[0045] A processor for executing the computer program to implement the steps of any of the load balancing methods described above.

[0046] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of any of the load balancing methods described above.

[0047] This application provides a load balancing method that involves: acquiring target data to be allocated; determining overloaded and non-overloaded computing engines in a multi-core device at the current time; selecting a computing engine that has not been allocated data from the non-overloaded computing engines as the target computing engine at the current time; allocating the target data to the target computing engine at the current time; marking overloaded computing engines in the non-overloaded computing engines as overloaded computing engines; and marking non-overloaded computing engines in the overloaded computing engines as non-overloaded computing engines. In this application, a computing engine that has not been allocated data is selected from the non-overloaded computing engines as the target computing engine at the current moment, and the target data is allocated to the target computing engine at the current moment. This achieves the allocation of target data to the non-overloaded computing engines that have not been allocated data, avoiding the load imbalance among multiple computing engines caused by re-allocating the target data to overloaded computing engines. In addition, by marking overloaded computing engines in the non-overloaded computing engines as overloaded computing engines and marking non-overloaded computing engines in the overloaded computing engines as non-overloaded computing engines, the overload and non-overload status of computing engines can be updated in a timely manner, facilitating accurate data allocation based on the overload and non-overload status of computing engines in the next moment, and facilitating load balancing among computing engines in multi-core devices. The load balancing system, electronic device, and computer-readable storage medium provided in this application also solve the corresponding technical problems. Attached Figure Description

[0048] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0049] Figure 1A system framework diagram of the load balancing scheme provided in the embodiments of this application;

[0050] Figure 2 A first flowchart of a load balancing method provided in an embodiment of this application;

[0051] Figure 3 A second flowchart of a load balancing method provided in an embodiment of this application;

[0052] Figure 4 A third flowchart of a load balancing method provided in an embodiment of this application;

[0053] Figure 5 Here is a flowchart of the existing load balancing solution;

[0054] Figure 6 This is a flowchart illustrating the load balancing scheme of this application.

[0055] Figure 7 This is a schematic diagram of the structure of a load balancing system provided in an embodiment of this application;

[0056] Figure 8 This is a schematic diagram of the hardware composition structure of the electronic device according to an embodiment of the present invention. Detailed Implementation

[0057] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0058] With the development of computer technology, multi-core devices are being used more and more widely. Multicore refers to integrating two or more complete computing engines (cores) into a single processor. With the help of multicore technology, devices can process data in parallel, thereby improving processing efficiency.

[0059] However, in the operation of multi-core devices, there is a need to distribute tasks across multiple computing engines. For example, a hash algorithm might be used to calculate the hash value of the source IP of a task, and then the remainder after dividing by the total number of cores is used to schedule the task to the computing engine corresponding to the remainder. During this process, when the task is relatively simple, i.e., the number of source IPs is small, all tasks might be scheduled to a single computing engine, leading to uneven task distribution across multiple computing engines. This, in turn, can cause load imbalance among the multiple computing engines, and in severe cases, cause network slowdowns and other issues, affecting the performance of the multi-core device. The load balancing solution provided in this application can achieve load balancing among computing engines in a multi-core device.

[0060] The system framework used in the load balancing scheme of this application can be found in [reference needed]. Figure 1 As shown, it may specifically include: a multi-core backend server 01 and a number of user terminals 02 that establish communication connections with the backend server 01.

[0061] In this application, the backend server 01 is used to perform load balancing steps, including: obtaining target data to be allocated; determining the overloaded computing engines and non-overloaded computing engines in the multi-core device at the current time; selecting the computing engine that has not been allocated data from the non-overloaded computing engines as the target computing engine at the current time; allocating the target data to the target computing engine at the current time; marking the overloaded computing engines in the non-overloaded computing engines as overloaded computing engines; and marking the non-overloaded computing engines in the overloaded computing engines as non-overloaded computing engines.

[0062] Furthermore, the backend server 01 may also include a target data database, an overloaded computing engine database, a non-overloaded computing engine database, and a target computing engine database. The target data database stores the acquired target data, the overloaded computing engine database stores the overloaded computing engine, the non-overloaded computing engine database stores the non-overloaded computing engine, and the target computing engine database stores the target computing engine, etc. In this application, the backend server 01 can respond to data processing requests from one or more user terminals 02. It is understood that data processing requests initiated by different user terminals 02 in this application can be processing requests for the same type of data or processing requests for different types of data.

[0063] Please see Figure 2 , Figure 2 This is a first flowchart of a load balancing method provided in an embodiment of this application.

[0064] This application provides a load balancing method that may include the following steps:

[0065] Step S101: Obtain the target data to be assigned.

[0066] In practical applications, the target data to be allocated can be obtained first. The method, type and content of the target data can be determined according to actual needs. For example, all data sent by the connection after establishing a connection with the user can be regarded as one type of target data. In this way, there are as many types of target data as there are connections. Moreover, the target data can be data that needs to be processed according to the processing method of the application layer. This application will not elaborate further here.

[0067] Step S102: Determine the overloaded computing engine and the non-overloaded computing engine in the multi-core device at the current moment.

[0068] In practical applications, after obtaining the target data to be allocated, the overloaded and non-overloaded computing engines in the multi-core device at the current moment can be determined so that the allocation of the target data can be determined based on the overloaded and non-overloaded computing engines.

[0069] It should be noted that the overload determination method for overloaded and non-overloaded computing engines in a multi-core device can be determined according to actual needs. For example, computing engines whose performance utilization exceeds a preset value can be classified as overloaded computing engines, and those whose performance utilization does not exceed the preset value can be classified as non-overloaded computing engines. In addition, the marking method for overloaded and non-overloaded computing engines can also be determined according to actual needs. For example, 1 can be used to represent a computing engine as an overloaded computing engine, and 0 can be used to represent a computing engine as a non-overloaded computing engine. Of course, overloaded and non-overloaded computing engines can also be marked in the form of queues. In this case, in the process of determining the overloaded and non-overloaded computing engines in the multi-core device at the current moment, the overload queue and scheduling queue in the multi-core device at the current moment can be determined. The overload queue is used to record overloaded computing engines, and the scheduling queue is used to record non-overloaded computing engines. That is, computing engines located in the overload queue are all overloaded computing engines, and computing engines located in the scheduling queue are all non-overloaded computing engines.

[0070] Step S103: Select the computing engine that has not been allocated data from the unloaded computing engines as the target computing engine at the current moment.

[0071] Step S104: Assign the target data to the target calculation engine at the current moment.

[0072] In practical applications, after determining the overloaded and unloaded computing engines in a multi-core device at the current moment, the computing engine that has not been allocated data among the unloaded computing engines can be selected as the target computing engine at the current moment, and the target data can be allocated to the target computing engine at the current moment. If the data is allocated in this way, since the target computing engine is an unloaded computing engine and has not been allocated data, the load of the target computing engine will not suddenly increase, thus preventing an unbalanced load situation.

[0073] It should be noted that, in the process of selecting the computing engine that has not been allocated data as the target computing engine at the current moment from the unloaded computing engines, the determination time for unallocated data can be flexibly determined according to actual needs. For example, in a round of data allocation, such as in the process of allocating target data of a target quantity, the target quantity can be the total number of computing engines, and the unloaded computing engine that has not been allocated data in this round of data allocation can be used as the target computing engine at the current moment. Of course, the unloaded computing engine that has not been allocated data within a preset time period can also be used as the target computing engine, etc. This application does not make specific limitations here.

[0074] Step S105: Mark the overloaded computing engines in the non-overloaded computing engines as overloaded computing engines.

[0075] Step S106: Mark the unoverloaded computing engines in the overloaded computing engines as unoverloaded computing engines.

[0076] In practical applications, after allocating the target data to the target computing engine at the current moment, it is also necessary to mark the overloaded computing engines among the non-overloaded computing engines as overloaded computing engines, and mark the non-overloaded computing engines among the overloaded computing engines as non-overloaded computing engines. This is to adjust the overload and non-overload states of the computing engines in a timely manner, thereby ensuring the accuracy of the overload and non-overload states of the computing engines in the next moment, and facilitating accurate data allocation based on the overload and non-overload states of the computing engines in the next moment.

[0077] This application provides a load balancing method that involves: acquiring target data to be allocated; determining overloaded and non-overloaded computing engines in a multi-core device at the current time; selecting a computing engine that has not been allocated data from the non-overloaded computing engines as the target computing engine at the current time; allocating the target data to the target computing engine at the current time; marking overloaded computing engines in the non-overloaded computing engines as overloaded computing engines; and marking non-overloaded computing engines in the overloaded computing engines as non-overloaded computing engines. In this application, a computing engine that has not been allocated data is selected from the non-overloaded computing engines as the target computing engine at the current moment, and the target data is allocated to the target computing engine at the current moment. This achieves the allocation of target data to the non-overloaded computing engines that have not been allocated data, avoiding the load imbalance among multiple computing engines caused by redistributing the target data to overloaded computing engines. In addition, by marking overloaded computing engines in the non-overloaded computing engines as overloaded computing engines and marking non-overloaded computing engines in the overloaded computing engines as non-overloaded computing engines, the overload and non-overload status of computing engines can be updated in a timely manner, which is convenient for accurate data allocation based on the overload and non-overload status of computing engines in the next moment, and facilitates the load balancing among computing engines in multi-core devices.

[0078] Please see Figure 3 , Figure 3 This is a second flowchart of a load balancing method provided in an embodiment of this application.

[0079] This application provides a load balancing method that may include the following steps:

[0080] Step S201: Obtain the target data to be assigned.

[0081] Step S202: Determine the overload queue and scheduling queue in the multi-core device at the current time. The overload queue is used to record overloaded computing engines, and the scheduling queue is used to record non-overloaded computing engines.

[0082] Step S203: In the scheduling queue, the computing engine pointed to by the current scheduling cursor is taken as the target computing engine for the current time.

[0083] Step S204: Control the scheduling cursor of the next moment to point to the next computing engine of the target computing engine in the scheduling queue at the current moment; wherein, if the target computing engine at the current moment is the last computing engine in the scheduling queue, then the next computing engine of the target computing engine at the current moment is the first computing engine in the scheduling queue.

[0084] In practical applications, when the overload and non-overload status of computing engines are represented by a queue, during the process of selecting a computing engine without allocated data from the non-overloaded computing engines as the target computing engine at the current moment, the computing engine pointed to by the current scheduling cursor can be used as the target computing engine at the current moment in the scheduling queue, so as to quickly determine the target computing engine with the help of the scheduling cursor. Correspondingly, after selecting a computing engine without allocated data from the non-overloaded computing engines as the target computing engine at the current moment, the scheduling cursor at the next moment can be controlled to point to the next computing engine of the target computing engine in the scheduling queue, so as to update the scheduling cursor at the next moment in time, thereby facilitating the rapid determination of the target computing engine at the next moment. It should be noted that if the target computing engine at the current moment is the last computing engine in the scheduling queue, the next computing engine of the target computing engine at the current moment can be the first computing engine in the scheduling queue. Of course, there can be other settings, which are not specifically limited in this application.

[0085] Step S205: Assign the target data to the target calculation engine at the current moment.

[0086] Step S206: Mark the overloaded computing engines in the non-overloaded computing engines as overloaded computing engines.

[0087] Step S207: Mark the unoverloaded computing engines in the overloaded computing engines as unoverloaded computing engines.

[0088] Please see Figure 4 , Figure 4 This is a third flowchart of a load balancing method provided in an embodiment of this application.

[0089] This application provides a load balancing method that may include the following steps:

[0090] Step S301: Obtain the target data to be assigned.

[0091] Step S302: Determine the overload queue and scheduling queue in the multi-core device at the current time. The overload queue is used to record overloaded computing engines, and the scheduling queue is used to record non-overloaded computing engines.

[0092] Step S303: Select the computing engine that has not been allocated data from the unloaded computing engines as the target computing engine at the current moment.

[0093] Step S304: Assign the target data to the target calculation engine at the current moment.

[0094] Step S305: Determine whether the target computing engine was overloaded in the previous moment; if the target computing engine was overloaded in the previous moment, proceed to step S306.

[0095] Step S306: Move the target computing engine from the previous time step in the scheduling queue to the tail of the overload queue.

[0096] In practical applications, during the process of marking overloaded computing engines in the non-overloaded computing engine queue as overloaded computing engines, since the target computing engine in the previous moment was allocated data, it is most likely to be overloaded. Therefore, it is possible to determine whether the target computing engine in the previous moment is overloaded. If the target computing engine in the previous moment is overloaded, it can be moved from the scheduling queue to the tail of the overload queue to quickly determine whether the computing engines in the scheduling queue that may be overloaded are actually overloaded, and quickly move the overloaded computing engines in the scheduling queue to the overload queue.

[0097] Step S307: In the overload queue, determine whether the computing engine corresponding to the current overload cursor is not overloaded; if the computing engine corresponding to the current overload cursor is not overloaded, then execute step S308.

[0098] Step S308: Transfer the computing engine corresponding to the current overload cursor in the overload queue to the tail of the scheduling queue.

[0099] In practical applications, during the process of marking non-overloaded computing engines in the overloaded computing engine queue as non-overloaded computing engines, it is possible to determine whether the computing engine corresponding to the current overload cursor is not overloaded in the overload queue. If the computing engine corresponding to the current overload cursor is not overloaded, the computing engine corresponding to the current overload cursor in the overload queue can be moved to the tail of the scheduling queue to quickly determine whether the overloaded computing engines in the overload queue have been updated to non-overloaded, and quickly move the non-overloaded computing engines in the overload queue to the scheduling queue.

[0100] Step S309: Control the overload cursor of the next moment to point to the next computing engine of the computing engine corresponding to the overload cursor of the current moment in the overload queue.

[0101] Step S310: If the scheduling cursor in the next time step points to the first computing engine in the scheduling queue, then control the overload cursor in the next time step to point to the first computing engine in the overload queue.

[0102] In practical applications, after marking the non-overloaded computing engines in the overloaded computing engine as non-overloaded computing engines, it is also possible to control the overload cursor in the next moment to point to the next computing engine of the computing engine corresponding to the current overload cursor in the overload queue. In this process, if the scheduling cursor in the next moment points to the first computing engine in the scheduling queue, then the overload cursor in the next moment is controlled to point to the first computing engine in the overload queue.

[0103] In specific application scenarios, there is a need to allocate multiple target data simultaneously. In this case, multiple target data may be allocated to the same computing engine, leading to computing engine conflicts. To avoid this problem, locking technology can be used to handle it accordingly. For example, in the scheduling queue, when setting the computing engine pointed to by the current scheduling cursor as the target computing engine at the current moment, it can be checked whether the current scheduling cursor is locked. If the current scheduling cursor is not locked, it is locked, and the computing engine pointed to by the current scheduling cursor is set as the target computing engine at the current moment in the scheduling queue. Correspondingly, after marking the non-overloaded computing engines in the overloaded computing engine list as non-overloaded computing engines, the lock on the current scheduling cursor can be released.

[0104] To facilitate understanding of the load balancing solution provided in this application, the existing load balancing solutions and the load balancing solution of this application will be compared and explained in conjunction with the packet receiving process of the network card and the packet processing process of the firewall. The firewall is a multi-core device, that is, a multi-computing engine device.

[0105] Existing load balancing solutions such as Figure 5 As shown, after the network interface card (NIC) receives a packet, it determines whether the corresponding connection has been scheduled. If it has been scheduled, subsequent packets on the connection containing the packet do not need to be scheduled, and the packet can be sent to the corresponding kernel in the application layer for security checks. If it has not been scheduled, it determines whether the packet needs to be scheduled. If scheduling is required, the packet is scheduled based on the source IP hash algorithm, and after scheduling, the packet is sent to the corresponding kernel in the application layer. If no scheduling is required, the NIC directly sends the packet to the application layer. During this process, when the kernel adds a packet to the queue, it moves the write pointer W forward by one position; when the SMP (Security Monitoring Process) starts processing a packet from the queue, it moves the read pointer R forward by one position to indicate that the SMP is processing the packet; after processing a packet, the SMP moves the send pointer S forward by one position to indicate that the packet has been processed and can be sent out by the NIC.

[0106] Assuming that the network packet sending and receiving speed is perfectly uniform under ideal conditions, there are two possible states:

[0107] A. If the equipment performance is sufficient, the number of packets to be processed in the queue (WR) will always be 0;

[0108] B. If the device performance is insufficient, the number of packets to be processed in the queue (WR) will continue to increase, and the growth rate will be measurable;

[0109] In other words, the value of (WR) can be used to determine whether the kernel is overloaded. However, in real-world applications, network packet transmission and reception fluctuate, with a large number of packets waiting to be processed at any given moment. As long as this does not exceed the capacity of the circular queue, it is considered normal. When (WR) exceeds the threshold, and the growth rate also exceeds the threshold, the current kernel can be considered overloaded. Furthermore, when the time it takes for a packet to leave the queue differs significantly from the time it enters the queue, it indicates that the detection logic for that packet is complex, resulting in high performance consumption for a single kernel, thus suggesting that the current kernel is also overloaded. However, existing source IP hash algorithms cannot guarantee that new data will be allocated to kernels that are not overloaded.

[0110] The load balancing solution provided in this application ensures that new data is allocated to kernels that are not overloaded. Please refer to [link / reference]. Figure 6 Assuming there are 8 cores, the letter on the core indicates whether the core is currently overloaded, where Y indicates no overload and N indicates overload. It's easy to understand that initially all cores are Y, and if a core becomes overloaded, its letter changes to N. The queue stores the core numbers. Nodes in the overload queue indicate whether the current core is overloaded within a future cycle, such as during one round of queue traversal. Nodes in the scheduling queue indicate whether the current core is not overloaded within a future cycle. The entire scheduling process is as follows:

[0111] After the first connection arrives, the first connection is scheduled to the scheduling queue, and the scheduling cursor is currently pointing to the first kernel. At the same time, it checks whether the kernel scheduled by the previous connection and the kernel that was overloaded first are currently overloaded. If there is no previous connection, it is not necessary to check the overload status of the previous connection. Assuming that the third kernel in the overload queue is no longer overloaded after the check is completed, the third kernel can be inserted to the end of the scheduling queue, and the cursors of both the scheduling queue and the overload queue are moved down one position.

[0112] After the second connection arrives, schedule the second connection into the scheduling queue and schedule the second kernel currently indicated by the scheduling cursor. At the same time, check whether the first and fourth kernels are overloaded, and move the cursors of both the scheduling queue and the overload queue down one position.

[0113] After the third connection arrives, it is scheduled to the fifth kernel currently indicated by the scheduling cursor in the scheduling queue. At the same time, it checks whether the second kernel is overloaded and moves the cursors of both the scheduling queue and the overload queue down one position. It should be noted that since the overload cursor in the overload queue no longer indicates the kernel, the overload queue is no longer checked for overload. At this time, the overload queue can be checked again after the entire scheduling queue has been traversed. Of course, the overload queue can also be checked again directly. This application does not make any specific restrictions here.

[0114] After the fourth connection arrives, schedule the fourth connection to the scheduling queue, which is currently pointed to by the scheduling cursor, for kernel number six. At the same time, check if kernel number five is overloaded, and move the cursors of both the scheduling queue and the overload queue down one position.

[0115] When the fifth connection arrives, it is scheduled to the scheduling queue, which is currently pointing to kernel 7. At the same time, it checks whether kernel 6 is overloaded and moves the cursors of both the scheduling queue and the overload queue down one position. If kernel 6 is overloaded at this time, kernel 6 is moved to the overload queue, and the cursor of the overload queue will have a value again.

[0116] When the sixth connection arrives, schedule the sixth connection to the scheduling queue for the kernel 8 currently indicated by the scheduling cursor. At the same time, check whether kernels 7 and 6 are overloaded, and move the cursors of both the scheduling queue and the overload queue down one position.

[0117] When the seventh connection arrives, schedule the seventh connection to the scheduling queue for the kernel 3 currently indicated by the scheduling cursor. At the same time, check if the kernel 8 is overloaded and move the cursors of both the scheduling queue and the overload queue down one position.

[0118] When the eighth connection arrives, it is scheduled into the scheduling queue, where the current cursor indicates kernel one. Simultaneously, kernels three and four are checked for overload, and both the cursors in the scheduling queue and the overload queue are moved down one position. It should be noted that the scheduling queue has already been traversed once, and the cursor in the overload queue needs to be cleared, starting the check from the first node. Since kernel three has already been moved to the scheduling queue, the first node in the overload queue becomes kernel four.

[0119] Repeat the above process until it ends.

[0120] Please see Figure 7 , Figure 7 This is a schematic diagram of the structure of a load balancing system provided in an embodiment of this application.

[0121] This application provides a load balancing system, comprising:

[0122] Data acquisition module 101 is used to acquire target data to be allocated;

[0123] The computing engine determination module 102 is used to determine the overloaded computing engine and the non-overloaded computing engine in the multi-core device at the current moment.

[0124] The target computing engine determination module 103 is used to select the computing engine that has not been allocated data from the unoverloaded computing engines as the target computing engine at the current moment;

[0125] The allocation module 104 is used to allocate target data to the target calculation engine at the current moment;

[0126] The overloaded computing engine transfer module 105 is used to mark the overloaded computing engines in the non-overloaded computing engines as overloaded computing engines;

[0127] The unloaded computing engine transfer module 106 is used to mark the unloaded computing engines in the overloaded computing engines as unloaded computing engines.

[0128] This application provides a load balancing system, wherein the calculation engine determination module includes:

[0129] The computing engine determination unit is used to determine the overload queue and scheduling queue in the multi-core device at the current time. The overload queue is used to record overloaded computing engines, and the scheduling queue is used to record non-overloaded computing engines.

[0130] This application provides a load balancing system in which the target computing engine determination module may include:

[0131] The target computation engine determination unit is used to select the computation engine pointed to by the current scheduling cursor as the target computation engine in the scheduling queue.

[0132] Also includes:

[0133] The first control unit is used to control the scheduling cursor of the next moment to point to the next computing engine of the target computing engine in the scheduling queue after the target computing engine determination module selects the computing engine that has not been allocated data from the non-overloaded computing engines as the target computing engine at the current moment; wherein, if the target computing engine at the current moment is the last computing engine in the scheduling queue, then the next computing engine of the target computing engine at the current moment is the first computing engine in the scheduling queue.

[0134] This application provides a load balancing system in which an overloaded computing engine transfer module may include:

[0135] The first judgment unit is used to determine whether the target computing engine in the previous moment is overloaded; if the target computing engine in the previous moment is overloaded, the target computing engine in the scheduling queue in the previous moment is transferred to the tail of the overload queue.

[0136] This application provides a load balancing system in which an unloaded computing engine transfer module may include:

[0137] The second judgment unit is used to determine whether the computing engine corresponding to the current overload cursor is not overloaded in the overload queue; if the computing engine corresponding to the current overload cursor is not overloaded, the computing engine corresponding to the current overload cursor in the overload queue is transferred to the tail of the scheduling queue.

[0138] Also includes:

[0139] The second control unit is used to control the overload cursor at the next moment to point to the next computing engine in the overload queue corresponding to the current overload cursor after the overload computing engine transfer module marks the unoverloaded computing engine in the overload computing engine transfer module as an unoverloaded computing engine.

[0140] The load balancing system provided in this application embodiment may further include:

[0141] The third control unit is used to control the scheduling cursor of the second control unit to point to the next computing engine of the target computing engine in the scheduling queue at the current time. If the scheduling cursor of the next time points to the first computing engine in the scheduling queue, then the overload cursor of the next time is controlled to point to the first computing engine in the overload queue.

[0142] This application provides a load balancing system in which the target computing engine determination module may include:

[0143] The third judgment unit is used to determine whether the current scheduling cursor is locked; if the current scheduling cursor is not locked, the current scheduling cursor is locked, and the computing engine pointed to by the current scheduling cursor is used as the target computing engine in the scheduling queue.

[0144] Also includes:

[0145] The first release unit is used to release the lock of the scheduling cursor at the current moment after the non-overloaded computing engine transfer module marks the non-overloaded computing engine in the overloaded computing engine as a non-overloaded computing engine.

[0146] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiments of the present invention, the embodiments of the present invention also provide an electronic device. Figure 8 This is a schematic diagram of the hardware composition structure of the electronic device according to an embodiment of the present invention, such as... Figure 8 As shown, the electronic device includes:

[0147] Communication interface 1 enables information exchange with other devices, such as network devices;

[0148] Processor 2 is connected to communication interface 1 to enable information exchange with other devices and, when running a computer program, executes the load balancing method provided by one or more of the above-mentioned technical solutions. The computer program is stored in memory 3.

[0149] Of course, in practical applications, the various components in an electronic device are coupled together through bus system 4. It can be understood that bus system 4 is used to achieve communication and connection between these components. In addition to the data bus, bus system 4 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 8 The general will label all buses as Bus System 4.

[0150] In this embodiment of the invention, memory 3 is used to store various types of data to support the operation of the electronic device. Examples of such data include any computer program used to operate on the electronic device.

[0151] It is understood that memory 3 can be volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), ferromagnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM); magnetic surface memory can be disk storage or magnetic tape storage. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), SyncLink Dynamic Random Access Memory (SLDRAM), and Direct Rambus Random Access Memory (DRRAM).The memory 2 described in the embodiments of the present invention is intended to include, but is not limited to, these and any other suitable types of memory.

[0152] The methods disclosed in the above embodiments of the present invention can be applied to processor 2, or implemented by processor 2. Processor 2 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 2 or by instructions in the form of software. The processor 2 may be a general-purpose processor, DSP, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Processor 2 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of the present invention can be directly manifested as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium, which is located in memory 3. Processor 2 reads the program in memory 3 and completes the steps of the aforementioned method in combination with its hardware.

[0153] When processor 2 executes the program, it implements the corresponding processes in the various methods of the embodiments of the present invention. For the sake of brevity, these will not be described in detail here.

[0154] In an exemplary embodiment, the present invention also provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, such as a memory 3 that stores a computer program, which can be executed by a processor 2 to complete the steps described in the foregoing method. The computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disc, or CD-ROM.

[0155] In the several embodiments provided in this application, it should be understood that the disclosed apparatus, terminal, and method can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.

[0156] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.

[0157] In addition, in the various embodiments of the present invention, each functional unit can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0158] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, ROM, RAM, magnetic disks, or optical disks.

[0159] Alternatively, if the integrated units of this invention are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this invention, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, RAM, magnetic disks, or optical disks.

[0160] For descriptions of relevant parts of the load balancing system, electronic device, and computer-readable storage medium provided in the embodiments of this application, please refer to the detailed descriptions of the corresponding parts in the load balancing method provided in the embodiments of this application, which will not be repeated here. Furthermore, parts of the technical solutions provided in the embodiments of this application that are consistent with the implementation principles of corresponding technical solutions in the prior art have not been described in detail to avoid excessive elaboration.

[0161] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0162] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A load balancing method, characterized in that, include: Obtain the target data to be allocated, wherein the target data is all data sent through the connection established with the user terminal; Identify the overloaded and non-overloaded computing engines in a multi-core device at the current moment; The computing engine that has not been allocated data is selected from the unloaded computing engines as the target computing engine at the current moment; Assign the target data to the target computing engine at the current moment; The computing engines that are overloaded in the non-overloaded computing engines are marked as the overloaded computing engines; The computing engines that are not overloaded in the overloaded computing engines are marked as the unoverloaded computing engines; The determination of the overloaded and non-overloaded computing engines in the multi-core device at the current moment includes: Determine the overload queue and scheduling queue in the multi-core device at the current moment. The overload queue is used to record the overloaded computing engines, and the scheduling queue is used to record the non-overloaded computing engines. The step of selecting the computing engine that has not been allocated data from the unoverloaded computing engines as the target computing engine at the current moment includes: In the scheduling queue, the computing engine pointed to by the scheduling cursor at the current moment is taken as the target computing engine at the current moment; After selecting the computing engine without allocated data from the unoverloaded computing engines as the target computing engine for the current moment, the method further includes: The scheduling cursor at the next moment is controlled to point to the next computing engine in the scheduling queue that is the target computing engine at the current moment; Wherein, if the target computing engine at the current moment is the last computing engine in the scheduling queue, then the next computing engine after the target computing engine at the current moment is the first computing engine in the scheduling queue.

2. The method according to claim 1, characterized in that, The step of marking the overloaded computing engines among the non-overloaded computing engines as the overloaded computing engines includes: Determine whether the target computing engine was overloaded in the previous moment; If the target computing engine in the previous time step is overloaded, then the target computing engine in the scheduling queue in the previous time step is transferred to the tail of the overload queue.

3. The method according to claim 1 or 2, characterized in that, The step of marking the non-overloaded computing engines in the overloaded computing engines as the non-overloaded computing engines includes: In the overload queue, determine whether the computing engine corresponding to the overload cursor at the current moment is not overloaded; If the computing engine corresponding to the overload cursor at the current moment is not overloaded, then the computing engine corresponding to the overload cursor at the current moment in the overload queue is transferred to the tail of the scheduling queue. After marking the unoverloaded computing engines in the overloaded computing engines as the unoverloaded computing engines, the method further includes: The overload cursor at the next moment is controlled to point to the next computing engine in the overload queue corresponding to the overload cursor at the current moment.

4. The method according to claim 3, characterized in that, After the scheduling cursor at the next moment is directed to the next computing engine in the scheduling queue for the target computing engine at the current moment, the method further includes: If the scheduling cursor in the next moment points to the first computing engine in the scheduling queue, then the overload cursor in the next moment is controlled to point to the first computing engine in the overload queue.

5. The method according to claim 4, characterized in that, The step of using the computing engine pointed to by the current scheduling cursor as the target computing engine in the scheduling queue includes: Determine whether the current scheduling cursor is locked; If the current scheduling cursor is unlocked, then the current scheduling cursor is locked, and the computing engine pointed to by the current scheduling cursor is set as the target computing engine in the scheduling queue. After marking the unoverloaded computing engines in the overloaded computing engines as the unoverloaded computing engines, the method further includes: Release the lock on the current scheduling cursor.

6. A load balancing system, characterized in that, include: The data acquisition module is used to acquire target data to be allocated, wherein the target data is all data sent through the connection established with the user terminal; The computing engine determination module is used to determine the overloaded and non-overloaded computing engines in a multi-core device at the current moment. The target computing engine determination module is used to select the computing engine that has not been allocated data from the unoverloaded computing engines as the target computing engine at the current moment. The allocation module is used to allocate the target data to the target computing engine at the current moment; An overloaded computing engine transfer module is used to mark the overloaded computing engine in the non-overloaded computing engines as the overloaded computing engine; An unloaded computing engine transfer module is used to mark the unloaded computing engines in the overloaded computing engines as the unloaded computing engines. The calculation engine determination module includes: The computing engine determination unit is used to determine the overload queue and scheduling queue in the multi-core device at the current time. The overload queue is used to record the overloaded computing engines, and the scheduling queue is used to record the non-overloaded computing engines. The target computing engine determination module includes: The target computing engine determination unit is used to determine the computing engine pointed to by the current scheduling cursor in the scheduling queue as the target computing engine at the current time. Also includes: The first control unit is configured to, after the target computing engine determination unit selects a computing engine without allocated data from the unoverloaded computing engines as the target computing engine at the current moment, control the scheduling cursor at the next moment to point to the next computing engine in the scheduling queue of the target computing engine at the current moment; wherein, if the target computing engine at the current moment is the last computing engine in the scheduling queue, then the next computing engine of the target computing engine at the current moment is the first computing engine in the scheduling queue.

7. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the load balancing method as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the load balancing method as described in any one of claims 1 to 5.