Load balancing method, communication equipment and product

During the packet distribution process, by judging its processing capability based on the number of received queue packets of the processing core, and determining it as the target processing core when specific conditions are met, the packet processing delay problem caused by the differences in CPU core processing capabilities is solved, and more efficient load balancing and stability are achieved.

CN119766735APending Publication Date: 2025-04-04ZTE CORP
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411988647.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

During the packet distribution process, the processing capabilities differences of each CPU core are not considered, which leads to some CPU cores failing to process packets in time, resulting in overall packet loss or increased delay.

Method used

By judging the number of data packets in the receiving queue corresponding to each processing core, it determines its data processing load, and when its data processing load meets a certain condition, it is determined as the target processing core and distributes the pending data packets to it.

Benefits of technology

It improves the timeliness and stability of data packet processing, reduces unnecessary data processing load judgment and calculation, optimizes load balancing, and reduces the time delay and data loss risk under system operation pressure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119766735A_ABST
    Figure CN119766735A_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a load balancing method, communication equipment and product, the load balancing method is applied to a network forwarding device, the network forwarding device includes multiple processing cores, each processing core corresponds to a receiving queue; the method includes: determining the data processing load of each processing core, the data processing load is determined according to the number of data packets in the corresponding receiving queue; determining a target processing core among the multiple processing cores; distributing the data packets to be processed to the receiving queue corresponding to the target processing core; wherein determining the target processing core among the multiple processing cores includes: determining a pre-distributed processing core among the multiple processing cores; when the data processing load corresponding to the pre-distributed processing core meets the first condition, determining the pre-distributed processing core as the target processing core. The embodiment of the present application aims to improve the timeliness and stability of data packet processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of communication technology, and in particular to a load balancing method, communication equipment and product. Background Art

[0002] The Data Plane Development Kit (DPDK) is mainly based on the Linux system. It is a collection of function libraries and drivers for fast data packet processing, which can greatly improve data processing performance and throughput. Due to the improved data processing performance and throughput, complex computing tasks can be completed through fast communication and collaboration between nodes, providing data transmission support for improving the computing power of the system.

[0003] In the related art, the pipeline model of DPDK is used to distribute packets to improve data processing capabilities. However, in the distribution process, the difference in processing capabilities of the central processing unit (CPU) core responsible for processing data packets is not taken into account, resulting in one or several CPU cores failing to process data packets in time, resulting in overall packet loss or increased latency. How to improve the timeliness and stability of data packet processing is an issue that needs to be discussed and resolved urgently. Summary of the invention

[0004] The embodiments of the present application provide a load balancing method, communication equipment and product, aiming to improve the timeliness and stability of data packet processing.

[0005] In a first aspect, an embodiment of the present application provides a load balancing method, which is applied to a network forwarding device, wherein the network forwarding device includes a plurality of processing cores, and each of the processing cores corresponds to a receiving queue;

[0006] The method includes: determining the data processing load of each processing core, wherein the data processing load is determined according to the number of data packets in the corresponding receiving queue; determining a target processing core among the multiple processing cores; and distributing the data packets to be processed to the receiving queue corresponding to the target processing core; wherein determining the target processing core among the multiple processing cores includes: determining a pre-distributed processing core among the multiple processing cores; and determining the pre-distributed processing core as the target processing core when the data processing load corresponding to the pre-distributed processing core satisfies a first condition.

[0007] In a second aspect, an embodiment of the present application provides a communication device, comprising: at least one processor; at least one memory for storing at least one program; when at least one of the programs is executed by at least one of the processors, the load balancing method as described in the first aspect is implemented.

[0008] In a third aspect, an embodiment of the present application provides a computer program product, comprising a computer program or computer instructions, characterized in that the computer program or the computer instructions are stored in a computer-readable storage medium, a processor of a computer device reads the computer program or the computer instructions from the computer-readable storage medium, and the processor executes the computer program or the computer instructions, so that the computer device performs the load balancing method described in the first aspect.

[0009] In the embodiment of the present application, when distributing the data packets to be processed inside the network forwarding device, the data processing load of each processing core is judged by the number of data packets in the receiving queue corresponding to each processing core, so that the actual data packet processing capacity of each processing core can be more accurately judged. By judging the data processing load of the pre-distributed processing core, when its data processing load meets the first condition, it is directly determined as the target processing core and the data packets to be processed are distributed to it. There is no need to judge the target processing core according to the data processing load of each processing core every time the data packets to be processed are distributed, so that unnecessary judgment and calculation of data processing load can be reduced, and the distribution efficiency of the data packets to be processed can be improved while taking into account load balancing, thereby improving the timeliness of the network forwarding device for data packet processing. At the same time, by separately detecting the load conditions of each processing core and making distribution judgments based on this, the accuracy and real-timeness of the processing pressure judgment of the processing core can be improved, so as to determine the distributed processing core more timely and accurately. Then, the time delay phenomenon under the overall operating pressure of the system is alleviated, and the risk of data loss caused by excessive load is further avoided, and the stability of the network forwarding device for data packet processing is improved.

[0010] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 A schematic diagram of a communication network to which a load balancing method provided in an embodiment of the present application is applied;

[0012] Figure 2 A schematic diagram of a load balancing method provided in an example of the present application applied to a switch for data forwarding;

[0013] Figure 3 A flow chart of a load balancing method provided in one embodiment of the present application;

[0014] Figure 4A schematic diagram of data packet distribution inside a switch provided as an example of the present application;

[0015] Figure 5 A schematic diagram of data packet distribution inside a switch provided as another example of the present application;

