Traffic load balancing method, electronic device, storage medium and program

By obtaining the processing performance of the packet reception queue, filtering queues with low load for packet distribution, it solves the problem of unbalanced RSS technology in small-scale traffic scenarios, and improves the response speed and stability of the network system.

CN120342959APending Publication Date: 2025-07-18BEIJING HENGAN JIAXIN SAFETY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510479720.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

The existing RSS technology leads to unbalanced packet distribution in small-scale traffic scenarios, resulting in large differences in load pressures between each queue, affecting system performance and efficiency.

Method used

By obtaining the processing performance of the packets to be distributed, filtering the packet receiving queues with low load for distribution, and dynamically balancing the multi-queue load.

Benefits of technology

It realizes balanced packet distribution in large and small-scale traffic scenarios, improves the response speed and stability of the network system, and ensures efficient utilization of memory resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120342959A_ABST
    Figure CN120342959A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a traffic load balancing method, electronic equipment, a storage medium and a program, and the method comprises the steps: obtaining a to-be-distributed data packet; acquiring the data packet processing performance of each data packet receiving queue under the condition that the to-be-distributed data packet is determined to hit a first data stream processing rule; screening a first target data packet receiving queue from the data packet receiving queues according to the data packet processing performance of the data packet receiving queues; and sending the data packet to be distributed to the first target data packet receiving queue. According to the technical scheme provided by the embodiment of the invention, the multi-queue load for flow distribution can be dynamically balanced, the efficient utilization of memory resources of a network system is ensured, and the response speed and stability of the network are further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the technical field of traffic processing, and in particular, to a traffic load balancing method, an electronic device, a storage medium, and a program. Background Art

[0002] With the integrated and intelligent development of network technology and computer technology, computer networks have deeply penetrated into key fields such as enterprises, finance, and industrial manufacturing. However, in the context of the geometric growth of user scale and network traffic, it has become particularly important to achieve elastic expansion of network services through traffic load balancing technology.

[0003] RSS (Receive Side Scaling) is a multi-queue load balancing technology widely used in traffic reception. When a network card receives a data packet, it calculates the Hash value of the data packet according to a preset RSS hash algorithm, and then takes the remainder of the Hash value with respect to the number of receive queues to determine the queue to which the data packet should be sent.

[0004] In the process of implementing the present invention, the inventors found that the prior art has the following defects: Although RSS technology can effectively balance and distribute traffic when dealing with large-scale traffic, in the face of small-scale traffic scenarios, using RSS for data packet distribution will result in a large difference in the number of data packets between queues. This unbalanced distribution will lead to a large difference in the load pressure of subsequent packet receiving threads, thus affecting the overall performance and efficiency of the system. Summary of the Invention

[0005] Embodiments of the present invention provide a traffic load balancing method, an electronic device, a storage medium, and a program, which can dynamically balance the multi-queue load for traffic distribution, ensure the efficient use of memory resources in the network system, and thus improve the response speed and stability of the network.

[0006] According to one aspect of the present invention, there is provided a traffic load balancing method, including:

[0007] Obtain data packets to be distributed;

[0008] When it is determined that the data packets to be distributed hit the first data stream processing rule, obtain the data packet processing performance of each data packet receiving queue;

[0009] Screen a first target data packet receiving queue from each of the data packet receiving queues according to the data packet processing performance of each data packet receiving queue;

[0010] Send the data packets to be distributed to the first target data packet receiving queue.

[0011] According to another aspect of the present invention, there is provided a traffic load balancing device, including:

[0012] A packet to be distributed acquisition module for acquiring a packet to be distributed;

[0013] A packet processing performance acquisition module for acquiring the packet processing performance of each packet receiving queue when it is determined that the packet to be distributed hits the first data stream processing rule;

[0014] A first target packet receiving queue screening module for screening a first target packet receiving queue from each of the packet receiving queues according to the packet processing performance of each packet receiving queue;

[0015] A packet to be distributed distribution module for sending the packet to be distributed to the first target packet receiving queue.

[0016] According to another aspect of the present invention, there is provided an electronic device, the electronic device includes:

[0017] At least one processor; and

[0018] A memory communicatively connected to the at least one processor; wherein,

[0019] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the traffic load balancing method according to any embodiment of the present invention.

[0020] According to another aspect of the present invention, there is provided a computer-readable storage medium, the computer-readable storage medium stores computer instructions, and the computer instructions are used to implement the traffic load balancing method according to any embodiment of the present invention when executed by a processor.

[0021] According to another aspect of the present invention, there is also provided a computer program product, including a computer program, and the computer program implements the traffic load balancing method according to any embodiment of the present invention when executed by a processor.

