Load balancing method and device
By dividing the packets in the data stream into basic routing data particles and allocating them to cache queues of multiple equivalent paths, and integrating flow-drift and packet-by-packet load balancing technologies, the problem of low link bandwidth utilization and out of order of data packets in the coexistence of elephant stream and mouse stream is solved, and more efficient load balancing is achieved.
Patent Information
- Application Number
- CN202510348040.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-24
- Publication Date
- 2025-07-08
AI Technical Summary
The existing current-drift load balancing technology is difficult to maximize the utilization of transmission path bandwidth when elephant stream and mouse stream coexist. The packet-by-packet load balancing technology leads to the problem of out-of-order data packets, affecting the effective utilization of link bandwidth.
The flow-drift and packet-by-packet load balancing technology is integrated, and the data packets in the data stream are divided into basic routing data particles and allocated to cache queues of multiple equivalent paths according to the packet count threshold value, ensuring that the data packets are ordered and disordered within the basic routing data particles, and load path routing is realized.
It alleviates the problem of data packet disorder caused by packet-by-packet load balancing technology, and at the same time improves the utilization rate of link bandwidth, avoids link load unevenness and congestion, and improves the reliability and efficiency of data transmission.
Smart Images

Figure CN120281715A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technologies, and in particular, to a load balancing method and apparatus. Background Art
[0002] Link load balancing technology is widely used in wide area networks and data center networks to improve the utilization efficiency of data center link bandwidth, enhance the reliability of data transmission, and reduce the latency of data transmission. In modern data center networks, the fat-tree network architecture (Fat-Tree) or the leaf-spine network architecture (Leaf-Spine) is mostly adopted to provide multiple equivalent network transmission paths between different server nodes; in wide area networks, with the application of technologies such as SRv6 (Segment Routing IPv6, segment routing based on the IPv6 forwarding plane), multiple network transmission paths can also be formulated through segment routing strategies between different network nodes to achieve load sharing. In this context, allocating network traffic to multiple network transmission paths based on a suitable load balancing algorithm or strategy is the key to realizing the efficient utilization of link bandwidth and reliable data transmission. Summary of the Invention
[0003] To overcome the problems existing in the related art, this application provides a load balancing method and apparatus.
[0004] According to the first aspect of the embodiments of this application, a load balancing method is provided. The method includes:
[0005] Dividing the data packets in the ingress traffic into multiple data streams according to the metadata of the data packets;
[0006] Dividing the data packets in each of the data streams into basic routing data granules according to a data packet count threshold value;
[0007] Allocating a target path for each of the basic routing data granules from multiple equivalent paths, and sending the basic routing data granules to the cache queue of the target path.
[0008] According to the second aspect of the embodiments of this application, a load balancing apparatus is provided. The apparatus includes:
[0009] A data stream division module, configured to divide the data packets in the ingress traffic into multiple data streams according to the metadata of the data packets;
[0010] A routing granule division module, configured to divide the data packets in each of the data streams into basic routing data granules according to a data packet count threshold value;
[0011] A path allocation module, configured to allocate a target path for each of the basic routing data particles from multiple equivalent paths, and send the basic routing data particles to a cache queue of the target path.
[0012] According to a third aspect of the embodiments of the present application, there is provided an electronic device, including:
[0013] A memory and one or more processors; the memory is coupled to the processor; wherein, computer program code is stored in the memory, and the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the method as described above.
[0014] According to a fourth aspect of the embodiments of the present application, there is provided a computer-readable storage medium, including computer instructions, and when the computer instructions run on an electronic device, the electronic device is caused to execute the method as described above.
[0015] According to a fifth aspect of the embodiments of the present application, there is provided a computer program product, and when the computer program product runs on a computer, the computer is caused to execute the method as described above.
[0016] The technical solutions provided by the embodiments of the present application may include the following beneficial effects:
[0017] The embodiments of the present application integrate the per-flow load balancing technology and the per-packet load balancing technology. When performing load path routing, a certain number of data packets in a data stream are packed together as basic routing data particles. The data packets inside each basic routing data particle are actually in order, while the data packets between basic routing data particles are disordered. Therefore, when performing load path routing with such basic routing data particles, on the one hand, it can alleviate the problem of out-of-order data packets caused by the per-packet load balancing technology, and on the other hand, it can alleviate the problem of ineffective utilization of link bandwidth brought by the per-flow load balancing technology.
[0018] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings herein are incorporated into the specification and form a part of the present application, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application.
[0020] Figure 1 It is a schematic flowchart of the load balancing method provided by the embodiments of the present application;
[0021] Figure 2 It is a schematic diagram of dividing the incoming traffic into data streams according to metadata in the embodiments of the present application;
[0022] Figure 3 This is a schematic diagram showing that in the embodiment of the present application, the basic routing data particles within the same data stream are allocated to different path cache queues;
[0023] Figure 4 This is a schematic diagram of the cache queue length threshold value in the embodiment of the present application;
[0024] Figure 5 This is a schematic diagram of the first threshold value and the second threshold value of the cache queue length in the embodiment of the present application;
[0025] Figure 6 This is a schematic diagram of the structure of the load balancing device provided by the embodiment of the present application;
[0026] Figure 7 This is a schematic diagram of the structure of the electronic device provided by the embodiment of the present application. Detailed implementation manners
[0027] Next, the technical solutions in the embodiments of the present application will be described with reference to the accompanying drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments and are not intended to limit the present application.
[0028] It should be noted that "at least one" in the present application means one or more, and "a plurality" means two or more than two. "And / or" describes the association relationship of associated objects and indicates that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone, where A and B can be singular or plural. The terms "first", "second", "third", etc. (if any) in the specification, claims and drawings of the present application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0029] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Exactly speaking, using words such as "exemplary" or "for example" aims to present relevant concepts in a specific manner.
[0030] Currently, link load balancing is mainly divided into two methods: per-flow and per-packet.
[0031] Flow-based load balancing identifies data flows based on the five-tuple of data packets and assigns all packets of the same data flow to the same path. Therefore, flow-based load balancing can ensure the order of data packets and the integrity of sessions. Equal-Cost Multi-Path Routing (ECMP) is a typical flow-based load balancing technology. For data packets arriving at the same destination address, the equal-cost multi-path load balancing technology allows multiple equivalent network transmission paths to be used simultaneously, dispersing network traffic to different links, thereby achieving load balancing of the links.
[0032] However, the equal-cost multi-path load balancing technology has the following defects: on the one hand, the equal-cost multi-path load balancing technology cannot predict the spatio-temporal distribution of data packets of each data flow. In the case of coexistence of elephant flows and mouse flows, the load balancing effect of the equal-cost multi-path load balancing technology is not good, and there is a possibility of allocating elephant flows or bursty flows to the same link, which will lead to serious network congestion or network failures; on the other hand, the equal-cost multi-path load balancing technology cannot perceive the real-time congestion situation of the link, which may cause some links to be overloaded.
[0033] Packet-based load balancing will independently allocate each data packet to different paths to achieve finer-grained load balancing. Random Packet Spraying (RPS) is a typical packet-based load balancing technology. The random packet spraying technology is a load balancing strategy based on the packet level. By randomly allocating each data packet in the data flow to multiple equivalent network transmission paths, it ensures that network traffic is evenly distributed between different links, avoids some links from being overloaded, and realizes the load balancing of the links.
[0034] However, the random packet spraying technology has the following defects: on the one hand, different data packets of the same data flow may be transmitted through different paths, resulting in out-of-order problems; on the other hand, out-of-order data packets may be misjudged as lost packets by TCP (Transmission Control Protocol), triggering the congestion control mechanism, thereby reducing the congestion control window and further affecting the full utilization of the transmission path bandwidth.
[0035] In summary, it is difficult for the equal-cost multi-path load balancing technology to achieve the load balance of each transmission path in the case of coexistence of elephant flows and mouse flows, thus unable to maximize the utilization of the transmission path bandwidth; while in an asymmetric path environment, the random packet spraying technology will cause out-of-order arrangement of data packets to trigger the congestion control mechanism, resulting in the transmission path bandwidth not being maximally utilized.
[0036] In view of the above problems, the present application provides a load balancing method and apparatus. By combining the random packet spraying technology with the equal-cost multi-path load balancing technology, on the one hand, it alleviates the problem of packet out-of-order caused by the random packet spraying technology, and on the other hand, it alleviates the problem that the transmission path bandwidth cannot be maximally utilized by the per-flow load balancing technology.
[0037] Next, the embodiments of the present application will be described in detail.
[0038] Embodiment 1:
[0039] The embodiment of the present application provides a load balancing method. As Figure 1 shown, the method may include the following steps:
[0040] Step 110: Divide the packets in the ingress traffic into multiple data streams according to the metadata of the packets;
[0041] Step 120: Divide the packets in each data stream into basic routing data granules according to the packet count threshold value;
[0042] Step 130: Allocate a target path for each basic routing data granule from multiple equivalent paths, and send the basic routing data granule to the cache queue of the target path.
[0043] The embodiment of the present application is applicable to a multi-path load balancing scenario. Equal-Cost Multi-Path means that multiple paths to the same destination have the same cost. The cache queue refers to the traffic buffer of each path. On the one hand, the cache queue can provide buffering for the ingress traffic to avoid packet loss caused by path delay or congestion. On the other hand, it can dynamically adjust the traffic allocation through queue management to ensure load balancing of each path.
[0044] First, extract the metadata of the packets in the ingress traffic, where the metadata is data describing the characteristics of the packet payload, such as the five-tuple (source IP, destination IP, protocol, source port, destination port). Then, divide the packets in the ingress traffic into individual data streams according to the metadata of the packets, as Figure 2 shown. As an optional implementation, calculate the hash value of the packet metadata, and divide the packets in the ingress traffic into different data streams through the hash value. Further, in order to avoid the hash polarization problem, a random value can be introduced when calculating the hash value.
[0045] After that, for each data stream, the data packets inside it are divided into basic routing data granules. Specifically, the basic routing data granules are divided according to the data packet count threshold value. Suppose the data packet count threshold value is configured to be 3, then every 3 data packets within the same data stream are divided into a basic routing data granule. When performing load path routing, in this embodiment, routing is performed in units of basic routing data granules, and each basic routing data granule is respectively assigned to different paths according to a certain strategy or rule.
[0046] As an alternative implementation, each data packet in the data stream is counted and stored in a variable data packet count value C i Meanwhile, a data packet count threshold value R i is set. When the data packet count value exceeds the data packet count threshold value, all the data packets participating in the counting in this round are divided into a basic routing data granule, and this basic routing data granule is assigned to the cache queue of the target path according to a certain path allocation strategy or rule. Meanwhile, the data packet count value is cleared to zero, and the next round of data packet counting is started.
[0047] When the data packet count threshold value is configured to be 3, as Figure 3 shown, the first three data packets 1, 2, and 3 of data stream 1 are assigned to cache queue 1 through a preset path allocation algorithm, and then the data packet count value of this data stream is cleared to zero; starting from the fourth data packet, counting is restarted. The three data packets 4, 5, and 6 of data stream 1 are assigned to cache queue 2 through a preset path allocation algorithm, and then the data packet count value of this data stream is cleared to zero; and so on until all the data packets of this data stream 1 are sent.
[0048] In summary, in the processing architecture of this embodiment of the present application, the per-packet load balancing technology and the per-flow load balancing technology are integrated. When performing load path routing, neither the data packet nor the data stream is used as the basic routing data granule. Instead, a certain number of data packets within the data stream are packed together as the basic routing data granule. After such a setting, the data packets inside each basic routing data granule are actually ordered, while the data packets between the basic routing data granules are disordered. This embodiment of the present application performs load path routing in units of the basic routing data granules designed in this way. On the one hand, compared with the per-packet random data packet spraying technology, it can improve the orderliness of data packet transmission through different paths. On the other hand, compared with the per-flow multi-equivalent path load balancing technology, it can split the elephant flow and then disperse it to reach the destination through multiple paths, avoiding link load imbalance or link congestion caused by the elephant flow and improving the link bandwidth utilization rate.
[0049] It is worth mentioning that the embodiments of the present application do not involve any changes at the network layer and transport layer protocol structure levels. It is mainly the changes at the device algorithm level. Compared with many existing technical solutions, the embodiments of the present application make the deployment and implementation of the load balancing system easier.
[0050] Embodiment 2:
[0051] Based on Embodiment 1, the embodiments of the present application provide multiple configuration methods for the packet counting threshold.
[0052] Configuration method 1: Different traffic data can be collected and then statistically analyzed to view the distribution of the number of packets in all data streams. The packet counting threshold can be set according to the percentile of the packet number distribution. For example, assume that through packet statistical analysis, it is found that the number of packets in 80% of the data streams is 105. Then the packet counting threshold can be configured as 105. After such configuration, statistically, approximately 80% of the data streams with a packet number less than 105 will achieve load balancing in a per-flow manner, while the remaining 20% of the data streams with a packet number greater than or equal to 105 will perform basic routing data particle cutting according to the packet counting threshold configured as 105, and each basic routing data particle obtained by cutting will achieve load balancing in a per-packet manner.
[0053] That is, as a specific implementation manner, the packet counting threshold is configured according to the statistical result of the number of packets in the historical data stream.
[0054] Configuration method 2: The packet counting threshold can also be configured according to specific test experiments. For example, a set of configuration results is set for the packet counting threshold, and the link bandwidth utilization rate under different configuration results is observed in the actual scenario, and the configuration result with the highest link bandwidth utilization rate is selected as the packet counting threshold.
[0055] That is, as a specific implementation manner, the link bandwidth utilization rate of the packet counting threshold under different configuration results is monitored, and the packet counting threshold is configured according to the monitoring result.
[0056] Configuration method 3: Different packet counting thresholds are set in different time periods.
[0057] That is, as a specific implementation manner, the packet counting threshold is configured according to the current time of the system and the threshold configuration strategy for different time periods set in advance.
[0058] Configuration method 4: Based on the congestion information fed back by the downstream node, the packet counting threshold can be dynamically calculated through a specific algorithm. It is also possible to collect and analyze the congestion situation of each path through the global congestion controller, and then dynamically calculate the packet counting threshold through a specific algorithm.
[0059] That is, as a specific implementation, configure the packet count threshold according to the local congestion parameter fed back by the downstream node, or according to the global congestion parameter fed back by the global congestion controller.
[0060] Configuration method five: Different packet count thresholds can be set for specific service flows, such as based on service type identifiers or metadata.
[0061] That is, for different service types, set corresponding packet count thresholds for the data flows of each service type respectively. In this case, the embodiments of the present application specifically divide the packets in each data flow into basic routing data particles according to the packet count threshold through the following steps:
[0062] Step 121: Determine the target service type of the current data flow according to the metadata of the packet;
[0063] Step 122: Read the target packet count threshold pre-configured for the target service type;
[0064] Step 123: Divide the packets in the current data flow into basic routing data particles according to the target packet count threshold.
[0065] As described above, for the packet count threshold, the embodiments of the present application provide multiple configuration methods. In practical applications, any configuration method (including but not limited to the configuration methods provided by the present application) can be selected according to the scenario requirements, and this embodiment does not make any limitations.
[0066] In the design of the load balancing processing architecture, the embodiments of the present application introduce a packet count threshold R that can be statically or dynamically configured i to manage the size of the basic routing data particles. It can be seen that:
[0067] When the packet count threshold R i is configured to 1, the above design degrades to the per-packet random packet spraying load balancing technology;
[0068] When the packet count threshold R i is configured to a very large value or infinity, so that it exceeds the number of packets in most data flows, the above design is infinitely close to the per-flow equivalent multi-path load balancing technology.
[0069] Based on the packet count threshold value designed as above, the embodiments of the present application provide an additional control dimension, which allows elephant flows to perform multi-path transmission in a random packet spraying manner, while allowing the packets of mouse flows to perform multi-path transmission in an equivalent multi-path load balancing technology manner, thereby improving the link bandwidth utilization rate and the scenario adaptability of the overall solution. Especially in the scenario where there is asymmetry between multiple equivalent paths, the packet out-of-order problem can be alleviated to a certain extent.
[0070] Embodiment 3:
[0071] Based on Embodiment 1, Embodiment 3 provides multiple implementation manners for allocating basic routing data granules to paths.
[0072] Implementation manner 1: In the scenario where the link path symmetry is relatively good, the total link bandwidth resource is tight, and the link bandwidth utilization rate is pursued, such as in the data center scenario, the basic routing data granules can be allocated to the path with the shortest cache queue length among all equivalent paths.
[0073] That is, as a specific implementation manner, select the path with the shortest cache queue length from multiple equivalent paths as the target path of the basic routing data granules.
[0074] Implementation manner 2: Under the condition that the remaining bandwidth of each path can be sensed, the basic routing data granules can also be allocated to the path with the largest remaining bandwidth of the link.
[0075] That is, as a specific implementation manner, select the path with the largest remaining bandwidth of the link from multiple equivalent paths as the target path of the basic routing data granules.
[0076] Implementation manner 3: In the scenario where there is asymmetry in each link and it is necessary to further control the packet out-of-order at the algorithm level, the cache queue length of the current path can be compared with all cache queue lengths, and the basic routing data granules can be allocated to the path that is closest to the cache queue length of the current path among all equivalent paths. Wherein, the current path refers to the path to which the basic routing data granule (abbreviated as the previous basic routing data granule) that is only earlier than the current basic routing data granule in the allocation order in the same data flow is allocated.
[0077] That is, as a specific implementation manner, the embodiments of the present application specifically allocate the target path for each basic routing data granule in the following manner: for the current basic routing data granule, select the path whose cache queue length is closest to the cache queue where the previous basic routing data granule is located from multiple equivalent paths as the target path of the current basic routing data granule, wherein the previous basic routing data granule refers to the basic routing data granule that belongs to the same data flow as the current basic routing data granule and is only earlier than the current basic routing data granule in the allocation order.
[0078] Implementation method 4: When there is asymmetry in each link and it is necessary to further control the out-of-order of data packets at the algorithm level while taking performance into account, the cache queue length of the current path can be compared with the cache queue lengths of all cache queues, and the basic routing data particles are distributed to the paths that are closest to the cache queue length of the current path among all equivalent paths and whose cache queue lengths are shorter than that of the current queue. If there is no path that meets the requirements, they are still distributed to the current path.
[0079] As described above, for the method of distributing basic routing data particles to paths, the embodiments of the present application provide multiple implementation methods. In practical applications, any implementation method can be selected according to the scenario requirements (including but not limited to the implementation methods provided by the present application), and the embodiments do not limit which implementation method to choose.
[0080] Embodiment 4:
[0081] Based on Embodiment 1, Embodiment 4 sets a threshold value for the length of the path cache queue. Based on this, Embodiment 4 provides a new implementation method for distributing basic routing data particles to paths that is different from Embodiment 3.
[0082] Implementation method 5: Set a length threshold value for the cache queue of the path. When the data packet count threshold value is relatively small, that is, when the data packet count threshold value is compared with the cache queue length threshold value, as Figure 4 shown, if the ratio is less than 1 / 10, the random fluctuations between the cache queue lengths of each path are relatively small, and a random distribution algorithm can be selected, that is, the basic routing data particles are randomly distributed to all equivalent path queues.
[0083] That is, as a specific implementation method, the embodiments of the present application specifically allocate a target path for each basic routing data particle in the following way: when the ratio of the data packet count threshold value to the cache queue length threshold value is less than a preset threshold value, a path is randomly selected from the multiple equivalent paths as the target path of the basic routing data particle.
[0084] Implementation method 6: Set two length threshold values for the cache queue of the path, denoted as threshold value A1 and threshold value A2 respectively, where A1 is less than A2. Each level of nodes of all equivalent paths can maintain two threshold values, as Figure 5As shown in the figure, when the cache queue length of a certain path of the current-level node is lower than the threshold A1, more data packet traffic will be allocated. When the cache queue lengths of all paths are lower than the threshold A1, congestion identification information is fed back to the upper-level node, and the upper-level node then allocates more data packet traffic to the paths where the current-level node is located according to the congestion identification information. Similarly, when the cache queue length of a certain path of the current-level node is higher than the threshold A2, the data packet traffic allocation will be reduced until the cache queue length drops below the threshold A2. At the same time, when the cache queue lengths of all paths exceed the threshold A2, congestion identification information is fed back to the upper-level node to notify the upper-level node that congestion will occur at the current-level node, and the upper-level node then reduces the data packet traffic allocated to the paths where the current-level node is located according to the congestion identification information.
[0085] That is, the embodiments of the present application can perform traffic load distribution by sensing the congestion identification information fed back by the lower-level nodes. As a specific implementation method, with the current-level node as the execution entity, the embodiments of the present application specifically allocate target paths for each basic routing data particle in the following manner:
[0086] When receiving the first congestion identification sent by the lower-level node, select the path where the lower-level node is located as the target path of the basic routing data particle; when receiving the second congestion identification sent by the lower-level node, select the path where the lower-level node is not located as the target path of the basic routing data particle. Among them, the first congestion identification is sent by the lower-level node when the cache queue lengths of all paths where it is located are less than the first threshold, and the second congestion identification is sent by the lower-level node when the cache queue lengths of all paths where it is located are greater than the second threshold, and the second threshold is greater than the first threshold.
[0087] Specifically, the above congestion identification information can be notified to the upper-level node through in-band or out-of-band methods. In the in-band method, the congestion identification information is embedded in the transport layer or network layer header of the return data packet sent to the upper-level node to explicitly notify the upper-level node; in the out-of-band method, a specially designed data packet format is used to explicitly notify the upper-level node.
[0088] In summary, through the threshold values of the cache queue length, the embodiments of the present application can control the queuing delay and jitter of each path node, and thus provide a new controllable dimension and approach for the path control and optimization of each node. And through the design method of double threshold values, the queuing time of data packets at this node can be controlled between the threshold A1 and the threshold A2 as much as possible, and the positions of the threshold A1 and the threshold A2 can be flexibly adjusted, providing a new controllable dimension for the load balancing system.
[0089] Based on the same inventive concept, the present application also provides a load balancing device, and its structural schematic diagram is as Figure 6 shown, specifically including:
[0090] A data flow division module 610, configured to divide the data packets in the incoming traffic into multiple data flows according to the metadata of the data packets;
[0091] A routing granule division module 620, configured to divide the data packets in each of the data flows into basic routing data granules according to a data packet count threshold;
[0092] A path allocation module 630, configured to allocate a target path for each of the basic routing data granules from multiple equivalent paths, and send the basic routing data granules to the cache queue of the target path.
[0093] As a specific implementation manner, the routing granule division module 620 specifically divides the data packets in each data flow into basic routing data granules according to the following method:
[0094] Determine the target service type of the current data flow according to the metadata of the data packet; read the target data packet count threshold pre-configured for the target service type; divide the data packets in the current data flow into basic routing data granules according to the target data packet count threshold.
[0095] As a specific implementation manner, the apparatus further includes:
[0096] A configuration module, configured to configure the data packet count threshold according to the following method:
[0097] Configure the data packet count threshold according to the statistical result of the data packet quantity of the historical data flow; or, monitor the link bandwidth utilization rate of the data packet count threshold under different configuration results, and configure the data packet count threshold according to the monitoring result; or, configure the data packet count threshold according to the current system time and the threshold configuration strategy of different time periods set in advance; or, configure the data packet count threshold according to the local congestion parameter fed back by the downstream node; or, configure the data packet count threshold according to the global congestion parameter fed back by the global congestion controller.
[0098] As a specific implementation manner, the path allocation module 630 specifically allocates a target path for each basic routing data granule according to the following method:
[0099] When the ratio of the data packet count threshold to the cache queue length threshold is less than a preset threshold, randomly select one path from the multiple equivalent paths as the target path of the basic routing data particle; or, select the path with the shortest cache queue length from the multiple equivalent paths as the target path of the basic routing data particle; or, select the path with the largest remaining link bandwidth from the multiple equivalent paths as the target path of the basic routing data particle; or, for the current basic routing data particle, select the path with the cache queue length closest to the cache queue where the previous basic routing data particle is located from the multiple equivalent paths as the target path of the current basic routing data particle, where the previous basic routing data particle refers to the basic routing data particle that belongs to the same data stream as the current basic routing data particle and whose allocation order is only earlier than that of the current basic routing data particle.
[0100] As a specific implementation manner, the path allocation module 630 specifically allocates a target path for each basic routing data particle in the following manner:
[0101] When receiving the first congestion identifier sent by the lower-level node, select the path where the lower-level node is located as the target path of the basic routing data particle; when receiving the second congestion identifier sent by the lower-level node, select the path where the lower-level node is not located as the target path of the basic routing data particle;
[0102] Wherein, the first congestion identifier is sent by the lower-level node when the cache queue lengths of all paths where the lower-level node is located are less than the first threshold, and the second congestion identifier is sent by the lower-level node when the cache queue lengths of all paths where the lower-level node is located are greater than the second threshold, and the second threshold is greater than the first threshold.
[0103] An embodiment of the present application provides an electronic device, which may include: a memory and one or more processors. The memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device can execute each function or step of the above method embodiment.
[0104] The structure of this electronic device can refer to Figure 7 the structure of the electronic device 100 shown.
[0105] The above-mentioned processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0106] The embodiments of the present application also provide a computer-readable storage medium, which includes computer instructions. When the computer instructions run on an electronic device, the electronic device is enabled to execute each function or step of the above method embodiments.
[0107] The above-mentioned computer-readable storage medium includes, but is not limited to, any of the following: USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs, etc., all kinds of media that can store program codes.
[0108] The embodiments of the present application also provide a computer program product. When the computer program product runs on a computer, the computer is enabled to execute each function or step of the above method embodiments.
[0109] Among them, the electronic device, computer-readable storage medium, and computer program product provided by the embodiments of the present application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be elaborated here.
[0110] Through the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and simplicity of description, only the above division of each functional module is used as an example. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
[0111] In several embodiments provided by the present application, it should be understood that the disclosed method can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces, and the indirect coupling or communication connection of the modules or units can be in an electrical, mechanical or other form.
[0112] In addition, each functional unit in various embodiments of the present application can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0113] As described above, the above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A load balancing method, characterized in that, The method includes: Dividing the data packets in the ingress traffic into multiple data streams according to the metadata of the data packets; Dividing the data packets within each of the data streams into basic routing data granules according to a data packet count threshold value; Allocating a target path for each of the basic routing data granules from multiple equivalent paths, and sending the basic routing data granules to the cache queue of the target path.
2. The method according to claim 1, characterized in that, Specifically, the method divides the data packets within each data stream into basic routing data granules in the following manner: Determining the target service type of the current data stream according to the metadata of the data packet; Reading the target data packet count threshold value pre-configured for the target service type; Dividing the data packets within the current data stream into basic routing data granules according to the target data packet count threshold value.
3. The method according to claim 1, characterized in that, The method further includes: Configuring the data packet count threshold value in the following manner: Configuring the data packet count threshold value according to the statistical result of the data packet quantity of the historical data stream; Or, monitoring the link bandwidth utilization rate under different configuration results of the data packet count threshold value, and configuring the data packet count threshold value according to the monitoring result; Or, configuring the data packet count threshold value according to the current time of the system and the threshold value configuration policy for different time periods set in advance; Or, configuring the data packet count threshold value according to the local congestion parameter fed back by the downstream node; Or, configuring the data packet count threshold value according to the global congestion parameter fed back by the global congestion controller.
4. The method according to claim 1, wherein Specifically, the method allocates a target path for each basic routing data granule in the following manner: When the ratio of the data packet count threshold value to the cache queue length threshold value is less than a preset threshold, randomly selecting a path from the multiple equivalent paths as the target path of the basic routing data granule; Or, selecting the path with the shortest cache queue length from the multiple equivalent paths as the target path of the basic routing data granule; Or, selecting the path with the largest remaining link bandwidth from the multiple equivalent paths as the target path of the basic routing data granule; Or, for the current basic routing data granule, selecting the path whose cache queue length is closest to the cache queue where the previous basic routing data granule is located from the multiple equivalent paths as the target path of the current basic routing data granule, where the previous basic routing data granule refers to the basic routing data granule that belongs to the same data stream as the current basic routing data granule and whose allocation order is only earlier than that of the current basic routing data granule.
5. The method according to claim 1, wherein Specifically, the method allocates a target path for each basic routing data granule in the following manner: When receiving a first congestion identifier sent by a downstream node, selecting the path where the downstream node is located as the target path of the basic routing data granule; When receiving a second congestion identifier sent by a downstream node, selecting the path where the downstream node is not located as the target path of the basic routing data granule; Among them, the first congestion identifier is sent by a lower-level node when the cache queue lengths of all paths where the lower-level node is located are all less than a first threshold value, and the second congestion identifier is sent by the lower-level node when the cache queue lengths of all paths where the lower-level node is located are all greater than a second threshold value, and the second threshold value is greater than the first threshold value.
6. A load balancing device, characterized in that, The device includes: A data flow division module, configured to divide the data packets in the incoming traffic into multiple data flows according to the metadata of the data packets; A routing particle division module, configured to divide the data packets in each of the data flows into basic routing data particles according to a data packet count threshold value; A path allocation module, configured to allocate a target path for each of the basic routing data particles from multiple equivalent paths, and send the basic routing data particles to the cache queue of the target path.
7. The device according to claim 6, characterized in that, The routing particle division module specifically divides the data packets in each data flow into basic routing data particles according to the following method: Determine the target service type of the current data flow according to the metadata of the data packet; read the target data packet count threshold value pre-configured for the target service type; divide the data packets in the current data flow into basic routing data particles according to the target data packet count threshold value.
8. The device according to claim 6, characterized in that, The path allocation module specifically allocates a target path for each basic routing data particle according to the following method: When receiving the first congestion identifier sent by a lower-level node, select the path where the lower-level node is located as the target path of the basic routing data particle; When receiving the second congestion identifier sent by a lower-level node, select the path where the lower-level node is not located as the target path of the basic routing data particle; Among them, the first congestion identifier is sent by a lower-level node when the cache queue lengths of all paths where the lower-level node is located are all less than a first threshold value, and the second congestion identifier is sent by the lower-level node when the cache queue lengths of all paths where the lower-level node is located are all greater than a second threshold value, and the second threshold value is greater than the first threshold value.
9. An electronic device, characterized in that, It includes: A memory and one or more processors; the memory is coupled to the processor; among them, computer program code is stored in the memory, and the computer program code includes computer instructions. When the computer instructions are executed by the processor, the electronic device executes the method described in any one of claims 1-5.
10. A computer-readable storage medium, comprising computer instructions, characterized in that, When the computer instructions run on an electronic device, the electronic device is caused to execute the method described in any one of claims 1-5.
11. A computer program product, characterized in that, When the computer program product runs on a computer, the computer is caused to execute the method described in any one of claims 1-5.