[0016] Figure 6 A schematic diagram of the structure of a load balancing device provided in one embodiment of the present application;

[0017] Figure 7 A schematic diagram of the structure of a communication device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0018] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0019] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0020] In the description of the embodiments of the present application, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the embodiments of the present application based on the specific content of the technical solution.

[0021] In the embodiments of the present application, the words "further", "exemplarily" or "optionally" are used to indicate examples, illustrations or descriptions, and should not be interpreted as being more preferred or more advantageous than other embodiments or designs. The use of the words "further", "exemplarily" or "optionally" is intended to present related concepts in a specific way.

[0022] The technical solutions of the embodiments of the present application can be applied to various communication systems, such as: Wideband Code Division Multiple Access (WCDMA), Evolved Universal Terrestrial Radio Access Network (E UTRAN), Next Generation Radio Access Network (NG RAN), Long Term Evolution (LTE), Worldwide Interoperability For Microwave Access (WiMAX), 5th Generation (5G), New Radio Access Technology (NR), and future communication systems, such as 6G systems.

[0023] The technical solution of the embodiment of the present application can be applied to various communication technologies, such as microwave communication, optical wave communication, millimeter wave communication, etc. The embodiment of the present application does not limit the specific technology and specific device form used.

[0024] In the related technology, the Data Plane Development Kit (DPDK) is mainly based on the Linux system. The function library and driver set for fast data packet processing can greatly improve data processing performance and throughput, and improve the work efficiency of data plane applications. In the pipeline model of DPDK, a core will poll the receive descriptor ring of one or more ports through the application programming interface (Application Programming Interface, API). The data packet is received and passed to another core through the ring, and then processed on this core, and may be sent to the transmission descriptor ring of the port using the API. In the process of distributing messages using the pipeline model, the input / output (IO) core often polls one or more port receive descriptors through the API, and then distributes the message to the core responsible for processing the message.

[0025] However, in the above data packet distribution process, the difference in processing power of each central processing unit (CPU) core responsible for processing data packets is not taken into account. If one or several cores fail to process data packets in time due to the influx of additional tasks, it may cause one or several CPU cores to fail to process data packets in time, resulting in overall packet loss or increased latency. How to improve the timeliness and stability of data packet processing is an issue that needs to be discussed and resolved urgently.

[0026] To solve the above problems, the embodiments of the present application provide a load balancing method, communication equipment and product. When distributing the data packets to be processed inside the network forwarding device, the data processing load of each processing core is judged by the number of data packets in the receiving queue corresponding to each processing core, so that the actual current data packet processing capacity of each processing core can be judged more accurately. By judging the data processing load of the pre-distributed processing core, when its data processing load meets the first condition, it is directly determined as the target processing core and the data packet to be processed is distributed to it. There is no need to judge the target processing core according to the data processing load of each processing core every time the data packet to be processed is distributed, so that unnecessary judgment and calculation of the data processing load can be reduced, and the distribution efficiency of the data packet to be processed can be improved while taking into account load balancing, thereby improving the timeliness of the network forwarding device for data packet processing. At the same time, by separately detecting the load conditions of each processing core and making distribution judgments based on this, the accuracy and real-time performance of the processing pressure judgment of the processing core can be improved, so as to determine the distributed processing core more timely and accurately. Then, the time delay phenomenon under the overall operating pressure of the system is alleviated, and the risk of data loss caused by excessive load is further avoided, and the stability of the network forwarding device for data packet processing is improved.

[0027] The embodiments of the present application can be applied to various devices responsible for data forwarding or processing, such as switches, routers, etc.

[0028] The embodiments of the present application are further described below in conjunction with the accompanying drawings.

[0029] Figure 1 Schematic diagram of a communication network to which the load balancing method provided in an embodiment of the present application is applied. Figure 1 As shown, the communication network includes but is not limited to a network forwarding device 110 and a terminal 120 .

[0030] The network forwarding device 110 is a dedicated hardware device used to interconnect various servers, PCs, application terminals and other nodes to form an information communication network. When the network forwarding device 110 obtains data packets from the network and needs to be processed or forwarded, it distributes the data packets to be processed internally through the load balancing method of the present application to forward the data packets after processing. For example, the network forwarding device 110 acts as a transit between two servers, obtains data packets from the source server, and forwards them to the target server after processing. Exemplarily, the network forwarding device 110 can be a router, a switch, an indoor baseband processing unit (Building Base band Unit, BBU), a radio frequency remote unit (Remote Radio Unit, RRU), a customer premise equipment (Customer Premise Equipment, CPE), etc. The network forwarding device 110 communicates with the network element, the terminal 120, or other network forwarding devices 110 in a wired or wireless manner to exchange data.

[0031] The terminal 120 is a user terminal device for providing various functions. For example, it includes various device forms such as desktop computers, laptop computers, PDAs (personal digital assistants), mobile phones, vehicle-mounted terminals, home theater terminals, and dedicated terminals. It can also be a single device or a collection of multiple devices. For example, multiple devices are connected through a local area network and work together using a common display device to form a terminal. The terminal 120 can also establish a communication connection with the network forwarding device 110 in a wired or wireless manner to exchange data.

[0032] Figure 2 FIG. 1 is a schematic diagram of a load balancing method provided in an example of the present application applied to a switch for data forwarding. Figure 2 As shown, it is assumed that the switch in this example includes at least a network card, a data receiving core, a data sending core, and processing cores 1 to 4, wherein each processing core corresponds to a pair of receiving queues and sending queues.

