Traffic load balancing method and apparatus, electronic device, storage medium, and product
By setting the aging time of forwarding record entries and calculating the available bandwidth of the port, the problem of inaccurate load balancing in traditional solutions is solved, achieving efficient load balancing in AI large model training, avoiding network congestion, and improving resource matching efficiency.
Patent Information
- Application Number
- CN202411425364.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-12
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2044-10-12
AI Technical Summary
In AI large-scale model training scenarios, traditional dynamic load balancing solutions struggle to accurately identify port traffic load, making load balancing difficult and leading to network congestion.
By setting the aging time of forwarding record entries to cover one iteration cycle of AI large model training, and combining the physical bandwidth of the outgoing port, real-time occupied bandwidth, and reserved bandwidth to calculate the available bandwidth, the target outgoing port with the largest available bandwidth is selected to forward packets, avoiding the need to measure port bandwidth and queue size in real time, thus improving the accuracy of load balancing.
It improves the accuracy of load balancing, avoids network congestion, and enhances the overall efficiency of resource matching for business flows.
Smart Images

Figure CN119299384B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a traffic load balancing method, apparatus, electronic device, storage medium, and product. Background Technology
[0002] In the field of deep learning, there is usually a network plane used for synchronizing the gradients of AI (Artificial Intelligence) model parameters, called the parameter plane or computation plane. The Spine-Leaf architecture is a commonly used network architecture for this plane. Ensemble communication algorithms are commonly used for parameter gradient synchronization. In the specific implementation of ensemble communication, to avoid multiple-for-one communication (i.e., repeatedly sending the same data packets), the algorithm is usually implemented such that one device sends data to only one device at a time, and one device receives data from only another device.
[0003] However, in the scenario of training large AI models, the training data stream of the same large AI model has characteristics such as time gaps of different sizes and bursts of full bandwidth. Traditional dynamic load balancing solutions are difficult to accurately identify the traffic load of ports, making it difficult to achieve load balancing for training large AI models. Summary of the Invention
[0004] This invention provides a traffic load balancing method, apparatus, electronic device, storage medium, and product to address the shortcomings of existing technologies in AI large-scale model training scenarios, where traditional dynamic load balancing schemes struggle to accurately identify port traffic load, leading to difficulties in achieving load balancing for AI large-scale model training. This invention achieves accurate measurement of traffic load, improves load balancing performance, and enhances the efficiency of resource matching for overall business flows.
[0005] This invention provides a traffic load balancing method applied to network devices in parametric plane networks used for training large AI models. The method includes:
[0006] Receive a message; the message carries the stream identifier of the AI large model training data stream to which it belongs;
[0007] If the flow identifier or the corresponding outgoing port is not found in the forwarding record table, the target outgoing port with the largest available bandwidth is selected from the outgoing ports that meet the transmission conditions of the data flow to forward the packet, so as to achieve traffic load balancing of the outgoing ports.
[0008] The aging time of the forwarding record entries is set to cover one iteration cycle of the training of the AI large model.
[0009] According to a traffic load balancing method provided by the present invention, the step of selecting a target outgoing port with the largest available bandwidth from outgoing ports that meet the transmission conditions of the data flow for forwarding the packet includes:
[0010] For each output port that meets the transmission conditions of the data stream, the available bandwidth of the output port is calculated based on the physical bandwidth, real-time occupied bandwidth, and reserved bandwidth of the output port.
[0011] Based on the available bandwidth of each outgoing port, the target outgoing port with the largest available bandwidth is selected to forward the message.
[0012] According to a traffic load balancing method provided by the present invention, the real-time occupied bandwidth of the output port is the transmission requirement bandwidth of at least one data stream being transmitted after matching the output port, and the reserved bandwidth of the output port is the transmission requirement bandwidth of at least one data stream to be transmitted after matching the output port.
[0013] According to a traffic load balancing method provided by the present invention, the flow information of any data flow in the forwarding record table includes a reception timestamp, wherein the reception timestamp is the latest timestamp of receiving a packet belonging to the data flow; the method further includes:
[0014] Based on the receiving timestamp of any data stream in the forwarding record table, the message transmission status of any data stream is determined;
[0015] If no packet of any of the data streams is received after the preset aging time, the data stream is determined to be an inactive data stream, and the stream information of the data stream in the forwarding record table is deleted.
[0016] According to a traffic load balancing method provided by the present invention, the method further includes:
[0017] If a message from any of the data streams is received within a preset active time period, then the data stream is determined to be an active data stream, and the reserved bandwidth of the output port matching the data stream is increased.
[0018] Wherein, the preset active time is less than the preset aging time.
[0019] According to a traffic load balancing method provided by the present invention, the flow identifier includes at least a source port and a destination port; after receiving the message, it further includes:
[0020] At least one message from the same source port is identified as the same data stream, and at least one message destined for the same destination port is identified as the same data stream.
[0021] The present invention also provides a traffic load balancing device, comprising:
[0022] A receiving module is used to receive messages; the messages carry the stream identifier of the AI large model training data stream to which they belong.
[0023] The selection module is used to forward the packet from the output ports that meet the transmission conditions of the data flow if the flow identifier or the output port corresponding to the flow identifier is not found in the forwarding record table, so as to achieve traffic load balancing of the output ports.
[0024] The aging time of the forwarding record entries is set to cover one iteration cycle of the training of the AI large model.
[0025] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the traffic load balancing method as described above.
[0026] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the traffic load balancing method as described above.
[0027] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the traffic load balancing method as described above.
[0028] The traffic load balancing method, apparatus, electronic device, storage medium, and product provided by this invention, by setting a longer aging time for forwarding table entries to cover a complete iteration cycle of AI large-scale model training, eliminates the need to segment data streams by time intervals, thus avoiding the difficulty in selecting time intervals for data stream segmentation. By selecting the target outgoing port with the largest available bandwidth from the outgoing ports that meet the data stream transmission conditions for forwarding packets, the appropriate port for forwarding data streams can be selected based on the actual available bandwidth of the outgoing port, rather than measuring the port bandwidth and queue size in real time. This improves the accuracy of load measurement and enhances the load balancing effect, thereby avoiding network congestion caused by unbalanced traffic load during AI large-scale model training due to incorrect outgoing port matching, and ultimately improving the efficiency of resource matching for the overall business flow. Attached Figure Description
[0029] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0030] Figure 1 This is a schematic diagram of a Spine-Leaf network structure in existing technology.
[0031] Figure 2 This is a schematic diagram of traffic imbalance among multiple spines in existing technology.
[0032] Figure 3 This is a schematic diagram of the dynamic load balancing process in existing technologies.
[0033] Figure 4 This is the second flowchart of the traffic load balancing method provided in the embodiments of the present invention.
[0034] Figure 5 This is a schematic diagram of the time interval of the AI large model training data stream provided in the embodiment of the present invention.
[0035] Figure 6 This is a schematic diagram of the format of the forwarding record table provided in an embodiment of the present invention.
[0036] Figure 7 This is a schematic diagram of the process for processing based on data flow activity provided in an embodiment of the present invention.
[0037] Figure 8 This is the second flowchart of the traffic load balancing method provided in the embodiments of the present invention.
[0038] Figure 9 This is a schematic diagram of the traffic load balancing device provided in an embodiment of the present invention.
[0039] Figure 10 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0040] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0041] Reference Figure 1 , Figure 1 This is a schematic diagram of a Spine-Leaf network structure in existing technology.
[0042] In a Spine-Leaf network architecture, a Leaf switch and a Spine switch can be connected by multiple physical links, and a Leaf can also be connected to multiple Spines simultaneously. These physical links can use ECMP (Equal-cost multi-path routing) for load balancing and routing. ECMP can use various hash algorithms to hash the data stream, thereby distributing the data stream to different links. However, it often happens that two data streams are hashed to the same physical link. This can occur on multiple uplinks from the same Leaf to the same Spine, i.e., [a specific event occurs]. Figure 1 Leaf hash imbalance can occur; similarly, it can happen on multiple downlinks from the same Spine to the same Leaf, i.e., it can occur... Figure 1 The problem lies in the uneven distribution of Spine hashes. Another type of traffic imbalance occurs when multiple tasks run concurrently, leading to uneven traffic distribution among multiple Spines.
[0043] ① Leaf hash imbalance is caused by the information in the data stream and the hashing mechanism of the Leaf switch. ② Spine hash imbalance is caused by the information in the data stream and the hashing mechanism of the Spine switch. ③ Traffic imbalance between multiple Spines is caused by upstream data streams from multiple Leaves flowing to the same Spine, leading to collisions when the Spine data streams flow downstream.
[0044] ①Leaf hash collisions and ②Spine hash collisions can be like... Figure 1 As shown, when there are multiple physical links between the same Leaf1 and the same Spine1, the data flow routing is unbalanced.
[0045] Reference Figure 2 , Figure 2 This is a schematic diagram of traffic imbalance among multiple spines in existing technology.
[0046] Assume each Leaf switch has 4 downlink interfaces connecting 4 servers and 4 uplink interfaces connecting 2 Spine switches. Each Spine switch connects to 2 physical links. Assume a balanced traffic distribution algorithm is used, ensuring that the traffic from the 4 servers on Leaf1 is evenly distributed across the 4 uplink physical links. Data streams from server L1S1 are distributed to Spine1 via the Leaf1-Spine1-1 physical link between Leaf1 and Spine1; data streams from server L1S2 are distributed to Spine1 via the Leaf1-Spine1-2 physical link between Leaf1 and Spine1; data streams from server L1S3 are distributed to Spine2 via the Leaf1-Spine2-1 physical link between Leaf1 and Spine2; and data streams from server L1S4 are distributed to Spine2 via the Leaf1-Spine2-2 physical link between Leaf1 and Spine2. Data streams originating from server L4S1 are distributed to Spine1 via the physical link Leaf4-Spine1-1 between Leaf4 and Spine1. Data streams originating from server L4S2 are distributed to Spine1 via the physical link Leaf4-Spine1-2 between Leaf4 and Spine1. Data streams originating from server L4S3 are distributed to Spine1 via the physical link Leaf4-Spine2-1 between Leaf4 and Spine2. Data streams originating from server L4S4 are distributed to Spine2 via the physical link Leaf4-Spine2-2 between Leaf4 and Spine2. Uplink traffic distribution for other Leaves follows the same rules. Downlink data streams from Spine1 to L1S1 and L1S3 are distributed to the physical link Leaf1-Spine1-1 between Leaf1 and Spine1. Downlink data streams from Spine1 to L1S2 and L1S4 are distributed to the physical link Leaf1-Spine1-2 between Leaf1 and Spine1. Downlink data flows from Spine2 to L1S1 and L1S3 are distributed to the physical link Leaf1-Spine2-1 between Leaf1 and Spine2. Downlink data flows from Spine2 to L1S2 and L1S4 are distributed to the physical link Leaf1-Spine2-2 between Leaf1 and Spine2. Other downlink data flows follow the same distribution rules.
[0047] At this point, there are no ①Leaf hash collisions or ②Spine hash collisions. However, in a multi-task concurrent scenario, there is ③ uneven traffic distribution among multiple spines. For example, in... Figure 2In this diagram, line m represents one task, and line n represents another task. Servers participating in task m include L1S1, L1S2, L2S1, and L2S2, while servers participating in task n include L4S1, L4S3, L2S3, and L2S4. In task n, L1S1 sends data streams to L2S1, and L1S2 sends data streams to L2S2. Simultaneously, in task m, L4S1 sends data streams to L2S3, and L4S2 sends data streams to L2S4. According to the above distribution rules, all four data streams are distributed to Spine1, with the destination Leaf switch being Leaf2. However, Spine1 and Leaf2 only have two physical links, inevitably leading to traffic conflicts. This is termed ③, traffic imbalance among multiple Spines.
[0048] Reference Figure 3 , Figure 3 This is a schematic diagram of the dynamic load balancing process in existing technology. Traditional dynamic load balancing schemes can dynamically measure the load of each port. When a new data stream arrives, it can select the port with the lighter load to send the new data stream based on the load measurement results.
[0049] However, traditional dynamic load balancing solutions have the following problems:
[0050] 1) Queue length and port bandwidth load are instantaneous and dynamic processes. Different measurement time windows and different business traffic models will lead to different measurement results, making it difficult to measure the true port load.
[0051] 2) Traffic conflicts generate PFC (Priority-based Flow Control), which in turn creates message time intervals. Multiple conflicting data streams time out and reroute within a short period of time, which can easily lead to new conflicts.
[0052] 3) When the time interval between messages is set too long, rerouting cannot be triggered, resulting in an effect similar to static routing. When the time interval is set too short, routing lacks memory and is prone to triggering rerouting, leading to a new congestion routing cycle.
[0053] 4) In the training scenario of large AI models, the iteration cycle is long, and each iteration requires re-selecting routes and repeating the traffic conflict process of the previous iteration.
[0054] To address the aforementioned issues, this invention extends the aging time of forwarding entries to cover a complete iteration cycle of AI large-scale model training. This eliminates the need to segment data streams by time intervals, avoiding the difficulty in selecting appropriate time intervals for data stream segmentation. By selecting the target outgoing port with the largest available bandwidth from among the outgoing ports that meet the data stream transmission conditions for forwarding packets, the appropriate port for forwarding data streams can be selected based on the actual available bandwidth of the outgoing port, rather than measuring port bandwidth and queue size in real time. This improves the accuracy of load measurement, thereby enhancing load balancing and preventing network congestion caused by unbalanced traffic load during AI large-scale model training due to incorrect outgoing port matching. Ultimately, this improves the overall efficiency of resource matching for service flows.
[0055] Figure 4 This is the second flowchart illustrating the traffic load balancing method provided in this embodiment of the invention. (Refer to...) Figure 4 This invention provides a traffic load balancing method, which may specifically include the following steps:
[0056] Step 401: Receive a message; the message carries the stream identifier of the AI large model training data stream to which it belongs.
[0057] It should be noted that the execution entity of the traffic load balancing method provided in this embodiment of the invention can be a network device in a parametric plane network used for AI model training, serving as a dynamic load-sharing feature of equal-cost paths or aggregated links. The network device can refer to a network interface card (NIC), a switch (which may include leaf or spine switches), etc.
[0058] After receiving a packet, network devices can identify the flow identification information of the AI large-scale model training data stream carried in the packet. The flow identification information may include the data stream ID (Identity document), outgoing port, source IP (Internet Protocol), destination IP, source port, destination port, protocol number, etc.
[0059] Step 402: If the flow identifier or the corresponding outgoing port of the flow identifier is not found in the forwarding record table, the target outgoing port with the largest available bandwidth is selected from the outgoing ports that meet the transmission conditions of the data flow to forward the packet, so as to achieve traffic load balancing of the outgoing ports; wherein, the aging time of the forwarding record table entry is set to cover one iteration cycle of the training of the AI large model.
[0060] A forwarding record table can refer to a data table used to record forwarding information of AI large-scale model training data streams forwarded by network devices. The forwarding record table can contain multiple forwarding record entries, each corresponding to a row in the table. A row in the forwarding record table can record all flow information for the same data stream. Specifically, the first column of the forwarding record table can record the flow identifiers of different data streams, and the second column can record the output port matched by each data stream. In some embodiments, the forwarding record information can also be recorded using a database; this invention does not impose specific limitations on the recording format of the forwarding record information.
[0061] In the forwarding record table, the absence of a flow identifier for a data flow indicates that the data flow has not been forwarded, meaning it is a new data flow. Conversely, if the forwarding record table includes a flow identifier but not the egress port of the data flow, it indicates that the data flow has been forwarded, meaning it is an old data flow. However, the matching egress port for the data flow was not recorded, or the recorded egress port was lost or deleted. This embodiment of the invention can accurately determine whether a large AI model training data flow matches an egress port through the forwarding record table, and it further refines the two cases of data flows without a matching egress port, considering not only the case of a new data flow without a matching egress port but also the case of an old data flow without a matching egress port.
[0062] In this embodiment of the invention, after identifying the flow identifier information of the AI large model training data stream carried in the message, the flow identifier of the data stream can be queried in the forwarding record table, and the result of the query can be used to determine whether the AI large model training data stream matches the outgoing port.
[0063] If the forwarding record table includes the egress port corresponding to the flow identifier of the data flow, it means that the data flow has matched an egress port, and any packet of the data flow can be forwarded through the recorded egress port. If the forwarding record table does not include the flow identifier of the data flow, or if the forwarding record table includes the flow identifier of the data flow but does not include the corresponding egress port, it means that the AI large model training data flow has not matched an egress port. In this case, the target egress port with the largest available bandwidth can be selected from the egress ports that meet the transmission conditions of the data flow to forward the packet, and the flow identifier of the data flow and the matched target egress port are recorded in the forwarding record table, thereby realizing real-time updates of the forwarding record table based on the traffic matching results.
[0064] In this embodiment of the invention, an output port can be matched for the data stream based on the available bandwidth of at least one output port that satisfies the transmission conditions of the data stream. The transmission conditions can be considered in two ways: first, bandwidth, and second, latency. For example, the transmission condition can be set to the maximum available bandwidth, or the transmission condition can be that the available bandwidth is greater than the maximum bandwidth required to transmit the data stream. Alternatively, the transmission condition can be set to the shortest latency, or other user-defined transmission conditions. The transmission conditions can be set according to the user's needs.
[0065] In some embodiments, if latency information is used as a transmission condition, the latency information of the last transmission to the next hop can be recorded for each outgoing port in the forwarding record table. When making port matching, the outgoing port with the shortest latency can be used as the matching target.
[0066] In this embodiment of the invention, the available bandwidth of a port can be the bandwidth of the output port minus the bandwidth of all ingress ports of the data streams flowing to the output port. If multiple data streams with the same ingress port flow to the output port, the bandwidth of the ingress port can be deducted from the available bandwidth of the output port only once, without repeated deduction.
[0067] Since the available bandwidth of any output port is determined by the traffic matching result of the output port, and the actual available bandwidth of any output port also changes with the traffic matching result, that is, the traffic matching result determines the traffic transmitted through any output port, the determination time of available bandwidth will not be delayed compared with the actual change time of available bandwidth. Compared with the method of actually measuring available bandwidth by the amount of data transmitted within a time window, the embodiments of the present invention improve the accuracy of available bandwidth, thereby improving the accuracy of determining the output port whose available bandwidth meets the transmission conditions, and avoiding network congestion caused by incorrect matching of output ports.
[0068] In this embodiment of the invention, after determining the target outgoing port with the largest available bandwidth, the packet can be forwarded through that target outgoing port. Subsequently, when a packet belonging to the training data stream of the AI large model is received, the packet can be directly forwarded through that outgoing port.
[0069] In some embodiments, the resource usage of each outgoing port can also be recorded in the network device as a basis for matching the port with subsequent new data streams, eliminating the need to recalculate the used information of the outgoing port each time and improving efficiency.
[0070] Figure 5 This is a schematic diagram of the time intervals of the AI large model training data stream provided in an embodiment of the present invention. (Refer to...) Figure 5AI large model training data streams can have the following characteristics: (1) Periodicity, each iteration is a large cycle; (2) Data streams have time gaps, there are large time gaps between iteration cycles, and small time gaps between multiple group communications within the iteration cycle and between steps within the group communication; (3) Few data streams, the number of data streams at the same time is less than or equal to the number of physical links; (4) At the same time, there is only one data stream at an inlet port, and it is a full-load burst; (5) Balanced data streams, the traffic of different data streams is basically the same.
[0071] In the context of training large AI models, the same data stream may have time gaps of varying sizes and bursts of full bandwidth. This invention does not divide the data stream by time intervals. Instead, by setting a longer preset aging time for forwarding entries to cover a complete iteration cycle of training large AI models, the problem of selecting time intervals for dividing data streams in the prior art can be avoided.
[0072] This invention, by setting a longer aging time for forwarding entries to cover a complete iteration cycle of AI large-scale model training, eliminates the need to segment data streams by time intervals, thus avoiding the difficulty in selecting time intervals for data stream segmentation. By selecting the target outgoing port with the largest available bandwidth from the outgoing ports that meet the data stream transmission conditions for forwarding packets, the appropriate port for forwarding data streams can be selected based on the actual available bandwidth of the outgoing port, rather than measuring the port bandwidth and queue size in real time. This improves the accuracy of load measurement, thereby enhancing load balancing and preventing network congestion caused by unbalanced traffic load during AI large-scale model training due to incorrect outgoing port matching. Ultimately, this improves the efficiency of resource matching for the overall business flow.
[0073] Based on any of the above embodiments, selecting the target outgoing port with the largest available bandwidth from the outgoing ports that meet the transmission conditions of the data stream for forwarding the packet may specifically include:
[0074] Step S11: For each output port that meets the transmission conditions of the data stream, calculate the available bandwidth of the output port based on the physical bandwidth, real-time occupied bandwidth and reserved bandwidth of the output port.
[0075] Step S12: Based on the available bandwidth of each output port, select the target output port with the largest available bandwidth to forward the packet.
[0076] Specifically, the target output port P can be calculated using the following formula. D Available bandwidth:
[0077] B D =MAX(B Physical -B 实时占用带宽 -B 预留带宽 );
[0078] Among them, B D B represents the actual bandwidth of the target outgoing port. Physical For physical bandwidth, B 实时占用带宽 To occupy bandwidth in real time, B 预留带宽 To reserve bandwidth.
[0079] In this embodiment of the invention, after calculating the available bandwidth of each output port, the target output port with the largest available bandwidth can be selected, and the message can be forwarded through the target output port.
[0080] This invention calculates available bandwidth based on the physical bandwidth, real-time occupied bandwidth, and reserved bandwidth of the outgoing port. It then selects port resources for the data flow based on the actual remaining bandwidth of the outgoing port. This method can accurately and stably measure the load of each port, select the most suitable port for the data flow, avoid network congestion caused by unbalanced load, and improve the efficiency of resource matching for the overall service flow.
[0081] Based on any of the above embodiments, the real-time occupied bandwidth of the output port is the transmission requirement bandwidth of at least one data stream being transmitted after being matched with the output port, and the reserved bandwidth of the output port is the transmission requirement bandwidth of at least one data stream to be transmitted after being matched with the output port.
[0082] The available bandwidth of any outgoing port can be determined based on the traffic matching result of the outgoing port. The traffic matching result of any outgoing port can indicate whether the outgoing port has matched a data flow, and if any outgoing port matches a data flow, the traffic matching result also indicates the transmission bandwidth requirement of at least one other data flow that matches the outgoing port. This at least one other data flow can include the data flow that is being transmitted after matching and the data flow that has been matched but is not being transmitted.
[0083] In this embodiment of the invention, the real-time occupied bandwidth of the output port is the transmission bandwidth required by at least one data stream currently being transmitted after being matched with the output port, and the reserved bandwidth of the output port is the transmission bandwidth required by at least one data stream to be transmitted after being matched with the output port. The available bandwidth of the output port can be obtained by subtracting the bandwidth occupied by other data streams that have already occupied the output port (including occupied and used, and occupied but not used) from the maximum bandwidth (physical bandwidth) of the output port.
[0084] Based on any of the above embodiments, the flow information of any data stream in the forwarding record table includes a reception timestamp, wherein the reception timestamp is the latest timestamp of receiving a packet belonging to the data stream; the method may further include:
[0085] Step S21: Based on the receiving timestamp of any data stream in the forwarding record table, determine the message transmission status of any data stream;
[0086] Step S22: If no message of any data stream is received after a preset aging time, the data stream is determined to be an inactive data stream, and the stream information of the data stream in the forwarding record table is deleted.
[0087] Figure 6 This is a schematic diagram of the format of the forwarding record table provided in an embodiment of the present invention. (Refer to...) Figure 6 In addition to the flow identifier and the outgoing port, the flow information of any data flow in the forwarding record table may also include a receive timestamp. The receive timestamp can be used to indicate the time when a message belonging to any data flow was received after the previous receive timestamp. That is, the receive timestamp of any data flow is the latest timestamp of receiving a message belonging to that data flow.
[0088] In this embodiment of the invention, the message transmission status of any data stream can be determined based on the received timestamp of any data stream. If no message of any data stream is received after a preset aging time, it can be determined that any data stream is an inactive data stream. In this case, in order to save storage space and maintain efficient forwarding record information, the stream information of the data stream can be deleted to ensure the validity of the forwarding record information.
[0089] Over time, some data flows may become active while others may become inactive. This invention, through an aging time mechanism, allows network devices to dynamically adjust the forwarding record information in their forwarding record tables, retaining only information on currently active or important data flows, thereby improving the performance and efficiency of network devices.
[0090] In some embodiments, users can configure a preset aging time based on actual network conditions. If no packet belonging to any data flow is received within the aging time, the flow information for that data flow can be deleted from the forwarding record table. The aging time can indicate the maximum time interval between two adjacent packets in any data flow. If no packet for that data flow is received after the aging time has elapsed, the data flow is considered to be inactive.
[0091] As an example, for any periodically transmitted data stream, the aging time can be longer than the transmission period of that data stream. A periodically transmitted data stream is one that is sent periodically at regular intervals; that is, the same data stream is sent once every certain period. In this approach, having an aging time longer than the transmission period allows the periodically transmitted data stream to be forwarded directly based on the outgoing port recorded in the forwarding record table, without needing to re-match the outgoing port, thus reducing the resources consumed by matching the outgoing port.
[0092] By setting an aging time longer than the transmission period, it can be ensured that the flow information related to the data flow is still retained in the forwarding record table even when the data flow is temporarily inactive. When the data flow becomes active again, the network device can quickly re-identify and match the outgoing port of the data flow without reconfiguration or learning. In practical applications, the aging time can be adjusted according to the network device's performance, storage limitations, or other factors. It should be noted that too short an aging time may lead to frequent record updates and storage overhead, while too long an aging time may lead to wasted storage space or unnecessary matching delays.
[0093] Based on any of the above embodiments, the method may further include: if a message of any data stream is received within a preset active time, then the any data stream is determined to be an active data stream, and the reserved bandwidth of the outgoing port matching the any data stream is increased; wherein the preset active time is less than the preset aging time.
[0094] In this embodiment of the invention, the activity level of each data stream can be calculated using timestamp information, the stream information of long-term inactive data streams can be deleted, and bandwidth configuration can be increased for highly active data streams.
[0095] Figure 7 This is a schematic diagram of the process for processing based on data stream activity provided in an embodiment of the present invention. (Refer to...) Figure 7 Users can set two standard time thresholds for judging active data streams: active time T. min and aging time T max After receiving a packet, the network device can calculate the interval T of the data stream by analyzing the timestamp information of the data stream carried in the packet and the timestamp information of the data stream in the forwarding record table. △ The activity level of the data stream is determined based on the time interval.
[0096] If the interval time T △ <Active Time T min If so, the data stream is determined to be an active data stream, and the reserved bandwidth of the outgoing port matching the data stream is increased, for example, an additional 20% bandwidth can be reserved and allocated.
[0097] If the active time T min <T △ <Aging time T max If so, the data stream is determined to be a data stream with normal activity, and bandwidth is reserved at the output port according to normal requirements.
[0098] If the active time T △ >Aging time T maxIf so, the data stream is determined to be an inactive data stream and can be aged out, and the stream information of the data stream is deleted from the forwarding record table.
[0099] The embodiments of the present invention can identify cold services through an aging process, thereby releasing hardware resources. In scenarios with a large number of cold services, resource utilization can be greatly improved.
[0100] Based on any of the above embodiments, the flow identifier includes at least a source port and a destination port; after receiving the message, it may further include: identifying at least one message from the same source port as the same data flow, and identifying at least one message sent to the same destination port as the same data flow.
[0101] In this embodiment of the invention, the network device can identify which data stream a received packet belongs to by using flow identification information. The network device can identify uplink packets from the same source port as the same data stream, and packets sent to the same destination port as the same data stream, thus reducing the number of identified data streams and reducing the number of times ports need to be matched for data streams, thereby improving service operation efficiency.
[0102] Figure 8 This is the second flowchart illustrating the traffic load balancing method provided in this embodiment of the invention. (Refer to...) Figure 8 After receiving a packet, the network device can identify the flow identifier information D1 of the AI large model training data stream to which the packet belongs, and look up the flow identifier information D1 in the forwarding record table.
[0103] If the egress port corresponding to the flow identifier D1 is found in the forwarding record table, it means that the data flow has matched the egress port. Then, the packet is forwarded through the egress port associated with the record, and the forwarding record table is refreshed.
[0104] If the egress port corresponding to flow identifier D1 is not found in the forwarding record table, or if flow identifier D1 is not included, it means that the data flow does not match an egress port. In this case, the egress port with the largest available bandwidth from the egress ports that meet the bandwidth requirements of the data flow can be selected as the target egress port. The target egress port P... D1 The maximum available bandwidth can be calculated using the following formula:
[0105] B D1 =MAX(B Physical -B 实时占用带宽 -B 预留带宽 );
[0106] After obtaining the target outgoing port, the packet can be forwarded according to the selected target outgoing port, and the forwarding record table can be refreshed.
[0107] The embodiments of this invention can be used in the field of deep learning and can optimize the efficiency of aggregate communication in the training of large AI models: First, it can greatly improve the accuracy of data stream port selection, so that the data stream can be allocated to the most suitable port, and the overall business operation efficiency is higher; Second, it can effectively manage the life cycle of the data stream, and release port resources by aging mechanism to promptly exit inactive data streams and maximize resource utilization.
[0108] The traffic load balancing device provided by the present invention is described below. The traffic load balancing device described below and the traffic load balancing method described above can be referred to in correspondence.
[0109] Figure 9 This is a schematic diagram of the traffic load balancing device provided in an embodiment of the present invention. (Refer to...) Figure 9 This invention provides a traffic load balancing device, which may specifically include the following modules:
[0110] The receiving module 901 is used to receive messages; the messages carry the stream identifier of the AI large model training data stream to which they belong.
[0111] The selection module 902 is used to select the target outgoing port with the largest available bandwidth from the outgoing ports that meet the transmission conditions of the data flow if the flow identifier or the outgoing port corresponding to the flow identifier is not found in the forwarding record table, so as to achieve traffic load balancing of the outgoing ports; wherein, the aging time of the forwarding record table entry is set to cover one iteration cycle of the training of the AI large model.
[0112] Based on any of the above embodiments, the selection module includes:
[0113] The bandwidth calculation submodule is used to calculate the available bandwidth of each output port based on the physical bandwidth, real-time occupied bandwidth and reserved bandwidth of the output port for each output port that meets the transmission conditions of the data stream.
[0114] The forwarding submodule is used to select the target outgoing port with the largest available bandwidth based on the available bandwidth of each outgoing port to forward the packet.
[0115] Based on any of the above embodiments, the real-time occupied bandwidth of the output port is the transmission requirement bandwidth of at least one data stream being transmitted after being matched with the output port, and the reserved bandwidth of the output port is the transmission requirement bandwidth of at least one data stream to be transmitted after being matched with the output port.
[0116] Based on any of the above embodiments, the flow information of any data stream in the forwarding record table includes a reception timestamp, wherein the reception timestamp is the latest timestamp of receiving a packet belonging to the data stream; the apparatus further includes:
[0117] The transmission status determination module is used to determine the message transmission status of any data stream based on the reception timestamp of any data stream in the forwarding record table.
[0118] The flow information deletion module is used to determine that any data flow is an inactive data flow and delete the flow information of any data flow in the forwarding record table if no message of any data flow is received after a preset aging time.
[0119] Based on any of the above embodiments, the device further includes:
[0120] The bandwidth increase module is used to determine that any data stream is an active data stream if a message of any data stream is received within a preset active time, and to increase the reserved bandwidth of the outgoing port matching any data stream.
[0121] Wherein, the preset active time is less than the preset aging time.
[0122] Based on any of the above embodiments, the flow identifier includes at least a source port and a destination port; after the received message, it further includes:
[0123] The data flow determination module is used to determine that at least one packet from the same source port is the same data flow, and to determine that at least one packet destined for the same destination port is the same data flow.
[0124] This invention, by setting a longer aging time for forwarding entries to cover a complete iteration cycle of AI large-scale model training, eliminates the need to segment data streams by time intervals, thus avoiding the difficulty in selecting time intervals for data stream segmentation. By selecting the target outgoing port with the largest available bandwidth from the outgoing ports that meet the data stream transmission conditions for forwarding packets, the appropriate port for forwarding data streams can be selected based on the actual available bandwidth of the outgoing port, rather than measuring the port bandwidth and queue size in real time. This improves the accuracy of load measurement, thereby enhancing load balancing and preventing network congestion caused by unbalanced traffic load during AI large-scale model training due to incorrect outgoing port matching. Ultimately, this improves the efficiency of resource matching for the overall business flow.
[0125] Figure 10 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 10As shown, the electronic device may include a processor 1010, a communications interface 1020, a memory 1030, and a communication bus 1040. The processor 1010, communications interface 1020, and memory 1030 communicate with each other via the communication bus 1040. The processor 1010 can call logical instructions in the memory 1030 to execute a traffic load balancing method. This method includes: receiving a message; the message carrying a flow identifier of the AI large-scale model training data stream; if the flow identifier or the corresponding egress port is not found in the forwarding record table, then selecting the target egress port with the largest available bandwidth from the egress ports that meet the transmission conditions of the data stream and forwarding the message to achieve traffic load balancing of the egress ports; wherein the aging time of the forwarding record table entry is set to cover one iteration cycle of the AI large-scale model training.
[0126] Furthermore, the logical instructions in the aforementioned memory 1030 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0127] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the traffic load balancing method provided by the above methods. The method includes: receiving a packet; the packet carrying a flow identifier of the AI large model training data stream to which it belongs; if the flow identifier or the corresponding egress port is not found in the forwarding record table, then selecting the target egress port with the largest available bandwidth from the egress ports that meet the transmission conditions of the data stream and forwarding the packet to achieve traffic load balancing of the egress ports; wherein, the aging time of the forwarding record table entry is set to cover one iteration cycle of the AI large model training.
[0128] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the traffic load balancing method provided by the above methods. The method includes: receiving a packet; the packet carrying a flow identifier of the AI large model training data stream to which it belongs; if the flow identifier or the corresponding egress port is not found in the forwarding record table, then selecting the target egress port with the largest available bandwidth from the egress ports that meet the transmission conditions of the data stream and forwarding the packet to achieve traffic load balancing of the egress ports; wherein the aging time of the forwarding record table entry is set to cover one iteration cycle of the AI large model training.
[0129] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0130] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0131] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A traffic load balancing method, characterized in that, A network device applied to parametric surface networks for training large AI models, the method comprising: Receive a message; the message carries the stream identifier of the AI large model training data stream to which it belongs; If the flow identifier or the corresponding outgoing port is not found in the forwarding record table, the target outgoing port with the largest available bandwidth is selected from the outgoing ports that meet the transmission conditions of the data flow to forward the packet, so as to achieve traffic load balancing of the outgoing ports. The aging time of the forwarding record entries is set to cover one iteration cycle of the training of the AI large model.
2. The traffic load balancing method according to claim 1, characterized in that, The step of selecting the target outgoing port with the largest available bandwidth from the outgoing ports that meet the transmission conditions of the data stream and forwarding the message includes: For each output port that meets the transmission conditions of the data stream, the available bandwidth of the output port is calculated based on the physical bandwidth, real-time occupied bandwidth, and reserved bandwidth of the output port. Based on the available bandwidth of each outgoing port, the target outgoing port with the largest available bandwidth is selected to forward the message.
3. The traffic load balancing method according to claim 2, characterized in that, The real-time occupied bandwidth of the output port is the transmission bandwidth required for at least one data stream being transmitted after being matched with the output port, and the reserved bandwidth of the output port is the transmission bandwidth required for at least one data stream to be transmitted after being matched with the output port.
4. The traffic load balancing method according to claim 2, characterized in that, The flow information of any data stream in the forwarding record table includes a reception timestamp, which is the latest timestamp of receiving a packet belonging to any data stream; the method further includes: Based on the receiving timestamp of any data stream in the forwarding record table, determine the message transmission status of any data stream; If no packet of any of the data streams is received after the preset aging time, the data stream is determined to be an inactive data stream, and the stream information of the data stream in the forwarding record table is deleted.
5. The traffic load balancing method according to claim 4, characterized in that, The method further includes: If a message from any of the data streams is received within a preset active time period, then the data stream is determined to be an active data stream, and the reserved bandwidth of the outgoing port matching the data stream is increased. Wherein, the preset active time is less than the preset aging time.
6. The traffic load balancing method according to claim 1, characterized in that, The flow identifier includes at least the source port and the destination port; Following the received message, the following is also included: At least one message from the same source port is identified as the same data stream, and at least one message destined for the same destination port is identified as the same data stream.
7. A flow load balancing device, characterized in that, include: The receiving module is used to receive messages; The message carries the stream identifier of the AI large model training data stream to which it belongs; The selection module is used to forward the packet from the output ports that meet the transmission conditions of the data flow if the flow identifier or the output port corresponding to the flow identifier is not found in the forwarding record table, so as to achieve traffic load balancing of the output ports. The aging time of the forwarding record entries is set to cover one iteration cycle of the training of the AI large model.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the traffic load balancing method as described in any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the traffic load balancing method as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the traffic load balancing method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
A data processing method and network equipment
CN109714266A
Load balancing method and device, electronic equipment and storage medium
CN116915709A