A load balancing migration method based on flow queue management
By adopting a load balancing migration method based on stream queue management in the server multi-core system, the problems of low migration efficiency and high computing resource consumption caused by load imbalance are solved, and efficient load balancing and system stability are achieved.
Patent Information
- Application Number
- CN202510100920.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2045-01-22
AI Technical Summary
The prior art is difficult to effectively solve the problem of load imbalance in server multi-core systems, resulting in low migration efficiency and high computing resource consumption.
The load balancing migration method based on flow queue management is adopted. By obtaining data flow queues between different processing cores, processing and maintaining data packet continuity, load balancing decision strategies are generated, and migrating data information is collected in real time to dynamically adjust the strategy.
It improves the efficiency and speed of data migration, reduces latency and resource consumption, improves the accuracy and adaptability of load balancing, and ensures the smooth operation of the system at high loads.
Smart Images

Figure CN119557105B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of data migration in a server multi-core system, and in particular relates to a load balancing migration method based on flow queue management. Background Art
[0002] In recent years, with the development of Network Function Virtualization (NFV), the implementation of network function task processing is not limited to dedicated hardware devices, and complex network functions can also be executed on general-purpose servers. Network function processing usually has requirements such as high throughput and low latency, which poses a challenge to NFV multi-core systems. The current response to the problem of inefficient load balancing mainly focuses on reducing the impact of uneven load and using customized hardware, such as gradually expanding the number of processing cores and using heterogeneous hardware to expand system bottlenecks, but does not fundamentally solve the scheduling problem of uneven load. In this context, traditional hardware-based static diversion strategies have become increasingly unable to meet the requirements of virtualized high-performance network systems, and software-based distributed dynamic load balancing strategies are gradually being used to cope with dynamically changing network traffic and processing loads.
[0003] The premise for the effectiveness of a series of static traffic diversion strategies and hardware offloading solutions is the input traffic distribution with high entropy value, but it is difficult to guarantee in the real traffic environment, and the actual load balancing and linear scalability may be limited. High entropy input traffic means that the distribution and arrival of data packets should be random. However, in the actual network environment, the input traffic is not completely random, but has certain rules. At the same time, due to user activities, data transmission requirements and specific burst traffic, the actual network traffic is dynamically changing, with peaks and troughs. When certain features in the network traffic are polarized, even if the hash algorithm is used, it may not be possible to achieve ideal load balancing. For example, in a specific time, most of the traffic comes from a few source addresses. Even if the hash algorithm is uniform, the actual load will be concentrated on a few cores. When there is a performance bottleneck in the system, the solution of adding more processing units for expansion is often adopted. However, when relying on high entropy input traffic for load balancing, due to problems such as uneven traffic distribution and hash polarization, even if more processing units are added, some cores may still become bottlenecks, and the system performance is also disproportionate, that is, the linear expansion of the overall system performance is not achieved. Based on the above reasons, static hardware traffic diversion rules are difficult to adapt to dynamically changing traffic, but software dynamic load balancing strategies are becoming more and more popular in modern high-performance network systems due to their flexibility and intelligence.
[0004] Software-based distribution strategies provide greater flexibility and intelligence, can monitor system load in real time, and more easily adjust diversion rules dynamically according to current network conditions, directly solving the problem of resource waste caused by uneven load, thereby achieving linear expansion of multi-core systems. At the same time, software distribution strategies are usually closely integrated with the operating system and have better scalability, so they are easier to integrate into the new generation of smart network cards and add more complex logic.
[0005] However, there are many challenges and requirements in implementing dynamic load balancing strategies for multi-core systems in servers based on software. Dynamic load balancing has high real-time requirements, needs to process a large amount of information in a short time and make reasonable load balancing decisions, and consumes a lot of computing resources. Summary of the invention
[0006] The purpose of the present invention is to overcome the above-mentioned shortcomings of low migration efficiency and huge amount of data required for load balancing decision calculation, and to provide a load balancing migration method based on flow queue management.
[0007] In order to achieve the above object, the present invention adopts the following technical solution:
[0008] The present invention provides a load balancing migration method based on flow queue management, comprising the following steps:
[0009] Obtain data flow queues between different processing cores, process the data flow queues, and ensure that data packets in the data flow queues maintain continuity;
[0010] Generate corresponding load balancing decision strategies based on the processed data stream queue;
[0011] Migrate data stream queues between different processing cores based on the load balancing decision strategy, and collect migration data information in real time;
[0012] The load balancing decision strategy is dynamically adjusted based on the migration data information collected in real time.
[0013] A further improvement of the present invention is that the specific method of obtaining the data flow queues between different processing cores and processing the data flow queues so that the data packets in the data flow queues maintain continuity is as follows:
[0014] Initialize the global flow state table and data flow queues on the processing core;
[0015] Preset hash distribution granularity, and divide different data stream queues into different processing cores according to the hash distribution granularity;
[0016] The processing core enters and dequeues data packets for the received data flow queue according to the global flow state table, so that the data packets in the data flow queue maintain continuity.
[0017] A further improvement of the present invention is that the specific method of enqueuing a data packet is as follows:
[0018] Parse the received data stream queue to obtain the stream ID in the data packet in the data stream queue;
[0019] According to the flow ID and the global flow state table, determine the global flow queue to which the data flow queue belongs;
[0020] According to the global flow queue, write the data flow queue into the corresponding block queue to complete the data packet enqueuing.
[0021] A further improvement of the present invention is that the specific method of dequeuing a data packet is as follows:
[0022] Get the data packets in the block queue and sort the data packets by priority and flow rate;
[0023] Summarize the priorities and flow rates of all data packets in the data flow queue and sort them to obtain the priority and flow rate of the data flow queue;
[0024] According to the priority and flow rate of the data flow queue, the data flow queue is sent out to complete the dequeuing of the data packet.
[0025] A further improvement of the present invention is that, according to the processed data stream queue, a specific method for generating a corresponding load balancing decision strategy is as follows:
[0026] Obtaining the processed data stream queues between different processing cores. If a processing core fails to obtain the data stream queue within a preset time, the processing core is used as a stealing core.
[0027] The stealing core obtains the data flow queue status of the adjacent processing core, and determines whether the adjacent processing core needs to migrate the data flow queue according to the data flow queue status of the adjacent processing core;
[0028] If the data flow queue needs to be migrated, a load balancing decision strategy for migrating the data flow queue from an adjacent processing core is generated; otherwise, the judgment is continued.
[0029] A further improvement of the present invention is that, according to the load balancing decision strategy, the specific method for migrating the data stream queues between different processing cores is as follows:
[0030] The processing core migrates the data stream queues according to the load balancing decision strategy and generates a global migration status;
[0031] Generate a new global flow state table based on the global migration state;
[0032] The original global flow state table is updated according to the new global flow state table.
[0033] A further improvement of the present invention is that after the original global flow state table is updated according to the new global flow state table, the present invention further comprises:
[0034] The processing core marks the migrated data flow queues according to the updated global flow state table, and the processing core skips the marked data flow queues for processing.
[0035] A further improvement of the present invention is that when the processing core migrates the data flow queue according to the load balancing decision strategy, if the data flow queue to be migrated is not completely migrated, the data flow queue is skipped and it is continued to determine whether other data flow queues are to be migrated.
[0036] A further improvement of the present invention is that the processing core includes a producer core, an original consumer core and a new consumer core.
[0037] A further improvement of the present invention is that, according to the migration data information collected in real time, a specific method for dynamically adjusting the load balancing decision strategy is as follows:
[0038] Obtain the global flow status table based on the migration data information collected in real time;
[0039] Re-determine whether the processing core is a stealing core according to the global traffic status table;
[0040] Adjust the load balancing decision strategy based on the judgment results.
[0041] Compared with the prior art, the present invention has the following beneficial effects:
[0042] The present invention ensures the continuity of data packets by processing the data stream queue, and avoids the low migration efficiency caused by the disorder or loss of data packets. The delay in data transmission is effectively reduced, and the speed and efficiency of migration are improved. The present invention can dynamically adjust the load balancing decision strategy by collecting migration data in real time and processing it according to the data stream queue, ensuring that the load balancing strategy always conforms to the current system state and avoiding the bottleneck caused by uneven load. By dynamically adjusting the strategy, the system can quickly respond according to the actual load change, and improve the accuracy and adaptability of load balancing. The present invention avoids the complex decision-making process that requires a lot of calculations in the traditional method by adopting the management mechanism of the data stream queue. Through the refined management of real-time feedback information and data stream queues, the decision-making process can be simplified and the complexity of load balancing calculation is reduced. The stream queue management of the present invention can ensure the integrity and order of the data packet, thereby reducing the impact caused by data loss or retransmission during the migration process, and improving the reliability and stability of the system. In practical applications, the present invention can be dynamically adjusted according to the real-time migration data information and load conditions, adapt to the load changes between different processing cores, keep the system running smoothly under high load, and avoid overload or resource waste. In summary, the present invention can not only improve the overall migration efficiency of the system, but also effectively reduce the computational complexity of load balancing decisions, while ensuring the stability and reliability of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 is a flow chart of the present invention;
[0044] Figure 2 Schematic diagram of the scenario flow for data stream queue migration. DETAILED DESCRIPTION
[0045] In order to further understand the content of the present invention, the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the embodiments are only for explaining the present invention and are not intended to limit it.
[0046] See also Figure 1 , a load balancing migration method based on flow queue management, comprising the following steps:
[0047] S1, obtains the data flow queues between different processing cores, processes the data flow queues, and ensures the continuity of data packets in the data flow queues.
[0048] S2, the processing core generates the corresponding load balancing decision strategy based on the processed data flow queue.
[0049] S3, according to the load balancing decision strategy, migrates the data flow queues between different processing cores and collects the migration data information in real time.
[0050] S4, dynamically adjust the load balancing decision strategy based on the migration data information collected in real time.
[0051] The present invention can effectively avoid the inefficient migration process in the traditional method by acquiring and processing the data flow queues between different processing cores. The continuity of the data packets is guaranteed, making the migration process more efficient, thereby reducing the time and resource consumption required for migration. By collecting migration data information in real time and dynamically adjusting the load balancing decision strategy based on this data, it can flexibly respond to load fluctuations and changes, avoiding the limitations of static load balancing strategies.
[0052] Embodiment 1:
[0053] S1, obtaining the data flow queues between different processing cores, processing the data flow queues, and ensuring the continuity of the data packets in the data flow queues. The specific method is as follows:
[0054] S11, initialize the global flow state table and data flow queue on the processing core.
[0055] S12, preset hash distribution granularity, and divide different data stream queues into different processing cores according to the hash distribution granularity.
[0056] S13, the processing core enters and dequeues data packets for the received data flow queue according to the global flow state table to ensure the continuity of the data packets in the data flow queue.
[0057] This embodiment uses the load balancing adjustment of different processing cores in the global flow state table, and uses the customized hash diversion granularity as the division of the global data flow queue. Since the load balancing adjustment of the processing cores is required, there is a need for data packet transmission between processing cores. For a single data flow queue, it is necessary to ensure the continuity of the data packets in the data flow queue to avoid the overhead caused by the reordering of data packets during the load balancing adjustment process. This embodiment uses the method of data packet enqueuing and data packet dequeuing to ensure the continuity of data packets in the data flow queue. The specific method of data packet enqueuing is as follows:
[0058] In order to ensure the continuity of the data packets in the received data flow queue, the processing core determines whether the received data flow queue is in the block queue; if the data flow queue is not in the block queue, it is parsed to obtain the flow ID in the data packet of the data flow queue; according to the flow ID and the global flow status table, the global flow queue to which the data flow queue belongs is determined; according to the global flow queue, the data flow queue is written into the corresponding block queue to complete the data packet enqueuing.
[0059] Packet dequeuing alleviates the problem of data header blocking caused by the simultaneous queuing of packets of different priorities and flow rates. Since the packet enqueuing operation of the block queue involves the number of flows of different data flow queues, the specific method of packet dequeuing is as follows:
[0060] Get the data packets in the block queue and sort the priority and flow rate of the data packets; summarize the priority and flow rate of all data packets in the data flow queue and sort them to obtain the priority and flow rate of the data flow queue; send the data flow queue out according to the priority and flow rate of the data flow queue to complete the data packet dequeue.
[0061] The processing core for enqueuing packets is always fixed. It is only necessary to ensure that the enqueuing and dequeuing of packets are synchronized, so that the enqueuing and dequeuing of packets do not interfere with each other. The maximum total number of entries in the block queue is the maximum number of possible data flow queues, which is determined by the sum of the number of all flows bound to the packet enqueuing core. For example, the total number of processing cores is N, the number of data flow queues bound to each processing core is M, and the number of divided flows in each data flow queue is K. Then the maximum possible number of queues in the block queue managed by each processing core is M×K. The number of global flow queues is N×M×K. The sum of all block entries maintained by a processing core and the sum of all block metadata are N×(M×K). N is the block queue from the producer core to all other destination cores, which includes the queue from itself to itself, which is convenient for unified management and maintenance during migration.
[0062] Embodiment 2:
[0063] The processing cores include the producer core, the original consumer core, and the new consumer core.
[0064] S2, the specific method for the processing core to generate the corresponding load balancing decision strategy based on the processed flow queue is as follows:
[0065] S21, if the processing core fails to obtain the data stream queue within a preset time, the processing core is used as a stealing core;
[0066] S22, the stealing core obtains the data flow queue status of the adjacent processing core, and determines whether the adjacent processing core needs to migrate the data flow queue according to the data flow queue status of the adjacent processing core, that is, the packet fetching operation;
[0067] S23, if it is necessary to migrate the data flow queue (packet fetching operation), a load balancing decision strategy for migrating the data flow queue from the adjacent processing core is generated; otherwise, the judgment is continued.
[0068] The stealing core in this embodiment determines the load execution status based on the congestion status of the block queue, allowing distributed migration decisions. For a block queue managed by a single producer core to another consumer core, only one consumer core can perform a packet fetching operation at the same time. After the processing core performs the packet fetching operation, the data stream queue that has fetched the packet is locked to indicate that stealing is prohibited.
[0069] After completing the migration of the data flow queue, the corresponding data flow queue is unlocked in the packet sending stage, indicating that the processing is completed and supports stealing. The stealing core can select the stealing target from other unlocked data flow queues in the queue without interrupting the processing of the stolen core.
[0070] After the stealing core has obtained no executable data packets after the packet fetching operation, it determines whether the data flow queues of other cores can be stolen and processed, and gives priority to increasing the execution load of this processing core. The stolen data flow queue gives priority to any data flow queue that is diverted from this processing core to other processing cores, thereby reducing the transmission overhead between processing cores as much as possible while balancing the load. Since the stealing load balancing decision strategy time and the time to complete the migration can reach the microsecond level, randomly selecting other queues with data packets queued can achieve a better load balancing effect.
[0071] Embodiment 3:
[0072] S3, according to the load balancing decision strategy, the specific method of migrating data between different processing cores is as follows:
[0073] S31, the processing core migrates the data stream queue according to the load balancing decision strategy and generates a global migration state.
[0074] S32: Generate a new global flow state table according to the global migration state.
[0075] S33: Update the original global flow state table according to the new global flow state table.
[0076] The main purpose of this embodiment is to accelerate migration synchronization. The asynchronous stealing process can accelerate migration decisions. At the same time, the producer, original consumer, and new consumer ensure the continuity of data packets according to the processing stages of data packet dequeueing and data packet enqueuing, so that different data flow queues can be scheduled between different processing cores without interfering with each other.
[0077] When migrating from a producer core to another core, only the producer core itself needs to perform migration synchronization. After issuing the migration load balancing decision policy, only the migration status of the global flow state table is changed, and no processing core needs to be interrupted. When the producer core receives the migrated data flow queue data packet, it queries the data flow queue migration status, sets the destination of the data flow queue to the queue of the new consumer core, and changes the global flow state table after migration, and the migration is completed. When the producer core polls its own queue, it also acts as a consumer core. If it finds an old data flow queue left over from the migration, it queries the global flow state table and determines that the belonging core is inconsistent with the processing core, so that the data flow queue is invalidated and then skipped.
[0078] When migrating from the original consumer core to the new consumer core, after receiving the data packet of the migrated data stream queue, the producer core sets the destination of the migrated data stream queue to the data stream queue of the new consumer core. Since there may be other data stream queues in the current data stream queue, the original consumer core will poll the producer core to the data stream queue of the original consumer core. When reading the migrated data stream queue, the old data stream queue will be invalidated. The new consumer core makes judgments during the normal packet retrieval process, but the original consumer core may still have unprocessed data packets. If the status of the data stream queue is locked, it will be temporarily skipped and the migration will not be completed; if the status of the data stream queue is not locked, the global migration status will be changed to complete the migration.
[0079] When migrating from the consumer core to the producer core, after the consumer core polls and reads the data stream queue, if it finds that the data stream queue has been migrated, it will give up reading the data stream queue data packet and invalidate the data stream queue. After the producer core receives the migrated data stream queue data packet, it puts the new data stream queue into its own management queue. When reading its own data stream queue, if it is found that it is in the migration state and the state is not locked, that is, the original consumer core has completed the execution of the data packet being processed, then the global flow state table is changed to complete the migration. If it is still processing the locked state, skip this data stream queue and re-judge the migration after the next poll.
[0080] There may be competition between the stealing of different processing cores, which is solved by state locking. The flow migration state is set in the global flow state table of each flow. Only one direction of flow migration is allowed at the same time. When the stealing core selects the migration queue, if it determines that this flow is in the migration state, it will skip this flow and continue to determine whether other flows support migration.
[0081] Embodiment 4:
[0082] S4, based on the migration data information collected in real time, the specific method for dynamically adjusting the load balancing decision strategy is as follows:
[0083] S41, obtaining a global flow state table according to migration data information collected in real time.
[0084] S42, re-determining whether the processing core is a stealing core according to the global traffic status table.
[0085] S43: Adjust the load balancing decision strategy according to the judgment result.
[0086] In this embodiment, the migration of the data flow queue and the change of the migration state are completed at different times. After the stealing core selects the migration target, it changes the global flow state table to prevent other processing cores from fetching packets again. At this time, multiple data packets can be fetched in batches for processing. After the producer core obtains the data packet next time, it adds the new data flow queue to the new consumer core and changes the state of the global flow state table to complete the migration.
[0087] Embodiment 5:
[0088] See also Figure 2 The migration process involves the producer core, the original consumer core, and the new consumer core. During the migration synchronization, the three cores do not need to be locked and do not affect each other. For the producer core, the data packet is diverted to the corresponding global flow queue according to the global flow state table. The original consumer core determines whether each flow entry in the data flow queue can read the data packet based on the information in the global flow state table. The new consumer core reads the flow entry from the data flow queue to which it is bound. If there is a migrated data flow queue, the global flow state table is updated to complete the migration.
[0089] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A load balancing migration method based on flow queue management, characterized in that: The following steps are involved: Get the data flow queues between different processing cores and process the data flow queues to keep the data packets in the data flow queues continuous. The specific method is as follows: Initialize the global flow state table and data flow queues on the processing core; Preset hash distribution granularity, and divide different data stream queues into different processing cores according to the hash distribution granularity; According to the global flow state table, data packets are enqueued and dequeued for the received data flow queue, so that the data packets in the data flow queue are kept continuous; The specific method of enqueuing data packets is as follows: Parse the received data stream queue to obtain the stream ID in the data packet in the data stream queue; According to the flow ID and the global flow state table, determine the global flow queue to which the data flow queue belongs; According to the global flow queue, write the data flow queue into the corresponding block queue to complete the data packet enqueuing; The specific method of dequeuing data packets is as follows: Get the data packets in the block queue and sort the data packets by priority and flow rate; Summarize the priorities and flow rates of all data packets in the data flow queue and sort them to obtain the priority and flow rate of the data flow queue; According to the priority and flow rate of the data flow queue, the data flow queue is sent out to complete the dequeuing of data packets; Generate the corresponding load balancing decision strategy based on the processed data stream queue. The specific method is as follows: Obtaining the processed data stream queues between different processing cores. If a processing core fails to obtain the data stream queue within a preset time, the processing core is used as a stealing core. The stealing core obtains the data flow queue status of the adjacent processing core, and determines whether the adjacent processing core needs to migrate the data flow queue according to the data flow queue status of the adjacent processing core; If the data flow queue needs to be migrated, a load balancing decision strategy for migrating the data flow queue from an adjacent processing core is generated; On the contrary, it continues to judge; Migrate data stream queues between different processing cores based on the load balancing decision strategy, and collect migration data information in real time; According to the migration data information collected in real time, the load balancing decision strategy is dynamically adjusted. The specific method is as follows: Obtain the global flow status table based on the migration data information collected in real time; Re-determine whether the processing core is a stealing core according to the global traffic status table; Adjust the load balancing decision strategy based on the judgment results.
2. A load balancing migration method based on flow queue management according to claim 1, characterized in that: According to the load balancing decision strategy, the specific method of migrating data stream queues between different processing cores is as follows: The processing core migrates the data stream queues according to the load balancing decision strategy and generates a global migration status; Generate a new global flow state table based on the global migration state; The original global flow state table is updated according to the new global flow state table.
3. A load balancing migration method based on flow queue management according to claim 2, characterized in that: After the original global flow state table is updated according to the new global flow state table, the following steps are also included: The processing core marks the migrated data flow queues according to the updated global flow state table, and the processing core skips the marked data flow queues for processing.
4. The load balancing migration method based on flow queue management according to claim 2, characterized in that: When the processing core migrates the data flow queue according to the load balancing decision strategy, if the data flow queue to be migrated is not completely migrated, the data flow queue is skipped and it is continued to determine whether other data flow queues are to be migrated.
5. The load balancing migration method based on flow queue management according to claim 1, characterized in that: The processing cores include the producer core, the original consumer core, and the new consumer core.
Citation Information
Patent Citations
Method for realizing interrupted load balance among multi-core processors
CN102521047A
Single-network-card multi-GPU (Graphics Processing Unit) data transmission method and system based on GPU Drive RDMA (Remote Direct Memory Access) technology
CN117971766A