[0022] In an embodiment of the present invention, a data packet to be distributed is obtained, and it is determined whether the data packet to be distributed hits the first data stream processing rule. In the case where it is determined that the data packet to be distributed hits the first data stream processing rule, the data packet processing performance of each data packet receiving queue is obtained. Further, a first target data packet receiving queue is selected from each data packet receiving queue according to the data packet processing performance of each data packet receiving queue, and the data packet to be distributed is sent to the first target data packet receiving queue. The above traffic load balancing method determines the first target data packet receiving queue to which the data packet to be distributed is sent by screening the data packet processing performance of each data packet receiving queue, and can distribute the data packet to be received to a queue with a lower load, thereby solving the problem of unbalanced distribution existing in the existing data packet distribution method, dynamically balancing the multi-queue load for traffic distribution, ensuring the efficient use of network system memory resources, and further improving the response speed and stability of the network.

[0023] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present invention, nor is it used to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0025] Figure 1 is a flowchart of a traffic load balancing method provided in Embodiment 1 of the present invention;

[0026] Figure 2 is a flowchart of a traffic load balancing method provided in Embodiment 2 of the present invention;

[0027] Figure 3 is a schematic structural diagram of a specific traffic load balancing method provided in Embodiment 2 of the present invention;

[0028] Figure 4 is a flowchart of a method for updating the first data stream processing rule provided in Embodiment 2 of the present invention;

[0029] Figure 5 is a schematic diagram of a traffic load balancing device provided in Embodiment 3 of the present invention;

[0030] Figure 6 is a schematic structural diagram of an electronic device provided in Embodiment 5 of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0031] To enable those skilled in the art to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0032] It should be noted that the terms "first", "second", and "target" in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily need to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.

[0033] Embodiment 1

[0034] Figure 1 is a flowchart of a traffic load balancing method provided by Embodiment 1 of the present invention. This embodiment is applicable to the case of determining the target queue for packet distribution according to the packet processing performance of each packet receiving queue. This method can be executed by a traffic load balancing device, which can be implemented in software and / or hardware, and is generally integrated in an electronic device. The electronic device can be a terminal device or a server device, as long as it can execute the traffic load balancing method. The specific device type of the electronic device is not limited in the embodiments of the present invention. Correspondingly, as Figure 1 shown, the method includes the following operations:

[0035] S110. Obtain the packet to be distributed.

[0036] Among them, the packet to be distributed can be a packet that has been received but not yet assigned to a specific packet receiving queue in the network system.

[0037] In the embodiments of the present invention, to achieve the load balancing of network traffic, the packet to be distributed can be obtained first, so that the processing rule of the packet to be distributed can be determined by analyzing the packet to be distributed.

[0038] S120. When it is determined that the data packet to be distributed hits the first data stream processing rule, obtain the data packet processing performance of each data packet receiving queue.

[0039] Among them, the first data stream processing rule can be a rule for processing and managing the data packet to be distributed during the process of processing the data packet to be distributed. The data packet processing performance can indicate the strength of the ability of the data packet receiving queue to process data packets.

[0040] In the embodiment of the present invention, when it is determined that the data packet to be distributed hits the first data stream processing rule, the data packet to be distributed can be distributed based on the first data stream processing rule. During the process of distributing the data packet to be distributed based on the first data stream processing rule, first, the data packet processing performance of each data packet receiving queue can be obtained to evaluate the ability of each data packet receiving queue to process data packets.

[0041] S130. Screen the first target data packet receiving queue from each of the data packet receiving queues according to the data packet processing performance of each data packet receiving queue.

[0042] Among them, the first target data packet receiving queue can be the target queue of the data packet to be distributed determined according to the first data stream processing rule.

[0043] Correspondingly, after obtaining the data packet processing performance of each data packet receiving queue, each data packet receiving queue can be screened according to the data packet processing performance of each data packet receiving queue to determine the first target data packet receiving queue. Optionally, to achieve load balancing of traffic, a queue with a low load can be preferentially selected as the first target data packet receiving queue.

[0044] S140. Send the data packet to be distributed to the first target data packet receiving queue.

[0045] Correspondingly, after screening the first target data packet receiving queue from each of the data packet receiving queues according to the data packet processing performance of each data packet receiving queue, the data packet to be distributed can be sent to the first target data packet receiving queue to achieve efficient distribution and processing of traffic.

[0046] It can be seen that the technical solution of the embodiment of the present invention screens the first target data packet receiving queue according to the data packet processing performance of each data packet receiving queue when it is determined that the data packet to be distributed hits the first data stream processing rule. By reasonably configuring the queue selection strategy, whether facing a large-scale traffic scenario or a small-scale traffic scenario, the processing efficiency and reliability of the network system can be significantly improved, ensuring the efficient distribution and processing of traffic.