[0033] When the switch receives data sent by other network devices through the network port, the data receiving core obtains the data packets to be processed by polling the descriptor ring of the network card.

[0034] A pre-distributed processing core is determined from processing cores 1 to 4, for example, the currently pre-distributed processing core is processing core 1. According to the number of data packets in receiving queue 1 corresponding to processing core 1, the data processing load of processing core 1 is determined.

[0035] When the data processing load of processing core 1 meets the first condition, that is, the data processing load of processing core 1 does not exceed the threshold, processing core 1 is determined as the target core, and the data receiving core sends the data packet to be processed to processing core 1. After processing the data packet to be processed, processing core 1 sends it to its corresponding sending queue 1.

[0036] If the data processing load of processing core 1 does not satisfy the first condition, that is, the data processing load of processing core 1 exceeds the threshold, a new pre-distributed processing core is determined from processing cores 2 to 4. For example, processing core 2 may be selected as the new pre-distributed processing core according to the neighbor priority rule. The data processing load of processing core 2 is determined according to the number of data packets in receiving queue 2 corresponding to processing core 2.

[0037] If the data processing load of processing core 2 does not exceed the threshold, processing core 2 is used as the target processing core, and the data receiving core sends the data packet to be processed to processing core 2. Processing core 2 processes the data packet to be processed and sends it to its corresponding sending queue 2.

[0038] If the data processing load of the processing core 2 exceeds the threshold, the pre-distributed processing cores are continuously selected from the remaining processing cores to perform the above processing until the distribution is completed.

[0039] The data transmission core polls each transmission queue, obtains the processed data packets, and sends the data packets from the network port.

[0040] In the above example, during the process of packet forwarding by the switch, the data processing load of each processing core is judged by the number of packets in the receiving queue corresponding to each processing core, so that the actual current packet processing capacity of each processing core can be judged more accurately. By judging the data processing load of the pre-distributed processing core, if its data processing load meets the first condition, it is directly determined as the target processing core and the data packet to be processed is distributed to it. There is no need to judge the target processing core according to the data processing load of each processing core every time the data packet to be processed is distributed, thereby reducing unnecessary judgment and calculation of the data processing load, improving the distribution efficiency of the data packet to be processed while taking into account load balancing, and thereby improving the timeliness of the switch's data packet processing.

[0041] Through the above example method, it is possible to ensure the maximum load balancing effect of the processing core while optimizing the problem of packet loss or increased delay caused by the processing lag of a specific processing core in a high-load working environment. This can significantly reduce the increase in packet loss and delay caused by the slow response of some cores, and improve the reliability and stability of the network system.

[0042] Figure 3 1 is a flow chart of a load balancing method provided by an embodiment of the present application. The load balancing method can be applied to, but is not limited to, network forwarding devices, such as switches, routers, or Figure 1 The network forwarding device 110 provided, or Figure 2 In this embodiment, the network forwarding device at least includes but is not limited to: a plurality of processing cores, each processing core corresponding to a receiving queue.

[0043] In this embodiment, the load balancing method includes at least but is not limited to:

[0044] Step 310: determine the data processing load of each processing core, where the data processing load is determined according to the number of data packets in the corresponding receiving queue;

[0045] Step 320, determining a target processing core among the plurality of processing cores;

[0046] Step 330: Distribute the data packets to be processed to the receiving queue corresponding to the target processing core;

[0047] Wherein, step 320 includes:

[0048] Step 321: determining a pre-distributed processing core among multiple processing cores;

[0049] Step 322: When the data processing load corresponding to the pre-distributed processing core meets the first condition, the pre-distributed processing core is determined as the target processing core.

[0050] In step 310, the processing core refers to one or more central processing units (CPUs) in the network forwarding device responsible for data processing.

[0051] The data processing load is used to indicate the processing core's ability to process data. The greater the data processing load, the weaker the processing core's ability to process data. The weak data processing capability of the processing core may be due to the current large amount of data, which causes the processing core to fail to process in a timely manner; or it may be due to the performance of the processing core itself. The smaller the data processing load, the stronger the processing core's ability to process data and the more capable it is to process data packets in a timely manner.

[0052] The receive queue refers to a continuous storage space used to store packets distributed to the corresponding processing core. When it is determined that the packets to be processed are distributed to the relevant processing core, the packets to be processed are temporarily stored in the receive queue corresponding to the processing core, and the processing core then polls the receive queue to take out the packets for processing. The number of packets in the receive queue is the number of packets to be processed that the processing core corresponding to the receive queue needs to process.

[0053] In step 320, the target processing core refers to a processing core selected from various processing cores by the load balancing method of the present application for receiving and processing the data packet to be processed.

[0054] In step 321, the pre-distributed processing core refers to a processing core that is preliminarily selected from the processing cores through a preset algorithm and is to be used to distribute the data packet to be processed.

[0055] Exemplarily, the pre-distributed processing cores may be determined in order from the various processing cores by means of round-robin scheduling. Alternatively, the pre-distributed processing cores may be determined by means of weighted round-robin scheduling, for example, weights are assigned to the various processing cores according to their performance, and the higher the performance of the processing core, the greater the weight; based on the assigned weights, the pre-distributed processing cores are determined in order, wherein the processing core with a higher weight is determined as the pre-distributed processing core more often.

[0056] In step 322, the first condition is used to characterize whether the data processing load corresponding to the processing core meets the requirements. If the data processing load corresponding to the processing core meets the first condition, it means that the data processing load corresponding to the processing core has not reached the upper limit and still has the ability to process data packets normally; if the data processing load corresponding to the processing core does not meet the first condition, it means that the data processing load corresponding to the processing core has reached the upper limit, and continuing to distribute data packets to it may cause packet loss and increased delay. Exemplarily, the first condition can be set to that the data processing load does not exceed a preset load threshold.