[0047] In an embodiment of the present invention, a to-be-distributed data packet is obtained, and it is determined whether the to-be-distributed data packet hits a first data stream processing rule. When it is determined that the to-be-distributed data packet hits the first data stream processing rule, the data packet processing performance of each data packet receiving queue is obtained. Further, a first target data packet receiving queue is screened from each data packet receiving queue according to the data packet processing performance of each data packet receiving queue, and the to-be-distributed data packet is sent to the first target data packet receiving queue. The above traffic load balancing method determines the first target data packet receiving queue to which the to-be-distributed data packet is sent by screening the data packet processing performance of each data packet receiving queue, and can distribute the to-be-received data packets to the queue with lower load, thereby solving the problem of unbalanced allocation existing in the existing data packet distribution method, dynamically balancing the loads of multiple queues for traffic distribution, ensuring the efficient utilization of network system memory resources, and further improving the response speed and stability of the network.

[0048] Embodiment 2

[0049] Figure 2 FIG. is a flowchart of a traffic load balancing method provided in Embodiment 2 of the present invention. This embodiment is a specific implementation based on the above embodiment. In this embodiment, various specific optional implementation manners are given for determining whether the distributed data packet hits the first data stream processing rule, and in the case where it is determined that the to-be-distributed data packet hits the first data stream processing rule and the case where it does not hit the first data stream processing rule.

[0050] Correspondingly, as Figure 2 shown, the method of this embodiment may include:

[0051] S210. Obtain a to-be-distributed data packet.

[0052] In an optional embodiment of the present invention, before obtaining the to-be-distributed data packet, it may further include: configuring the first data stream processing rule according to the IP port association information and the processing timestamp of the received data packet; creating a traffic statistics structure of each data packet receiving queue according to the real-time performance statistical information of each data packet receiving queue; where the real-time performance statistical information includes the previous data packet processing performance value, the cumulative number of received packets, and the current data packet processing performance value.

[0053] Among them, the IP (Internet Protocol) port association information can be the detailed information that associates an IP address with a port number in network communication. Exemplarily, it can be an IP port quadruple, including a source IP address, a destination IP address, a source port number, and a destination port number. The processing timestamp of the received data packet can be the time point when the data packet is received and starts to be processed. The real-time performance statistics information can be the performance metric data collected and displayed in real time during the operation of the network system. Exemplarily, the real-time performance statistics information can include, but is not limited to, the last data packet processing performance value, the cumulative number of received packets, and the current data packet processing performance value, etc. The embodiments of the present invention do not limit the specific content included in the real-time performance statistics information. The traffic statistics structure can be a data structure for storing and managing network traffic statistics information.

[0054] In the embodiments of the present invention, before performing traffic load balancing, first, a first data stream processing rule can be configured according to the IP port association information and the processing timestamp of the received data packet. For example, a rule management Hash table can be created to manage the distribution of data packets. At the same time, a traffic statistics structure can be created for each data packet receiving queue to collect and display in real time the real-time performance statistics information including information such as the last data packet processing performance value, the cumulative number of received packets, and the current data packet processing performance value, so as to judge the data packet processing performance of each data packet receiving queue according to the real-time performance statistics information.

[0055] Figure 3 It is a schematic structural diagram of a specific traffic load balancing method provided by the second embodiment of the present invention. In a specific example, as Figure 3 shown, the data packets to be distributed can be distributed based on the network card. Optionally, during the distribution of the data packets to be distributed, an asynchronous task flow management tool can be used to manage the asynchronous tasks of the received data packets. Among them, the asynchronous task flow management tool can be a tool for managing asynchronous tasks. Optionally, the asynchronous task flow management tool can internally include a data stream processing rule management module, which can be used to manage the first data stream processing rule. For example, it can create, delete, and update each data stream processing rule in the first data stream processing rule. Optionally, the data stream processing rule management module can create an interface based on the data stream processing rule to manage the first data stream processing rule. The data stream processing rule creation interface can configure complex data packet filtering and processing rules on the network card to achieve efficient data packet classification and processing.

[0056] Specifically, in the data stream processing rule management module of the asynchronous task flow management tool, a rule management Hash table can be created based on the data stream processing rule. One Hash table can include one or more nodes. For example:

[0057] Node: {

[0058] Key: IP port quadruple

[0059] Value: Processing timestamp of the last received data packet, flow pointer

[0060] }

[0061] Among them, the flow pointer is a pointer pointing to the data stream processing rule and can be used to represent a data stream processing rule.

[0062] Meanwhile, a traffic statistics structure RxCounter can be created for each data packet receiving queue, for example:

[0063]