[0057] In step 330, after the target processing core is determined, the data packets to be processed are distributed to the receiving queue corresponding to the target processing core, and then the target processing core takes the data packets to be processed from the receiving queue for processing, so as to play a buffering role when processing a large number of data packets.

[0058] With the increasing demand for network bandwidth, the broadband capacity of the network is getting larger and larger. The higher the bandwidth, the larger the amount of data that the network forwarding device needs to process and forward. In the face of the increase in data volume brought by high bandwidth, the network forwarding device also has higher requirements for the timeliness and stability of data processing and forwarding. In the above-mentioned embodiments of steps 310 to 330, when distributing the data packets to be processed inside the network forwarding device, the data processing load of each processing core is judged by the number of data packets in the receiving queue corresponding to each processing core, and the current actual data packet processing capacity of each processing core can be more accurately judged. By judging the data processing load of the pre-distributed processing core, if its data processing load meets the first condition, it is directly determined as the target processing core and the data packet to be processed is distributed to it. There is no need to judge the target processing core according to the data processing load of each processing core every time the data packet to be processed is distributed, so that unnecessary judgment and calculation of data processing load can be reduced, and the distribution efficiency of the data packets to be processed is improved while taking into account load balancing, thereby improving the timeliness of data packet processing by the network forwarding device. At the same time, by separately detecting the load of each processing core and making distribution judgments based on this, the accuracy and real-time nature of the judgment of the processing pressure of the processing core can be improved, so as to determine the distributed processing core more timely and accurately. This can alleviate the time delay phenomenon under the overall operating pressure of the system, further avoid the risk of data loss caused by excessive load, and improve the stability of network forwarding equipment in processing data packets.

[0059] The above is a general description of step 310 to step 330 . The specific implementation process of step 310 to step 330 will be described in detail below.

[0060] In one embodiment, each processing core also corresponds to a sending queue, and the data processing load includes the ratio of data packets sent and received. Step 310 includes:

[0061] For each processing core, determining a data packet receiving and sending ratio of the processing core according to the number of first data packets in a receiving queue corresponding to the processing core and the number of second data packets in a sending queue corresponding to the processing core;

[0062] The data processing load of each processing core is determined according to the ratio of data packets received and sent by each processing core.

[0063] In this embodiment, the sending queue refers to a continuous storage space for storing data packets processed by the corresponding processing core. Figure 2Taking the switch provided as an example, after the processing core takes out the data packet from its corresponding receiving queue and completes the processing, the processing core temporarily stores the processed data packet in the sending queue corresponding to the processing core. The data sending core then obtains the processed data packet from the sending queue of the processing core and sends it out through the network port.

[0064] The second number of data packets refers to the number of data packets that have been processed but not yet sent by the processing core corresponding to the sending queue.

[0065] The first number of data packets refers to the number of pending data packets that need to be processed by the processing core corresponding to the receiving queue.

[0066] The packet receiving and sending ratio refers to the ratio of the number of pending packets received by the receiving queue of the processing core to the number of processed packets received by the sending queue of the processing core. When the number of pending packets in the receiving queue increases, but the number of processed packets in the corresponding sending queue does not increase accordingly, the packet receiving and sending ratio will increase, which also means that the data processing pressure of the processing core will increase.

[0067] In the related art, the data processing load is determined based on the overall operating load of the CPU core. However, there may be a situation where the CPU operating load is high but the data packet can still be processed normally, and the processing load of each processing core cannot be accurately determined. The above embodiment, by using the data packet sending and receiving ratio to represent the data processing load, can more accurately measure the data processing load of each processing core.

[0068] If the data processing load of the processing core is judged only by the number of pending data packets in the receiving queue, there may be a situation where there are many data packets in the receiving queue, but the processing performance of the processing core is not a problem and can handle the load in time, but it is still considered to be too heavy. Judging the data processing load of the processing core by the ratio of the number of data packets in the receiving queue and the sending queue of the processing core can better represent the pressure level of the processing core in processing data.

[0069] In one embodiment, within the most recent preset unit time, if the packet receiving and sending ratio of a processing core exceeds the threshold of a preset value (e.g., 1.01:1), the system automatically and appropriately reduces the packet receiving ratio of the receiving queue corresponding to the processing core. When the packet receiving ratio of the receiving queue is lower than the set stop flow threshold, or the number of backlogged packets in the receiving queue exceeds the threshold, it is considered that there is a backlog of packets, and the packet processing pressure of the processing core is too large, and the sending of pending packets to the receiving queue corresponding to the processing core is suspended until the backlog of packets is processed. If the packet receiving ratios of the receiving queues corresponding to all processing cores exceed the threshold, the processing pressure of the processing core is judged according to the packet receiving and sending ratio, and the packets are adjusted to be distributed to the processing core with the lowest processing pressure first.

[0070] In the above embodiment, during the data packet distribution process, the backlog of data packets in the receiving queue corresponding to each processing core is monitored in real time. When it is detected that the receiving queue of a processing core has too many backlogs of data packets to be processed, it can be considered that the processing core has a situation where data packets are not processed in time, and the data packet distribution strategy will be automatically adjusted to distribute more data packets to be processed to other idle processing cores, effectively preventing problems such as data loss or processing delay caused by continuously distributing data packets to be processed to the receiving queue of the processing core with backlogs.

[0071] In one embodiment, step 320 further includes:

[0072] When the data processing load of the pre-distributed processing core does not satisfy the first condition, selecting a new pre-distributed processing core from other processing cores;

[0073] When the data processing load corresponding to the new pre-distributed processing core meets the first condition, the new pre-distributed processing core is determined as the target processing core; alternatively, when the data processing load corresponding to the new pre-distributed processing core does not meet the first condition, a new pre-distributed processing core is selected from other processing cores until the target processing core is determined or all processing cores are traversed.

[0074] The other processing cores refer to each processing core in the network forwarding device except the pre-distributed processing core.

[0075] In this embodiment, a processing core to which the data packets to be processed are to be distributed is first determined, that is, a pre-distributed processing core. When the data packet receiving and sending ratio of the processing core does not exceed the threshold value (no backlog is generated), the data packet is distributed to the processing core. If it exceeds the threshold value, other processing cores whose data packet receiving and sending ratios do not exceed the threshold value are selected for processing. This avoids causing greater pressure on the backlogged processing cores. Compared with the method of directly judging a minimum distribution based on the data processing load of all processing cores, the above embodiment judges whether the data processing load of the processing cores meets the first condition one by one. If it meets the condition, it is directly determined as the target processing terminal. If it does not meet the condition, the next processing core is judged. It can reduce unnecessary judgment and calculation of data processing load, improve distribution efficiency, and make more full use of the processing capacity of each processing core.

[0076] In one embodiment, step 320 further includes:

[0077] When the data processing loads corresponding to each processing core do not meet the first condition, the processing core with the smallest data packet receiving and sending ratio is determined as the target processing core. When the data processing loads of all processing cores do not meet the first condition, the processing core with the smallest data packet receiving and sending ratio can be considered to be the processing core with the smallest current data packet processing pressure, and it is determined as the target processing core, and the data packets to be processed are distributed to the receiving queue corresponding to the target processing core, thereby reducing the risk of packet loss or increased latency.

[0078] In one embodiment, the data processing load includes a data packet backlog state and a data packet sending and receiving ratio. Step 320 includes:

[0079] When the data packet backlog state of each processing core is that there is a backlog, determining the distribution ratio of each processing core according to the data packet receiving and sending ratio of each processing core;

[0080] According to the distribution ratio of all processing cores, a target processing core is determined from among all processing cores.

[0081] In this embodiment, the data packet backlog state is used to indicate whether there are too many unprocessed data packets in the receiving queue of the processing core to form a backlog. Exemplarily, the data packet backlog state of the processing core can be obtained by the following steps: determine the proportion of the number of data packets in the receiving queue of the processing core at the current moment or in the most recent preset unit time in the capacity of the receiving queue; when the proportion exceeds the preset threshold (such as 60%), it is considered that the data packet backlog state of the processing core is a backlog; when the proportion does not exceed the preset threshold, it is considered that the data packet backlog state of the processing core is no backlog. Among them, the preset threshold used to determine whether there is a backlog can be dynamically set according to the overall data traffic situation of the current network environment. For example, if the current network is relatively idle and the overall data traffic is small, the threshold for judging the proportion will be lowered; if the current network is busy and the overall data traffic is large, the threshold for judging the proportion will be appropriately increased.

[0082] The distribution ratio is the ratio of the number of packets to be processed to each processing core before distribution, that is, the distribution weight. Figure 2 For example, if the distribution ratio between processing cores 1-4 is 2:3:4:1, and there are 10 data packets to be processed that need to be distributed, then the receiving queue of processing core 1 will eventually receive 2 data packets to be processed, the receiving queue of processing core 2 will receive 3 data packets to be processed, the receiving queue of processing core 3 will receive 4 data packets to be processed, and the receiving queue of processing core 4 will receive 1 data packet to be processed. After obtaining the distribution ratio of each processing core, illustratively, the distribution ratio can be used as the weight of each processing core, and the target processing core can be determined from each processing core by weighted polling.

[0083] In the above embodiment, when the overall operating pressure of the system is relatively large (the data packet backlog state of each processing core is that there is a backlog), the actual current data processing pressure of each processing core is further determined by the data packet receiving and sending ratio, and the distribution ratio of each processing core is determined based on the data packet receiving and sending ratio, and the data packets to be processed are distributed to each processing core according to the distribution ratio. This can alleviate the time delay problem under the overall operating pressure of the system and further avoid the risk of data loss caused by excessive load.

[0084] In one embodiment, a rough judgment is made on the data processing load of the processing core by the data packet backlog status of the processing core. When there are processing cores with no data packets backlog, a target processing core is determined from the processing cores with no data packets backlog. If the data packet backlog status of the pre-distributed processing core is no backlog, the pre-distributed processing core is directly used as the target processing core; if the data packet backlog status of the pre-distributed processing core is backlogged, the data packet backlog status of other processing cores is determined, and the first processing core with no data packet backlog status determined among the other processing cores is used as the target processing core. Making a rough judgment on the data processing load of the processing core by the data packet backlog status of the processing core can determine whether the processing core can be used as the target processing core more simply but more quickly.

[0085] If the data packet backlog status of all processing cores is backlogged, a more detailed judgment of the data processing load of the processing core is made through the data packet sending and receiving ratio of the processing core. By judging the data processing load of the processing core through the data packet sending and receiving ratio of the processing core, the current overall network data volume is large, resulting in a large number of data packets in the receiving queue, but the actual processing capacity of the processing core can still meet the requirements and has not reached its maximum processing pressure. The situation is taken into consideration, and the load balancing effect between each processing core is further optimized.