[0064] Among them, PPS (Packet Per Second) can be how many data packets a network device can process within a unit time, representing the strength of the data packet processing ability of the data packet receiving queue.

[0065] S220. Determine whether the data packet to be distributed hits the first data stream processing rule. If so, execute S230a; otherwise, execute S230b.

[0066] In an optional embodiment of the present invention, the determination that the data packet to be distributed hits the first data stream processing rule may include: parsing the data packet to be distributed to determine the IP port association information of the data packet to be distributed; and determining that the data packet to be distributed hits the first data stream processing rule when it is determined that the currently stored IP port association information in the first data stream processing rule includes the IP port association information of the data packet to be distributed.

[0067] In the embodiment of the present invention, to determine whether the data packet to be distributed hits the first data stream processing rule, first, the data packet to be distributed can be parsed to determine the IP port association information of the data packet to be distributed. Further, it can be determined whether the currently stored IP port association information in the first data stream processing rule includes the IP port association information of the data packet to be distributed. If the currently stored IP port association information in the first data stream processing rule includes the IP port association information of the data packet to be distributed, it can be determined that the data packet to be distributed hits the first data stream processing rule; if the currently stored IP port association information in the first data stream processing rule does not include the IP port association information of the data packet to be distributed, it can be determined that the data packet to be distributed does not hit the first data stream processing rule.

[0068] S230a. Obtain the traffic statistics structure of each of the said data packet receiving queues; wherein, the traffic statistics structure is updated in real time according to the distribution situation of the to-be-distributed data packets.

[0069] In an embodiment of the present invention, when it is determined that the to-be-distributed data packet hits the first data stream processing rule, the to-be-distributed data packet can be distributed based on the first data stream quantity rule. During the process of distributing the to-be-distributed data packet based on the first data stream quantity rule, first, the traffic statistics structure of each data packet queue can be obtained to obtain the real-time performance statistics information of each data packet receiving queue. It should be noted that the traffic statistics structure of each data packet receiving queue can be updated in real time according to the distribution situation of the to-be-distributed data packets.

[0070] In a specific example, assuming that the to-be-distributed data packet is distributed to data packet receiving queue 1, then the cumulative number of received packets pkts of the traffic statistics structure RxCounter of data packet receiving queue 1 can be updated. At the same time, every 1 second, pps can be calculated based on the following formula, and the value of pkts is assigned to last_pkts:

[0071] pps = (pkts - last_pkts) / 1

[0072] S240a. Determine the current data packet processing performance parameters of each of the said data packet receiving queues through the traffic statistics structures of each of the said data packet receiving queues.

[0073] Wherein, the current data packet processing performance parameter can be various performance indicators of each data packet receiving queue for processing data packets at the current time node.

[0074] Correspondingly, after obtaining the traffic statistics structures of each data packet receiving queue, the current data packet processing performance parameters of each data packet receiving queue at the current moment can be determined through the real-time performance statistics information in the traffic statistics structures of each data packet receiving queue, as the judgment basis for judging the data packet processing performance of each data packet receiving queue.

[0075] S250a. Obtain the data packet processing performance of each of the said data packet receiving queues according to the current data packet processing performance parameters of each of the said data packet receiving queues.

[0076] Correspondingly, after determining the current data packet processing performance parameters of each data packet receiving queue through the traffic statistics structures of each data packet receiving queue, the data packet processing performance of each data packet receiving queue can be determined according to the current data packet processing performance parameters of each data packet receiving queue, so that the to-be-distributed data can be distributed according to the data packet processing performance of each data packet receiving queue.

[0077] S260a. Screen the first target data packet receiving queue from each of the data packet receiving queues according to the data packet processing performance of each data packet receiving queue.

[0078] In an alternative embodiment of the present invention, the data packet processing performance may include the current packets per second (PPS); screening the first target data packet receiving queue from each of the data packet receiving queues according to the data packet processing performance of each data packet receiving queue may include: sorting the current PPS of each data packet receiving queue; screening the data packet receiving queue with the target PPS as the first target data packet receiving queue according to the sorting result of the current PPS of each data packet receiving queue.

[0079] Among them, the current PPS may be the number of data packets processed per second by each data packet receiving queue, which can represent the strength of the data packet processing performance of each data packet receiving queue. The data packet receiving queue with the target PPS may be the data packet receiving queue with a smaller current PPS.

[0080] In the embodiment of the present invention, in the process of screening the first target data packet receiving queue from each data packet receiving queue according to the data packet processing performance of each data packet receiving queue, first, the current PPS of each data packet receiving queue may be sorted. The size of the current PPS represents the strength of the ability of each data packet receiving queue to process data packets. It can be understood that the larger the current PPS, the heavier the load of the data packet receiving queue. Therefore, to achieve load balancing of traffic, the data packet receiving queue with a smaller or the smallest current PPS may be screened as the first target data packet receiving queue according to the sorting result of the current PPS of each data packet receiving queue.

[0081] S230b. Distribute the data packet to be distributed to the second target data packet receiving queue according to the second data stream processing rule.

[0082] Among them, the second data stream processing rule may be another rule for processing and managing the data packet to be distributed during the processing of the data packet to be distributed. Exemplarily, the second data stream processing rule may include, but is not limited to, the RSS rule, etc. The embodiment of the present invention does not limit the specific rules included in the second data stream processing rule. The second target data packet receiving queue may be the target queue of the data packet to be distributed determined according to the second data stream processing rule. It can be understood that the first data stream processing rule and the second data stream processing rule are different.

[0083] In the embodiment of the present invention, in the case where it is determined that the data packet to be distributed does not match the first data stream processing rule, the target queue of the data packet to be distributed, that is, the second target data packet receiving queue, may be determined based on the second data stream processing rule, and the data packet to be distributed may be distributed to the second target data packet receiving queue.

[0084] In a specific example, assume that the second data stream processing rule is the RSS rule, and there are 4 data packet receiving queues in the network system. In the case where it is determined that the data packet to be distributed does not hit the first data stream processing rule, the data packet to be distributed can be distributed based on the RSS rule. First, a hash value can be calculated based on the IP port quadruple of the data packet to be distributed. For example, it can include the source IP address, destination IP address, source port number, and destination port number. Then, the hash value is modulo-divided by the number of data packet receiving queues to obtain a queue index. Finally, the data packet to be distributed can be distributed to the corresponding queue according to the queue index. Exemplarily, assume that the hash value calculated based on the IP port quadruple of the data packet to be distributed is 10. The hash value is modulo-divided by the number of data packet receiving queues to obtain the queue index 10 % 4 = 2. Therefore, the data packet to be distributed will be assigned to the data packet receiving queue with an index of 2.

[0085] S240b. Generate an updated data stream processing rule according to the IP port association information of the data packet to be distributed and the current system time.

[0086] Among them, the current system time can be the current date and time of the computer system. The updated data stream processing rule can be a data stream processing rule generated according to the IP port association information of the data packet to be distributed and the current system time.

[0087] Correspondingly, in the case where it is determined that the data packet to be distributed does not hit the first data stream processing rule, after the data packet to be distributed is distributed to the second target data packet receiving queue according to the second data stream processing rule, an updated data stream processing rule can be generated according to the IP port association information of the data packet to be distributed and the current system time.

[0088] S250b. Update the first data stream processing rule according to the updated data stream processing rule.

[0089] Correspondingly, after generating an updated data stream processing rule according to the IP port association information of the data packet to be distributed and the current system time, the updated data stream processing rule can be added to the first data stream processing rule to implement the update of the first data stream processing rule, so as to ensure that when encountering a data packet to be distributed with the same IP port management information next time, the distribution process can be performed according to the updated first data stream processing rule.

[0090] Figure 4 It is a flowchart of a method for updating the first data stream processing rule provided in the second embodiment of the present invention. In a specific example, such as Figure 4As shown, if the IP port quadruple of the data packet to be distributed can be found in the rule management Hash table, it proves that the data packet to be distributed hits the first data stream processing rule. Therefore, the data packet to be distributed can be distributed to the first target data packet receiving queue based on the first data stream processing rule. At the same time, update the value of the corresponding node in the rule management Hash table to the time of receiving the data packet to be received, that is, the processing timestamp of receiving the data packet.

[0091] If the IP port quadruple of the data packet to be distributed cannot be found in the rule management Hash table, it proves that the data packet to be distributed does not hit the first data stream processing rule. Therefore, the data packet to be distributed can be distributed to the second target data packet receiving queue based on the second data stream processing rule. At the same time, call the data stream processing rule creation function to generate a data stream processing rule, and send the rule to the network card. Further, a new node can be created and inserted into the rule management Hash table. During the node creation process, the IP port quadruple of the data packet to be distributed can be used as the key, and the time of receiving the data packet to be distributed can be used as the value. Among them, the flow pointer of the value is the return value of calling the data stream processing rule creation function when creating the data stream processing rule, which can be used to delete the rule later. Optionally, the data stream processing rule creation function allows users to configure complex data packet filtering and processing rules on the network card to create new data packet processing rules.

[0092] In an optional embodiment of the present invention, the above method may further include: obtaining the processing timestamp of the received data packet currently stored in the first data stream processing rule and the current system time; and deleting the processing rule of the received data packet in the first data stream processing rule when it is determined that the difference between the current system time and the processing timestamp of the received data packet is greater than a preset threshold.