[0086] In one embodiment, step 320 includes:

[0087] Determine the priority of the data packets to be processed;

[0088] Determine a target processing core from among the processing cores according to the priority of the data packet to be processed and the data packet receiving and sending ratio corresponding to each processing core;

[0089] The priority level is inversely proportional to the ratio of data packets sent and received.

[0090] It should be noted that this embodiment is applicable to data transmission scenarios of packet processing. In this embodiment, the priority of the data packet to be processed refers to the attribute assigned to the data packet to be processed during network transmission, which is used to determine the transmission order and processing priority of the data packet. Exemplarily, the priority of each data packet to be processed can be determined according to the type of the data packet to be processed, application requirements, network status, etc.

[0091] When the priority of the data packet to be processed is higher, it is assigned to the processing core with a lower data packet sending and receiving ratio. The lower the data packet sending and receiving ratio of the processing core, the smaller the data processing pressure of the processing core, and the more timely and stable the data packet processing can be guaranteed. Therefore, according to the priority of the data packet to be processed, the processing core with the corresponding data packet sending and receiving ratio is selected and distributed, which can not only achieve load balancing according to the current processing pressure of the processing core, but also take the priority requirements of the data packet to be processed as a consideration for determining the target processing core, further improving the effect of load balancing.

[0092] Exemplarily, a matching relationship between the priority of the data packet to be processed and the data packet receiving and sending ratio of the processing core can be constructed by setting an inverse function y=k / x, wherein y can be set to the data packet receiving and sending ratio of the processing core, x can be set to the priority of the data packet to be processed, and k is a preset constant.

[0093] In one embodiment, the network forwarding device further includes a data receiving core. Step 330 includes:

[0094] The data packet queue of the polling port is obtained by the data receiving core to obtain the data packet to be processed;

[0095] The data packet sending and receiving ratios corresponding to each processing core are sent to the data receiving core, so that the data receiving core distributes the data packets to be processed to the receiving queues corresponding to the target processing cores according to the data packet sending and receiving ratios.

[0096] In this embodiment, the data receiving core is a CPU or a core formed by the collaboration of multiple CPUs in the network forwarding device for obtaining data packets from the network card port and sending them to the receiving queue corresponding to the processing core.

[0097] A port refers to a network card port used by a network forwarding device to receive external data. A packet queue refers to the descriptor ring of a network card port, also known as a ring buffer, which is a common data structure for a network card to process packets. It consists of a set of continuous memory areas that are organized into a ring structure for cyclic use. The descriptor ring is used to store the descriptors of the data packets, which contain information such as the address, length, and status of the data packet in the memory.

[0098] In one example, the data receiving core receives the data packet sending and receiving ratios corresponding to each processing core issued by the network forwarding device, and distributes the data packets to be processed to the receiving queue of the corresponding processing core based on the data packet sending and receiving ratios according to the target processing core determined by the network forwarding device.

[0099] In another example, the data receiving core receives the data packet sending and receiving ratios corresponding to each processing core sent by the network forwarding device, determines the target processing core based on the data packet sending and receiving ratios, and sends the data packets to be processed to the receiving queue of the target processing core.

[0100] In one embodiment, the network forwarding device further includes a data sending core which polls the sending queues of each processing core, obtains processed data packets from the sending queues, and sends the processed data packets out of the network forwarding device through the network card port.

[0101] The following two examples are used to describe the load balancing method of the present application in an overall and specific manner. It is to be understood that the following embodiments are all for the purpose of illustrating the load balancing method of the present application in an exemplary manner, and are not intended to be specifically limited.

[0102] Example 1:

[0103] Figure 4 A schematic diagram of data packet distribution inside a switch provided as an example of the present application. Figure 4 As shown, it is assumed that the switch includes at least a network card, a data receiving core, a data sending core, and processing cores 1 to 4, wherein each processing core corresponds to a pair of receiving queues and sending queues. It is assumed that the data processing load of processing core 2 in this example does not meet the first condition, that is, exceeds the threshold.

[0104] When the switch receives data sent by other network devices through the network port, the data receiving core obtains the data packets to be processed by polling the descriptor ring of the network card.

[0105] After the data packet is taken out, first determine which processing core should be responsible for processing the data packet according to a preset algorithm, that is, determine the pre-distributed processing core.

[0106] Taking the distribution in order as an example, after the data packet is taken out, the processing core 1 is determined as the pre-distributed processing core. If the data processing load of the processing core 1 does not exceed the threshold, the data packet is distributed to the receiving queue 1. The processing core 1 takes out the data packet from the receiving queue 1 and processes it to obtain the processed data packet. The processing core 1 sends the processed data packet to the sending queue 1.

[0107] When distributing the next data packet (the second data packet), the processing core 2 is determined as the pre-distributed processing core in order. Since the data processing load of the processing core 2 exceeds the threshold, it is determined that the processing core 2 has problems such as untimely data processing and a backlog of data packets in the receiving queue 2. Therefore, the second data packet is not sent to the receiving queue 2, and a pre-distributed processing core is re-determined from the processing cores 1, 3, and 4. Assume that the processing core 3 is still determined as the pre-distributed processing core in order. If the data processing load of the processing core 3 does not exceed the threshold, the second data packet is distributed to the receiving queue 3. If the data processing load of the processing core 3 exceeds the threshold, a pre-distributed processing core is re-determined from the processing cores 1 and 4 until a processing core whose data processing load does not exceed the threshold is found.

[0108] The data transmission core polls each transmission queue, obtains the processed data packets, and sends the processed data packets from the network port to complete the forwarding.