[0093] Wherein, the preset threshold may be a threshold of the difference between the current system time and the processing timestamp of the received data packet set in advance.

[0094] Since the data streams in the actual network are always constantly being newly created and ended, for the data streams that have not had data packets for a long time, their rules should be deleted. Therefore, the processing timestamp of the received data packet currently stored in the first data stream processing rule and the current system time can be obtained, and the difference between the current system time and the processing timestamp of the received data packet can be calculated. When it is determined that the difference between the current system time and the processing timestamp of the received data packet is greater than the preset threshold, the processing rule of the corresponding received data packet in the first data stream processing rule can be deleted.

[0095] Such as Figure 3As shown, in a specific example, rule deletion can be performed in the data flow processing rule management module. If the difference between the current system time and the processing timestamp of the received data packet is greater than 300 seconds, the corresponding processing rule in the rule management Hash table can be deleted. Exemplarily, a data flow processing rule deletion function can be called, passing in the flow pointer to delete the corresponding rule (send the deletion instruction to the network card to delete the corresponding rule). Optionally, the data flow processing rule deletion function can be used to release the resources related to the specified data flow processing rule and remove the specified data flow processing rule from the network card.

[0096] In the embodiment of the present invention, a data packet to be distributed is obtained, and it is determined whether the data packet to be distributed hits the first data flow processing rule. In the process of determining whether the data packet to be distributed hits the first data flow processing rule, first, the data packet to be distributed is parsed to determine the IP port association information of the data packet to be distributed. If it is determined that the currently stored IP port association information in the first data flow processing rule includes the IP port association information of the data packet to be distributed, it can be determined that the data packet to be distributed hits the first data flow processing rule. Further, in the case where it is determined that the data packet to be distributed hits the first data flow processing rule, the traffic statistics structure of each data packet receiving queue is obtained, and the current data packet processing performance parameters of each data packet receiving queue are determined through the traffic statistics structure of each data packet receiving queue, so as to obtain the data packet processing performance of each data packet receiving queue according to the current data packet processing performance parameters of each data packet receiving queue. Further, according to the data packet processing performance of each data packet receiving queue, a first target data packet receiving queue is screened from each data packet receiving queue, and the data packet to be distributed is sent to the first target data packet receiving queue. At the same time, if it is determined that the data packet to be distributed does not hit the first data flow processing rule, the data packet to be distributed is distributed to a second target data packet receiving queue according to the second data flow processing rule, and an updated data flow processing rule is generated according to the IP port association information of the distributed data packet and the current system time, so that the first data flow processing rule can be updated according to the updated data flow processing rule. The above traffic load balancing method can screen the data packet processing performance of each data packet receiving queue to determine the first target data packet receiving queue to which the data packet to be distributed is sent, and can distribute the data packet to be received to the queue with lower load, thus solving the problem of unbalanced distribution existing in the existing data packet distribution method, dynamically balancing the load of multiple queues for traffic distribution, ensuring the efficient use of network system memory resources, and further improving the response speed and stability of the network.

[0097] In the technical solution of the present disclosure, the processing of collection, storage, use, processing, transmission, provision, and disclosure of the user's personal information involved all comply with the provisions of relevant laws and regulations and do not violate public order and good customs.

[0098] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this disclosure are all information and data that have been authorized by the user or fully authorized by all parties, and the collection, use, and processing of the relevant data comply with the relevant laws, regulations, and standards in the relevant regions.

[0099] It should be noted that any permutation and combination of the technical features in the above embodiments also fall within the protection scope of the present invention.

[0100] Embodiment 3

[0101] Figure 5 is a schematic diagram of a traffic load balancing device provided in Embodiment 3 of the present invention. As Figure 5 shown, the device includes: a to-be-distributed data packet acquisition module 310, a data packet processing performance acquisition module 320, a first target data packet receiving queue screening module 330, and a to-be-distributed data packet distribution module 340, where:

[0102] The to-be-distributed data packet acquisition module 310 is configured to acquire to-be-distributed data packets.

[0103] The data packet processing performance acquisition module 320 is configured to acquire the data packet processing performance of each data packet receiving queue when it is determined that the to-be-distributed data packet hits the first data stream processing rule.

[0104] The first target data packet receiving queue screening module 330 is configured to screen a first target data packet receiving queue from each of the data packet receiving queues according to the data packet processing performance of each of the data packet receiving queues.

[0105] The to-be-distributed data packet distribution module 340 is configured to send the to-be-distributed data packet to the first target data packet receiving queue.

[0106] In an embodiment of the present invention, a to-be-distributed data packet is obtained, and it is determined whether the to-be-distributed data packet hits a first data stream processing rule. When it is determined that the to-be-distributed data packet hits the first data stream processing rule, the data packet processing performance of each data packet receiving queue is obtained. Further, a first target data packet receiving queue is screened from each data packet receiving queue according to the data packet processing performance of each data packet receiving queue, and the to-be-distributed data packet is sent to the first target data packet receiving queue. By screening the data packet processing performance of each data packet receiving queue to determine the first target data packet receiving queue to which the to-be-distributed data packet is sent, the above traffic load balancing method can distribute the to-be-received data packets to the queue with lower load, thereby solving the problem of unbalanced distribution existing in the existing data packet distribution method, dynamically balancing the loads of multiple queues for traffic distribution, ensuring the efficient utilization of the memory resources of the network system, and further improving the response speed and stability of the network.

[0107] Optionally, the data packet processing performance obtaining module 320 is specifically configured to: parse the to-be-distributed data packet to determine the IP port association information of the to-be-distributed data packet; when it is determined that the IP port association information currently stored in the first data stream processing rule includes the IP port association information of the to-be-distributed data packet, determine that the to-be-distributed data packet hits the first data stream processing rule.

[0108] Optionally, the data packet processing performance obtaining module 320 is further configured to: obtain the traffic statistical structure of each data packet receiving queue; wherein, the traffic statistical structure is updated in real time according to the distribution situation of the to-be-distributed data packet; determine the current data packet processing performance parameters of each data packet receiving queue through the traffic statistical structure of each data packet receiving queue; and obtain the data packet processing performance of each data packet receiving queue according to the current data packet processing performance parameters of each data packet receiving queue.

[0109] Optionally, the data packet processing performance includes the current packets per second (PPS); the first target data packet receiving queue screening module 330 is specifically configured to: sort the current PPS of each data packet receiving queue; and screen the data packet receiving queue with the target PPS as the first target data packet receiving queue according to the sorting result of the current PPS of each data packet receiving queue.

[0110] Optionally, the above device may further include an initialization module, configured to: configure the first data stream processing rule according to the IP port association information and the processing timestamp of the received data packet; create the traffic statistical structure of each data packet receiving queue according to the real-time performance statistical information of each data packet receiving queue; wherein, the real-time performance statistical information includes the previous data packet processing performance value, the cumulative number of received packets, and the current data packet processing performance value.

[0111] Optionally, the above device may further include a data flow processing rule update module, configured to: when it is determined that the data packet to be distributed does not hit the first data flow processing rule, distribute the data packet to be distributed to a second target data packet receiving queue according to a second data flow processing rule; generate an updated data flow processing rule according to the IP port association information and the current system time of the data packet to be distributed; and update the first data flow processing rule according to the updated data flow processing rule.

[0112] Optionally, the above device may further include a data flow processing rule deletion module, configured to: obtain the processing timestamp of the received data packet currently stored in the first data flow processing rule and the current system time; and delete the processing rule of the received data packet in the first data flow processing rule when it is determined that the difference between the current system time and the processing timestamp of the received data packet is greater than a preset threshold.

[0113] The above traffic load balancing device can execute the traffic load balancing method provided in any embodiment of the present invention, and has corresponding functional modules and beneficial effects for executing the method. For technical details not described in detail in this embodiment, reference can be made to the traffic load balancing method provided in any embodiment of the present invention.

[0114] Since the above-described traffic load balancing device is a device that can execute the traffic load balancing method in the embodiments of the present invention, based on the traffic load balancing method described in the embodiments of the present invention, those skilled in the art can understand the specific implementation manners and various variations of the traffic load balancing device in this embodiment. Therefore, the implementation of the traffic load balancing method in the embodiments of the present invention by this traffic load balancing device will not be described in detail here. As long as the device used by those skilled in the art to implement the traffic load balancing method in the embodiments of the present invention falls within the scope of protection of this application.

[0115] Embodiment 4

[0116] Figure 6 FIG. shows a schematic structural diagram of an electronic device 10 that can be used to implement the embodiments of the present invention. The electronic device is intended to represent various forms of digital computers, such as, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, a personal digital processor, a cellular phone, a smart phone, a wearable device (such as a helmet, glasses, a watch, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0117] As Figure 6As shown, the electronic device 10 includes at least one processor 11 and a memory communicatively connected to the at least one processor 11, such as read-only memory (ROM) 12, random access memory (RAM) 13, etc. The memory stores a computer program executable by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.

[0118] Multiple components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disc, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0119] The processor 11 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the traffic load balancing method.

[0120] In some embodiments, the traffic load balancing method can be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the traffic load balancing method described above can be executed. Alternatively, in other embodiments, the processor 11 can be configured to execute the traffic load balancing method by any other appropriate means (e.g., by means of firmware).