[0109] In the above example, during the process of packet forwarding by the switch, the data processing load of each processing core is judged by the number of packets in the receiving queue corresponding to each processing core, so that the actual current packet processing capacity of each processing core can be judged more accurately. By judging the data processing load of the pre-distributed processing core, if its data processing load meets the first condition, it is directly determined as the target processing core and the data packet to be processed is distributed to it. There is no need to judge the target processing core according to the data processing load of each processing core every time the data packet to be processed is distributed, thereby reducing unnecessary judgment and calculation of the data processing load, improving the distribution efficiency of the data packet to be processed while taking into account load balancing, and thereby improving the timeliness of the switch's data packet processing.

[0110] Example 2:

[0111] Figure 5 A schematic diagram of data packet distribution inside a switch provided as another example of the present application. Figure 5 As shown, it is also assumed that the switch includes at least a network card, a data receiving core, a data sending core, and processing cores 1 to 4, wherein each processing core corresponds to a pair of receiving queues and sending queues.

[0112] In this example, the data processing load includes the packet backlog state and the packet receiving and sending ratio. Assume that the packet backlog state of processing cores 1 to 4 is all backlogged, and the size relationship of the packet receiving and sending ratio of each processing core is: processing core 1 < processing core 2 < processing core 3 < processing core 4.

[0113] Similarly, after the data receiving core obtains the data packet to be processed from the network, it first determines the pre-distributed processing core from processing cores 1 to 4 according to the preset algorithm, and determines the subsequent operation by judging the data packet backlog status of the pre-processing processing core.

[0114] If the data packet backlog status of the pre-distributed processing core is not backlogged, indicating that its current status is good, the pre-distributed processing core is determined as the target processing core, so that the data packet to be processed is directly distributed to the target processing core and it is regarded as a valid scheduling operation completed.

[0115] If the data packet backlog state of the pre-distributed processing core is backlogged, the pre-distributed processing core is re-determined from other processing cores.

[0116] If an unavoidable blocking situation occurs (i.e., the data packet backlog status of the assumed processing cores 1 to 4 is all backlogged), a more flexible data packet distribution strategy needs to be adopted:

[0117] First, try to start the search process to traverse all other processing cores and locate the first available idle processing core;

[0118] If the ideal target processing core cannot be found after traversing all processing cores (the data packet backlog status is all backlogged), the dynamic ratio optimization method is used to preferentially distribute the data packets according to the distribution ratio. Specifically: according to the data packet sending and receiving ratio of each processing core, the distribution ratio of each processing core is determined; according to the distribution ratio of all processing cores, the data packets to be processed are distributed to the corresponding processing cores.

[0119] If the packet processing pressure of the processing cores reaches the threshold, that is, the packet sending and receiving ratio of each processing core exceeds the threshold, then find the processing core path with the lowest congestion as a temporary solution; Figure 5 In this example, the data packet sending and receiving ratio of processing core 1 is the lowest, so the data packets to be processed are distributed to receiving queue 1.

[0120] This round of dynamic adjustment cycle ends.

[0121] Through the optimization and implementation of the above examples, it can be ensured that each data packet to be processed can be properly handled in the shortest feasible time, thereby alleviating the time delay phenomenon under the overall operating pressure of the system and further avoiding the risk of data loss due to excessive load.

[0122] In the above example, a rough judgment of the data processing load of the processing core by the packet backlog status of the processing core can determine whether the processing core can be used as the target processing core more simply but more quickly. In the case where the packet backlog status of all processing cores is backlogged, a more detailed judgment of the data processing load of the processing core is made by the packet sending and receiving ratio of the processing core. By judging the data processing load of the processing core by the packet sending and receiving ratio of the processing core, it is possible to take into account the situation where the overall data volume of the current overall network is large, resulting in a large number of packets in the receiving queue, but the actual processing capacity of the processing core can still meet the requirements and has not reached its maximum processing pressure, thereby further optimizing the load balancing effect between the processing cores.

[0123] Figure 6 600 is a schematic diagram of a load balancing device provided in an embodiment of the present application. The load balancing device 600 includes multiple processing cores, and the load balancing device 600 includes at least but is not limited to:

[0124] A load determination module 610, for determining a data processing load of each processing core, wherein the data processing load is determined according to the number of data packets in the corresponding receiving queue;

[0125] A core selection module 620, for determining a target processing core among a plurality of processing cores;

[0126] The data distribution module 630 is used to distribute the data packets to be processed to the receiving queue corresponding to the target processing core;

[0127] Wherein, determining a target processing core among the plurality of processing cores comprises:

[0128] determining a pre-distributed processing core among the plurality of processing cores;

[0129] When the data processing load corresponding to the pre-distributed processing core satisfies the first condition, the pre-distributed processing core is determined as the target processing core.

[0130] It should be noted that the various modules of the load balancing device 600 of the embodiment of the present application can also be used to execute the specific implementation details of the load balancing method provided in the above embodiments, that is, the load balancing device 600 of the embodiment of the present application can also be used to execute any one or combination of the above embodiments, which will not be repeated here.

[0131] Figure 7 Schematic diagram of the structure of a communication device provided by an embodiment of the present application. Figure 7 As shown, the communication device 2000 includes a memory 2100 and a processor 2200. The number of the memory 2100 and the processor 2200 may be one or more. Figure 7In the example, a memory 2101 and a processor 2201 are taken; the memory 2101 and the processor 2201 in the network device can be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.

[0132] The memory 2101 is a computer-readable storage medium that can be used to store software programs, computer executable programs, and modules, such as program instructions / modules corresponding to the method provided in any embodiment of the present application. The processor 2201 implements the load balancing method provided in any of the above embodiments by running the software programs, instructions, and modules stored in the memory 2101.

[0133] The memory 2101 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function. In addition, the memory 2101 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device or other non-volatile solid-state storage device. In some instances, the memory 2101 further includes a memory remotely arranged relative to the processor 2201, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.

[0134] An embodiment of the present application further provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the load balancing method provided in any embodiment of the present application.

[0135] An embodiment of the present application also provides a computer program product, including a computer program or computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer program or computer instructions from the computer-readable storage medium, and the processor executes the computer program or computer instructions, so that the computer device executes the load balancing method provided in any embodiment of the present application.

[0136] The system architecture and application scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of the system architecture and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are equally applicable to similar technical problems.

[0137] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0138] In hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those of ordinary skill in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0139] The terms "component", "module", "system", etc. used in this specification are used to represent computer-related entities, hardware, firmware, a combination of hardware and software, software, or software in execution. For example, a component can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program, or a computer. By way of illustration, both applications running on a computing device and a computing device can be components. One or more components may reside in a process or an execution thread, and a component may be located on a computer or distributed between two or more computers. In addition, these components may be executed from various computer-readable media having various data structures stored thereon. Components may communicate, for example, through local or remote processes based on signals having one or more data packets (e.g., data from two components interacting with another component between a local system, a distributed system, or a network, such as the Internet interacting with other systems through signals).

[0140] The above describes some embodiments of the present application with reference to the accompanying drawings, but does not limit the scope of the present application. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present application shall be within the scope of the present application.

Claims

1. A load balancing method, characterized in that: Applied to a network forwarding device, the network forwarding device comprises a plurality of processing cores, each of the processing cores corresponds to a receiving queue; The method comprises: Determining a data processing load of each of the processing cores, wherein the data processing load is determined according to the number of data packets in the corresponding receiving queue; determining a target processing core among the plurality of processing cores; Distributing the data packets to be processed to the receiving queue corresponding to the target processing core; Wherein, determining a target processing core among the plurality of processing cores comprises: determining a pre-distributed processing core among the plurality of processing cores; When the data processing load corresponding to the pre-distributed processing core satisfies a first condition, the pre-distributed processing core is determined as a target processing core.

2. The load balancing method according to claim 1, characterized in that: Each of the processing cores also corresponds to a sending queue, and the data processing load includes a ratio of data packets sent and received; The determining of the data processing load of each of the processing cores comprises: For each of the processing cores, determining the data packet receiving and sending ratio of the processing core according to the number of first data packets in the receiving queue corresponding to the processing core and the number of second data packets in the sending queue corresponding to the processing core; The data processing load of each processing core is determined according to the data packet receiving and sending ratio of each processing core.

3. The load balancing method according to claim 2, characterized in that: The step of determining a target processing core among the plurality of processing cores further includes: When the data processing load of the pre-distributed processing core does not satisfy a first condition, selecting a new pre-distributed processing core from other processing cores; When the data processing load corresponding to the new pre-distributed processing core satisfies the first condition, the new pre-distributed processing core is determined as the target processing core; or, when the data processing load corresponding to the new pre-distributed processing core does not satisfy the first condition, the selection of a new pre-distributed processing core from the other processing cores is performed until the target processing core is determined or all the processing cores are traversed.

4. The load balancing method according to claim 3, characterized in that: The step of determining a target processing core among the plurality of processing cores further includes: When the data processing loads corresponding to the processing cores do not satisfy the first condition, the processing core having the smallest data packet sending and receiving ratio is determined as the target processing core.

5. The load balancing method according to claim 1, characterized in that: The data processing load includes a data packet backlog state and a data packet sending and receiving ratio; the determining a target processing core among the plurality of processing cores includes: When the data packet backlog state of each processing core is backlog, determining the distribution ratio of each processing core according to the data packet receiving and sending ratio of each processing core; The target processing core is determined from among all the processing cores according to the distribution ratios of all the processing cores.

6. The load balancing method according to claim 5, characterized in that: The method further comprises: In the case that there is no backlog of data packets in the processing core, the target processing core is determined from the processing cores that have no backlog of data packets.

7. The load balancing method according to claim 2, characterized in that: The step of determining a target processing core among the plurality of processing cores comprises: Determining the priority of the data packet to be processed; Determining the target processing core from among the processing cores according to the priority of the data packet to be processed and the data packet receiving and sending ratio corresponding to each of the processing cores; The priority of the priority is inversely proportional to the corresponding ratio of the data packet receiving and sending.

8. The load balancing method according to claim 2, characterized in that: The network forwarding device also includes a data receiving core; The distributing the to-be-processed data packets to the receiving queue corresponding to the target processing core includes: Acquire the data packet to be processed by polling the data packet queue of the port of the data receiving core; The data packet sending and receiving ratio corresponding to each of the processing cores is sent to the data receiving core, so that the data receiving core distributes the data packets to be processed to the receiving queue corresponding to the target processing core according to the data packet sending and receiving ratio.

9. A communication device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When at least one of the programs is executed by at least one of the processors, the method according to any one of claims 1 to 8 is implemented.

10. A computer program product comprising a computer program or computer instructions, characterized in that The computer program or the computer instructions are stored in a computer-readable storage medium, and a processor of a computer device reads the computer program or the computer instructions from the computer-readable storage medium. The processor executes the computer program or the computer instructions, so that the computer device executes the method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Message load balancing method and device, network equipment and computer readable storage medium

    CN120980083A