[0121] Optionally, a traffic load balancing method may include: obtaining a data packet to be distributed; when determining that the data packet to be distributed hits a first data stream processing rule, obtaining the data packet processing performance of each data packet receiving queue; screening a first target data packet receiving queue from each of the data packet receiving queues according to the data packet processing performance of each of the data packet receiving queues; and sending the data packet to be distributed to the first target data packet receiving queue.

[0122] The various embodiments of the systems and techniques described above in this specification can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a dedicated or general-purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit the data and instructions to the storage system, the at least one input device, and the at least one output device.

[0123] The computer programs for implementing the methods of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a dedicated computer, or other programmable data processing device, such that when the computer programs are executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer programs can be executed entirely on the machine, partially on the machine, as an independent software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0124] In the context of the present invention, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0125] In order to provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0126] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), blockchain network, and the Internet.

[0127] A computing system may include a client and a server. The client and the server are generally far from each other and usually interact via a communication network. The relationship between the client and the server is created by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, and solves the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services.

[0128] It should be understood that various forms of processes shown above can be used, steps can be reordered, added or deleted. For example, the steps recited in the present disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution disclosed in the present disclosure can be achieved, and no limitation is made herein.

[0129] The above specific embodiments do not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principle of the present disclosure shall be included within the protection scope of the present disclosure.

Claims

1. A traffic load balancing method, characterized in that, Including: Obtain the data packet to be distributed; When it is determined that the data packet to be distributed hits the first data stream processing rule, obtain the data packet processing performance of each data packet receiving queue; Screen the first target data packet receiving queue from each of the data packet receiving queues according to the data packet processing performance of each of the data packet receiving queues; Send the data packet to be distributed to the first target data packet receiving queue.

2. The method according to claim 1, wherein The determination that the data packet to be distributed hits the first data stream processing rule includes: Parse the data packet to be distributed to determine the Internet Protocol (IP) port association information of the data packet to be distributed; When it is determined that the currently stored IP port association information in the first data stream processing rule includes the IP port association information of the data packet to be distributed, determine that the data packet to be distributed hits the first data stream processing rule.

3. The method according to claim 1 or 2, characterized in that, The obtaining of the data packet processing performance of each data packet receiving queue includes: Obtain the traffic statistics structure of each of the data packet receiving queues; wherein, the traffic statistics structure is updated in real time according to the distribution situation of the data packet to be distributed; Determine the current data packet processing performance parameters of each of the data packet receiving queues through the traffic statistics structure of each of the data packet receiving queues; Obtain the data packet processing performance of each of the data packet receiving queues according to the current data packet processing performance parameters of each of the data packet receiving queues.

4. The method according to claim 3, characterized in that, The data packet processing performance includes the current packets per second (PPS); the screening of the first target data packet receiving queue from each of the data packet receiving queues according to the data packet processing performance of each of the data packet receiving queues includes: Sort the current PPS of each of the data packet receiving queues; Screen the data packet receiving queue with the target PPS as the first target data packet receiving queue according to the sorting result of the current PPS of each of the data packet receiving queues.

5. The method according to claim 3, characterized in that, Before obtaining the data packet to be distributed, it further includes: Configure the first data stream processing rule according to the IP port association information and the processing timestamp of the received data packet; Create the traffic statistics structure of each of the data packet receiving queues according to the real-time performance statistical information of each of the data packet receiving queues; wherein, the real-time performance statistical information includes the previous data packet processing performance value, the cumulative number of received packets, and the current data packet processing performance value.

6. The method according to claim 1, wherein It further includes: When it is determined that the data packet to be distributed does not hit the first data stream processing rule, distribute the data packet to be distributed to the second target data packet receiving queue according to the second data stream processing rule; Generate an updated data stream processing rule according to the IP port association information of the data packet to be distributed and the current system time; Update the first data stream processing rule according to the updated data stream processing rule.

7. The method according to claim 1, characterized in that It further includes: Obtain the processing timestamp of the received data packet currently stored in the first data stream processing rule and the current system time; When it is determined that the difference between the current system time and the processing timestamp of the received data packet is greater than a preset threshold, delete the processing rule of the received data packet in the first data stream processing rule.

8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, the memory stores a computer program executed by the at least one processor, and when the computer program is executed by the at least one processor, the at least one processor is enabled to execute the traffic load balancing method according to any one of claims 1-7.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the traffic load balancing method according to any one of claims 1-7 is implemented.

10. A computer program product, comprising a computer program / instructions, wherein, When the computer program / instructions are executed by a processor, the traffic load balancing method according to any one of claims 1-7 is implemented.