Switch load balancing method and device, electronic equipment and storage medium

By determining the endpoint switch, packet and balance adjustment of the data flow in the switch, the problem of low load balancing efficiency in the prior art is solved, and more efficient data transmission is achieved.

CN119743433APending Publication Date: 2025-04-01BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411858892.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

During data transmission, it is difficult for the prior art to effectively realize the load balancing of the switch, resulting in limited data transmission efficiency and network throughput.

Method used

By determining the first endpoint switch of the data stream in the cluster, the data streams are grouped, the second endpoint switch of each data stream is determined, and balanced based on the number of data streams on the equivalent edges of these switches and the upper-linked switches.

Benefits of technology

The balanced distribution of data flows between switches is realized, load balancing efficiency and data transmission efficiency are improved, and network bottlenecks are avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119743433A_ABST
    Figure CN119743433A_ABST
Patent Text Reader

Abstract

The invention discloses a switch load balancing method and device, electronic equipment and a storage medium, and relates to the technical field of computers, in particular to the field of artificial intelligence such as big data and cloud computing. The specific implementation scheme is as follows: determining a first endpoint switch of a data stream in a cluster; grouping the data streams according to the first endpoint switch to obtain at least one group; for any group in the at least one group, determining at least one second endpoint switch of each data flow in any group; for any second endpoint switch in the at least one second endpoint switch, determining a first number of first direction flows of any second endpoint switch on each equivalent edge of any second endpoint switch and the uplink switch; wherein the first direction flow refers to a data flow in the first direction; and according to the first number of the first direction flow of any second endpoint switch on each equivalent edge, carrying out balance adjustment on the first direction flow of any second endpoint switch on each equivalent edge.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, in particular to artificial intelligence fields such as big data and cloud computing, and specifically to a switch load balancing method, device, electronic device and storage medium. Background Art

[0002] With the advent of the information age, the amount of data processing has shown an exponential growth. Therefore, in the process of data transmission, switches are often load balanced to improve data transmission efficiency and network throughput. Summary of the invention

[0003] The present application provides a switch load balancing method, device, electronic device and storage medium.

[0004] According to one aspect of the present application, a switch load balancing method is provided, comprising:

[0005] Determine a first endpoint switch of a data flow in the cluster;

[0006] Grouping the data stream according to the first endpoint switch to obtain at least one group;

[0007] For any group in the at least one group, determining at least one second endpoint switch of each data flow in the any group;

[0008] For any second endpoint switch among the at least one second endpoint switch, determine a first quantity of first direction flows of any second endpoint switch on each equivalent edge between the any second endpoint switch and an upstream switch; wherein the first direction flow refers to a data flow in a first direction;

[0009] According to the first quantity of the first direction flow of any second endpoint switch on each equivalent edge, the first direction flow of any second endpoint switch on each equivalent edge is balanced and adjusted.

[0010] According to another aspect of the present application, a switch load balancing device is provided, comprising:

[0011] A first determination module, used to determine a first endpoint switch of a data flow in the cluster;

[0012] A grouping module, configured to group the data stream according to the first endpoint switch to obtain at least one group;

[0013] A second determination module, configured to determine, for any group in the at least one group, at least one second endpoint switch of each data flow in the any group;

[0014] A third determination module is used to determine, for any second endpoint switch among the at least one second endpoint switch, a first number of first direction flows of any second endpoint switch on each equivalent edge between the any second endpoint switch and an upstream switch; wherein the first direction flow refers to a data flow in the first direction;

[0015] The balancing adjustment module is used to balance the first direction flow of any second endpoint switch on each equivalent edge according to the first quantity of the first direction flow of any second endpoint switch on each equivalent edge.

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

[0017] at least one processor; and

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

[0019] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor so that the at least one processor can perform the method described in the above embodiment.

[0020] According to another aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method according to the above embodiment.

[0021] According to another aspect of the present application, a computer program product is provided, including a computer program, wherein the computer program implements the steps of the method described in the above embodiment when executed by a processor.

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

[0023] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.

[0024] Figure 1 A schematic diagram of a flow chart of a switch load balancing method provided in an embodiment of the present application;

[0025] Figure 2 A schematic diagram of data flow in a two-layer fully connected switch in which an IBG is connected to a LEG according to an embodiment of the present application;

[0026] Figure 3 A flow chart of a switch load balancing method provided by another embodiment of the present application;

[0027] Figure 4 A schematic diagram of a data flow with IBG_4 as the destination switch provided in an embodiment of the present application;

[0028] Figure 5 A schematic diagram of a data flow with IBG_5 as the destination switch provided in an embodiment of the present application;

[0029] Figure 6 A schematic diagram of a data flow with IBG_6 as the destination switch provided in an embodiment of the present application;

[0030] Figure 7 A flow chart of a switch load balancing method provided by another embodiment of the present application;

[0031] Figure 8 A schematic diagram of the structure of a switch load balancing device provided in an embodiment of the present application;

[0032] Fig. 9 It is a block diagram of an electronic device used to implement the switch load balancing method according to an embodiment of the present application. DETAILED DESCRIPTION

[0033] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0034] The following describes the switch load balancing method, device, electronic device and storage medium according to the embodiments of the present application with reference to the accompanying drawings.

[0035] In order to meet the transmission requirements of large amounts of data, a two-layer fully connected switch network can be used to forward data to improve data forwarding efficiency and transmission efficiency. Among them, a two-layer fully connected switch network is a switch network with a two-layer architecture and supports full connectivity. That is, each switch in one of the two layers is connected to all switches in the other layer, that is, each switch has an equal-cost path with all switches in the other layer, which can be called an equal-cost edge.

[0036] In some embodiments, for a two-layer fully connected switch network, ECMP (Equal Cost Multi-Path) equal cost path and hash algorithm are usually used to select paths. This path selection based on hash algorithm is not a big problem in traditional CPU (Central Processing Unit) networks where there are many flows and most of them are small flows, but a feature of GPU (Graphics Processing Unit) networks is that there are few flows and most of them are elephant flows. In this case, it can only be guaranteed that the hash algorithm with uniform probability under enough samples will result in a small number of data flows. Some network ports will hash to a lot of data flows, while some ports will have almost no data flows. In this way, the network ports that hash to a lot of data flows become congestion points or bottlenecks of the entire network.

[0037] Based on this, an embodiment of the present application provides a switch load balancing method.

[0038] Figure 1 A flow chart of a switch load balancing method provided in an embodiment of the present application.

[0039] The switch load balancing method of the embodiment of the present application may be executed by a switch load balancing device of the embodiment of the present application, and the device may be configured in an electronic device.

[0040] Among them, the electronic device can be any device with computing capabilities, such as a personal computer, a mobile terminal, a server, etc. The mobile terminal can be, for example, a vehicle-mounted device, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, and other hardware devices with various operating systems, touch screens and / or display screens.

[0041] like Figure 1 As shown, the switch load balancing method includes:

[0042] Step 101: determine a first endpoint switch of a data flow in a cluster.

[0043] In the present application, the source device in the cluster can send the transmission data to the destination device through the two-layer switch. Exemplarily, the data flow can be transmitted from the source device to the destination device through the source switch, the uplink switch, and the destination switch in sequence.

[0044] The source switch may be the switch that the data flow first passes through after being sent from the source device, and the destination switch may be the last switch that the data flow passes through before being transmitted from the source device to the destination device.

[0045] Exemplarily, the first endpoint switch of the data flow may be determined according to the transmission path of the data flow in the cluster, wherein the first endpoint switch may be a target switch or a source switch.

[0046] Step 102: group the data stream according to the first endpoint switch to obtain at least one group.

[0047] Exemplarily, the first endpoint switch is the destination switch, and the same data flow of the destination switch can be taken as a group to obtain at least one group. It can be seen that the data flow in each group flows to the same destination switch.

[0048] The following is an example of a two-layer fully connected switch network with an IBG (Internal Backbone Gateway) connected to a LEG (Local Edge Gateway). Figure 2 Provide explanation. Figure 2 In the figure, there are 4 equivalent edges between IBG1, IBG2, ..., IBG8 and LEG1, LEG2, LEG3, LEG4. Since the destination IBG of one outbound flow of IBG4, one outbound flow of IBG7, and one outbound flow of IBG8 are all IBG1, these three data flows belong to one group, and the source IBGs of the data flows in the group are IBG4, IBG7, and IBG8.

[0049] Exemplarily, the first endpoint switch is a source switch, and the same data flow of the source switch can be divided into a group to obtain at least one group. It can be seen that the data flow in each group flows out from the same source switch.

[0050] Step 103: for any group in the at least one group, determine at least one second endpoint switch of each data flow in any group.

[0051] Exemplarily, for any of the at least one group, the second endpoint switch of each data flow in any of the group can be determined according to the transmission path of the data flow in any of the group, thereby determining at least one second endpoint switch, wherein the second endpoint switch corresponds to the first endpoint switch.

[0052] If the first endpoint switch is the destination switch and the second endpoint switch is the source switch, then the data flow in any packet may flow out from the same source switch or from multiple different source switches.

[0053] for example, Figure 2 In the grouping with IBG1 as the destination switch, there are three source switches of the data flow, namely IBG4, IBG7 and IBG8.

[0054] If the first endpoint switch is the source switch and the second endpoint switch is the destination switch, then the data flows in any packet may flow into the same destination switch or into different destination switches.

[0055] Step 104: for any second endpoint switch of the at least one second endpoint switch, determine a first quantity of first-direction flows of any second endpoint switch on each equivalent edge between any second endpoint switch and an upstream switch.

[0056] Exemplarily, for any second endpoint switch in any group, the first number of first-direction flows of any second endpoint switch on each equivalent edge between any second endpoint switch and an upstream switch may be determined.

[0057] The first direction flow refers to a data flow in a first direction. The first direction may be an inbound direction or an outbound direction. Inbound and outbound directions are relative to a device. Inbound flow may refer to a data flow flowing into a device, and outbound flow may refer to a data flow flowing out of a device.

[0058] For example, if the second endpoint switch is the source switch and the first direction flow is the outbound flow, then the outbound flow of the source switch refers to the data flow flowing out of the source switch. For another example, if the first endpoint switch is the destination switch and the first direction flow is the inbound flow, then the inbound flow of the destination switch refers to the data flow flowing into the destination switch.

[0059] Step 105 : According to the first quantity of the first direction flow of any second endpoint switch on each equivalent edge, balance adjustment is performed on the first direction flow of any second endpoint switch on each equivalent edge.

[0060] Since the number of first-direction flows of any second endpoint switch on each equivalent edge may be uneven, in this application, the first-direction flows of any second endpoint switch on each equivalent edge may be balanced and adjusted according to the first number of first-direction flows of any second endpoint switch on each equivalent edge, so that the number of first-direction flows of any second endpoint switch on each equivalent edge is uniform. Here, uniformity may mean that the difference in the number of data flows between the equivalent edge with the largest number of first-direction flows and the equivalent edge with the smallest number of first-direction flows is 0 or 1.

[0061] Exemplarily, the first direction flow of any second endpoint switch on the equivalent edge with a large first number can be scheduled to the equivalent edge with a small first number, thereby making the number of first direction flows of each second endpoint switch on each equivalent edge in the group uniform.

[0062] In the embodiment of the present application, by grouping the data flow in the cluster according to the first endpoint switch, at least one group is obtained, and for any second endpoint switch of the data flow in any group, according to the number of first direction flows of any second endpoint switch on each equivalent edge between any second endpoint switch and the upstream switch, the outgoing flow of any second endpoint switch on each equivalent edge is balanced and adjusted. Thus, by grouping the data flow according to the first endpoint switch, and then balancing the first direction flows of each second endpoint switch in the group on each equivalent edge with the upstream switch, the first direction flows of each second endpoint switch on each equivalent edge can be balanced, which can not only improve the load balancing efficiency, but also improve the data transmission efficiency.

[0063] Figure 3 A flow chart of a switch load balancing method provided in another embodiment of the present application.

[0064] like Figure 3 As shown, the switch load balancing method includes:

[0065] Step 301: determine a first endpoint switch of a data flow in a cluster.

[0066] Exemplarily, the first endpoint switch is the destination switch, which can parse the data flow to determine the destination device of the data flow, and determine the switch connected to the destination device based on the connection relationship between the device and the switch, and then determine the switch connected to the destination device as the first endpoint switch.

[0067] for example, Figure 2 In the example, the outgoing flow of switch IBG4 is parsed to determine that the destination device is server0. According to the connection relationship between the device and the switch, the switch connected to server0 is determined to be IBG1. Then, switch IBG1 can be determined as the destination switch of the outgoing flow of IBG4.

[0068] Therefore, if the first endpoint switch is the destination switch, the first endpoint switch can be determined based on the destination device of the data flow and the connection relationship between the device and the switch, with high accuracy.

[0069] Exemplarily, the first endpoint switch is a source switch, which can parse the data flow to determine the source device of the data flow, and determine the switch to which the source device is connected based on the connection relationship between the device and the switch, and then determine the switch to which the source device is connected as the first endpoint switch.

[0070] Step 302: Group the data stream according to the first endpoint switch to obtain at least one group.

[0071] In the present application, step 302 can be implemented in any of the embodiments of the present application, so it will not be described in detail here.

[0072] Step 303: for any group in the at least one group, determine at least one second endpoint switch of each data flow in any group.

[0073] Exemplarily, the second endpoint switch is a source switch, which can parse the data flow to determine the source device of the data flow, and determine the switch to which the source device is connected based on the connection relationship between the device and the switch, and then determine the switch to which the source device is connected as the second endpoint switch.

[0074] Therefore, if the second endpoint switch is the source switch, the second endpoint switch can be determined based on the source device of the data flow and the connection relationship between the device and the switch, with high accuracy.

[0075] Exemplarily, the second endpoint switch is the destination switch, which can parse the data flow to determine the destination device of the data flow, and determine the switch connected to the destination device based on the connection relationship between the device and the switch, and then determine the switch connected to the destination device as the second endpoint switch.

[0076] Step 304: for any second endpoint switch of the at least one second endpoint switch, determine a first quantity of first-direction flows of any second endpoint switch on each equivalent edge between any second endpoint switch and an upstream switch.

[0077] In the present application, step 304 can be implemented in any of the embodiments of the present application, so it will not be described in detail here.

[0078] Step 305 , according to the first quantity of first direction flows of any second endpoint switch on each equivalent edge, determine the equivalent edge with the largest quantity of first direction flows and the equivalent edge with the smallest quantity of first direction flows among each equivalent edge.

[0079] Exemplarily, the first quantities of first-direction flows of any second endpoint switch on each equivalent edge may be compared to determine the equivalent edge with the largest quantity of first-direction flows of any second endpoint switch and the equivalent edge with the smallest quantity of first-direction flows.

[0080] It should be noted that the equivalent edge with the largest number of first-directional flows may be one or more, and the equivalent edge with the smallest number of first-directional flows may be one or more.

[0081] Exemplarily, if there are multiple groups, the first-direction flows of the second endpoint switches in the multiple groups on each equivalent edge can be balanced and adjusted in turn. In order to ensure that the balance of the first-direction flows of the second endpoint switches in the adjusted groups on each equivalent edge is not affected, for any second endpoint switch in any group currently being balanced, the third number of first-direction flows of any second endpoint switch in the target group on each equivalent edge can be determined, and the first number and the third number of first-direction flows on the same equivalent edge can be added to obtain the fourth number of first-direction flows on the same equivalent edge, and then the fourth number of first-direction flows on each equivalent edge is compared, and the equivalent edge with the largest number of first-direction flows and the equivalent edge with the smallest number of first-direction flows are determined from each equivalent edge.

[0082] The target group may refer to a balanced and adjusted group in at least one group obtained by grouping the data stream according to the first endpoint switch.

[0083] It can be understood that the third number of first-direction flows of any second endpoint switch in the target group on each equivalent edge with the upstream switch is uniform.

[0084] It should be noted that the target group can be one or more, and there is no limitation on this.

[0085] Taking the grouping of data flows according to the destination switch as an example, the third number of outgoing flows of any source switch in the target group on each equivalent edge with the upstream switch can be determined, and the first number of outgoing flows on the same equivalent edge is added to the third number to obtain the fourth number of outgoing flows on the same equivalent edge, and then the fourth number of outgoing flows on each equivalent edge is compared to determine the equivalent edge with the largest number of outgoing flows and the equivalent edge with the smallest number of outgoing flows from each equivalent edge. Among them, the outgoing flows of any source switch in the target group on each equivalent edge with the upstream switch refer to the data flows flowing out of the source switch transmitted on each equivalent edge with the upstream switch.

[0086] For example, the data flow in a cluster is divided into three groups according to the destination switch: group1, group2, and group3. The outgoing flows of the source switches in group1 and group2 on each equivalent edge have been balanced and adjusted. Currently, the outgoing flow of the source switch S1 in group3 is balanced and adjusted. The first number of outgoing flows of the source switch S1 in group3 on the three equivalent edges r1, r2, and r3 with the upstream switch is 2, 1, and 0 respectively. The third number of outgoing flows of the source switch S1 on the three equivalent edges r1, r2, and r3 in the two groups group1 and group2 is 2, 2, and 1 respectively. Then, the first number and the third number on the same equivalent edge are added together, so that the fourth number of outgoing flows of the source switch S1 on the three equivalent edges r1, r2, and r3 is 4, 3, and 1 respectively. Then, the equivalent edge with the largest outgoing flow is r1, and the equivalent edge with the smallest outgoing flow is r3. Among them, the outgoing flow of the source switch S1 refers to the data flow flowing out from the source switch S1.

[0087] Therefore, taking into account the number of first-direction flows of the second endpoint switch on each equivalent edge in the adjusted group, the equivalent edge with the largest number of first-direction flows of the second endpoint switch and the equivalent edge with the smallest number of first-direction flows among each equivalent edge are determined, so that balancing adjustment is performed based on the equivalent edge with the largest number of first-direction flows and the equivalent edge with the smallest number of first-direction flows, thereby improving the overall balance of the first-direction flows of the second endpoint switch.

[0088] Step 306: determine a first equivalent edge from the equivalent edges with the largest number of flows in the first direction.

[0089] Exemplarily, if there is one equivalent edge with the largest number of flows in the first direction, the equivalent edge with the largest number of flows in the first direction may be determined as the first equivalent edge.

[0090] Exemplarily, if there are multiple equivalent edges with the largest number of flows in the first direction, one of the multiple equivalent edges with the largest number of flows in the first direction may be randomly selected as the first equivalent edge.

[0091] When balancing and adjusting the first direction flow of a second endpoint switch, when the second endpoint switch flows through a certain upstream switch, there may be data flows of other second endpoint switches that also flow through the upstream switch, taking into account the load balancing of the upstream switch. Exemplarily, if there are multiple equivalent edges with the largest number of first direction flows, the number of data flows flowing through each upstream switch corresponding to the equivalent edge with the largest number of first direction flows is determined, and the equivalent edge corresponding to the upstream switch with the largest number of data flows flowing through can be determined as the first equivalent edge.

[0092] Taking the grouping of data streams according to the destination switch as an example, Figure 2In the figure, IBG2 is the source switch in a certain group. Assuming that the number of outbound flows on the equivalent edges between IBG2 and LEG1, LEG2, LEG3, and LEG4 are 8, 8, 5, and 5 respectively, it can be seen that the number of outbound flows on the equivalent edges between IBG2 and LEG1 and between IBG2 and LEG2 is the largest, and the number of data flows flowing through LEG2 is greater than the number of data flows flowing through LEG1, then the equivalent edge between IBG2 and LEG2 can be determined as the first equivalent edge.

[0093] Therefore, if there are multiple equivalent edges with the largest number of flows in the first direction, the equivalent edge with the largest number of data flows flowing through the upstream switch corresponding to these equivalent edges can be used as the first equivalent edge, so as to perform load balancing based on the data flow on the first equivalent edge, which can improve the load balancing effect of the upstream switch.

[0094] Step 307: determine a second equivalent edge from the equivalent edges with the smallest number of flows in the first direction.

[0095] Exemplarily, if there is only one equivalent edge with the smallest number of flows in the first direction, the equivalent edge with the smallest number of flows in the first direction may be determined as the second equivalent edge.

[0096] Exemplarily, if there are multiple equivalent edges with the smallest number of flows in the first direction, one of the multiple equivalent edges with the smallest number of flows in the first direction may be randomly selected as the second equivalent edge.

[0097] Taking into account the load balancing of the upstream switch, exemplarily, if there are multiple equivalent edges with the smallest number of flows in the first direction, the number of data flows passing through each upstream switch corresponding to the equivalent edge with the smallest number of flows in the first direction is determined, and the equivalent edge corresponding to the upstream switch with the smallest number of data flows can be determined as the second equivalent edge.

[0098] Taking the grouping of data streams according to the destination switch as an example, Figure 2 In the figure, IBG2 is the source switch in a certain group. Assuming that the numbers of outbound flows on the equivalent edges between IBG2 and LEG1, LEG2, LEG3, and LEG4 are 8, 8, 5, and 5 respectively, it can be seen that the numbers of outbound flows on the equivalent edges between IBG2 and LEG3 and between IBG2 and LEG4 are the smallest, and the number of data flows flowing through LEG4 is greater than the number of data flows flowing through LEG3, then the equivalent edge between IBG2 and LEG4 can be determined as the second equivalent edge.

[0099] Therefore, if there are multiple equivalent edges with the smallest number of flows in the first direction, the equivalent edge with the smallest number of data flows flowing through the upstream switch corresponding to these equivalent edges can be used as the second equivalent edge, so as to load balance the data flows on the second equivalent edge, which can improve the load balancing effect of the upstream switch.

[0100] Step 308: Schedule the second number of first-direction flows on the first equivalent edge to be transmitted on the second equivalent edge.

[0101] Exemplarily, a first-direction flow of any second endpoint switch on the first equivalent-cost edge may be scheduled to be transmitted on the second equivalent-cost edge.

[0102] Taking the grouping of data streams according to the destination switch as an example, Figure 2 In the figure, IBG2 is the source switch in a certain group. Assume that the number of outbound flows on the equivalent edges between IBG2 and LEG1, LEG2, LEG3, and LEG4 are 8, 8, 5, and 5 respectively, the equivalent edge between IBG2 and LEG2 is the first equivalent edge, and the equivalent edge between IBG2 and LEG4 is the second equivalent edge. Then, an outbound flow of IBG2 on the first equivalent edge can be scheduled to be transmitted on the second equivalent edge.

[0103] Exemplarily, if the data flow in the cluster is divided into multiple groups, the second number of first-direction flows of any second endpoint switch in any group on the first equivalent edge can be scheduled to be transmitted on the second equivalent edge while the third number of first-direction flows of any second endpoint switch in the target group on each equivalent edge remains unchanged.

[0104] Thus, when the number of first-direction flows of the second endpoint switch on each equivalent edge in the adjusted group remains unchanged, the first-direction flows of the second endpoint switch on each equivalent edge in the current group are balanced, thereby achieving load balancing adjustment of the first-direction flows of the second endpoint switch on each equivalent edge in the current group without affecting the load balancing of the second endpoint switch on each equivalent edge in the previously adjusted group.

[0105] It should be noted that the second number can be 1 or other positive integers, and there is no limitation on this.

[0106] Step 309, continue to determine the equivalent edge with the largest number of first directional flows and the equivalent edge with the smallest number of first directional flows among the equivalent edges, until the difference in the number of first directional flows between the equivalent edge with the largest number of first directional flows and the equivalent edge with the smallest number of first directional flows is less than or equal to the first threshold.

[0107] In the present application, after scheduling the first number of first direction flows of any second endpoint switch on the first equivalent edge to the second equivalent edge, the equivalent edge with the largest number of first direction flows and the equivalent edge with the smallest number of first direction flows among the equivalent edges are further determined.

[0108] If the difference in the number of first-direction flows on two equivalent edges is less than or equal to the first threshold, it can be determined that the first-direction flows of any second endpoint switch are balanced on each equivalent edge; otherwise, continue to determine the first equivalent edge and the second equivalent edge, and then perform balancing adjustments until the difference in the number of first-direction flows between the equivalent edge with the largest number of first-direction flows and the equivalent edge with the smallest number of first-direction flows is less than or equal to the first threshold.

[0109] Exemplarily, the first threshold may be 1, or other positive integers, which is not limited.

[0110] Taking the grouping of data flows according to the destination switch as an example, for example, the first threshold is 1, after the first number of outgoing flows of any source switch on the first equivalent edge is scheduled to the second equivalent edge, the equivalent edge with the largest number of outgoing flows and the equivalent edge with the smallest number of outgoing flows among the equivalent edges are further determined.

[0111] If the difference in the number of outgoing flows on two equivalent edges is 0 or 1, it can be determined that the outgoing flows of any second endpoint switch are balanced on each equivalent edge. Otherwise, continue to determine the first equivalent edge and the second equivalent edge, and then perform balancing adjustments until the difference in the number of outgoing flows between the equivalent edge with the largest number of outgoing flows and the equivalent edge with the smallest number of outgoing flows is 0 or 1.

[0112] Exemplarily, if the data flow in the cluster is divided into multiple groups, the second number of first-direction flows on the first equivalent edge of any second endpoint switch in the target group can be scheduled to be transmitted on the second equivalent edge while the third number of first-direction flows on each equivalent edge of any second endpoint switch in the target group remains unchanged. The equivalent edge with the largest number of first-direction flows and the equivalent edge with the smallest number of first-direction flows can be determined based on the number of the second endpoint switch on each equivalent edge in the target group.

[0113] If the difference in the number of data flows between the equivalent edge with the largest number of flows in the first direction and the equivalent edge with the smallest number of flows in the first direction is greater than the first threshold, continue to determine the first equivalent edge and the second equivalent edge, and then continue to adjust while the third number of first-direction flows on each equivalent edge of the second endpoint switch in the target group remains unchanged until the difference in the number of data flows between the equivalent edge with the largest number of flows in the first direction and the equivalent edge with the smallest number of flows in the first direction is less than or equal to the first threshold.

[0114] Taking the grouping of data streams according to the destination switch as an example, combined with Figure 4 , Figure 5 , Figure 6To illustrate, the data flows in the cluster are divided into three groups according to the destination switches IBG_4, IBG_5, and IBG_6. The three numbers below the switches IBG_1, IBG_2, and IBG_3 indicate the number of outbound flows on the equivalent edges between the corresponding switches and the upstream switches LEG1, LEG2, and LEG3 after the outbound flow balancing adjustment, and the three numbers below the switches IBG_4, IBG_5, and IBG_6 indicate the number of inbound flows on the three equivalent edges of the corresponding switches.

[0115] Figure 4 In the data flow with IBG_4 as the destination switch, the source switches are IBG_1, IBG_2, and IBG_3. The source switch IBG_1 has 1 outbound flow, and the number of outbound flows on the equivalent edges with LEG1, LEG2, and LEG3 are 0, 0, and 1 respectively, which is balanced. The source switch IBG_2 has 2 outbound flows, and the number of outbound flows on the equivalent edges with LEG1, LEG2, and LEG3 are 1, 1, and 0 respectively, which is balanced. The source switch IBG_3 has 1 outbound flow, and the number of outbound flows on the equivalent edges with LEG1, LEG2, and LEG3 are 0, 1, and 0 respectively, which is balanced. The destination switch IBG_4 has 1, 2, and 1 inbound flows on the equivalent edges with LEG1, LEG2, and LEG3, which is also balanced.

[0116] Figure 5 In the data flow with IBG_5 as the destination switch, the source switches are IBG_2 and IBG_3. There are 3 outbound flows of the source switch IBG_2 in this group. Considering the number of outbound flows of the source switch IBG_2 on the three equivalent edges in the group with IBG_4 as the destination switch that has been adjusted, the outbound flows of the source switch IBG_2 in the current group are balanced. The number of outbound flows of the source switch IBG_2 on the three equivalent edges in the current group is 1, 1, 1, which is balanced. Overall, the number of outbound flows of the source switch IBG_2 on the three equivalent edges in the two groups is 2, 2, and 1, respectively, which is balanced. There is one outgoing flow from the source switch IBG_3 in this group. Considering the number of outgoing flows on the three equivalent edges of the source switch IBG_3 in the adjusted group with IBG_4 as the destination switch, the outgoing flow of the source switch IBG_2 in the current group is balanced. The number of outgoing flows on the three equivalent edges of the source switch IBG_3 in the current group is 0, 0, 1, which is balanced. Overall, the number of outgoing flows on the three equivalent edges of the source switch IBG_3 in the two groups is 0, 1, 1, which is balanced. The number of inbound flows on the equivalent edges with LEG1, LEG2, and LEG3 of the destination switch IBG_5 corresponding to this group is 1, 1, 2, which is balanced.

[0117] Figure 3 In the data flow with IBG_6 as the destination switch, the source switches are IBG_1 and IBG_3. There are 2 outbound flows of the source switch IBG_1 in this group. Considering the number of outbound flows of the source switch IBG_2 on the three equivalent edges in the adjusted group with IBG_4 and IBG5 as the destination switches, the outbound flows of the source switch IBG_1 in the current group are balanced. The number of outbound flows of the source switch IBG_1 on the three equivalent edges in the current group is 1, 1, and 0, which is balanced. Overall, the number of outbound flows of the source switch IBG_1 on the three equivalent edges in the three groups is 1, 1, and 1, respectively, which is balanced. There is one outgoing flow from the source switch IBG_3 in this group. Considering the number of outgoing flows of the source switch IBG_3 on the three equivalent edges in the adjusted group with IBG_4 and IBG_5 as the destination switches, the outgoing flows of the source switch IBG_3 in the current group are balanced. The number of outgoing flows of the source switch IBG_3 on the three equivalent edges in the current group is 1, 0, 0, which is balanced. Overall, the number of outgoing flows of the source switch IBG_3 on the three equivalent edges in the three groups is 1, 1, 1, which is balanced. The number of inbound flows of the destination switch IBG_6 corresponding to this group on the equivalent edges with LEG1, LEG2, and LEG3 is 2, 1, and 0, which is unbalanced.

[0118] Therefore, when the number of first-direction flows of the second endpoint switch on each equivalent edge in the adjusted group remains unchanged, the first-direction flows of the second endpoint switch on each equivalent edge in the current group are balanced, so that without affecting the load balancing of the second endpoint switch on each equivalent edge in the previously adjusted group, not only can the balancing of the first-direction flows of the second endpoint switch on each equivalent edge be achieved, but also the complexity of the balancing adjustment is reduced.

[0119] In the embodiment of the present application, by determining the equivalent edge with the largest number of flows in the first direction and the equivalent edge with the smallest number of flows in the first direction on each equivalent edge of any second endpoint switch in any group, then determining the first equivalent edge from the equivalent edge with the largest number of flows in the first direction, determining the second equivalent edge from the equivalent edge with the smallest number of flows in the first direction, and scheduling the second number of flows in the first direction on the first equivalent edge to be transmitted on the second equivalent edge, and then re-determining the equivalent edge with the largest number of flows in the first direction and the equivalent edge with the smallest number of flows in the first direction, until the data flow balancing condition is met. Thus, by scheduling the data flow on the equivalent edge with the largest number of flows in the first direction to the equivalent edge with the smallest number of flows in the first direction, the complexity of scheduling can be reduced and the efficiency of load balancing can be improved.

[0120] Figure 7 A flow chart of a switch load balancing method provided in another embodiment of the present application.

[0121] like Figure 7 As shown, the switch load balancing method includes:

[0122] Step 701: determine a first endpoint switch of a data flow in a cluster.

[0123] Step 702: Group the data stream according to the first endpoint switch to obtain at least one group.

[0124] Step 703: for any group in the at least one group, determine at least one second endpoint switch of each data flow in any group.

[0125] Step 704: for any second endpoint switch of the at least one second endpoint switch, determine a first quantity of first-direction flows of any second endpoint switch on each equivalent edge between any second endpoint switch and an upstream switch.

[0126] Step 705: Balance and adjust the first direction flows of any second endpoint switch on each equivalent edge according to the first quantity of the first direction flows of any second endpoint switch on each equivalent edge.

[0127] In the present application, steps 701 to 705 may be implemented in any of the embodiments of the present application, and therefore will not be described in detail herein.

[0128] Step 706: Determine whether the second direction flows of the first endpoint switch corresponding to any group on each equivalent edge exchanged with the upstream are balanced.

[0129] In the present application, after balancing and adjusting the first direction flow of each second endpoint switch in a group on each equivalent edge, it can be determined whether the second direction flow of the first endpoint switch corresponding to the group on each equivalent edge exchanged with the uplink is balanced.

[0130] The second direction flow may refer to a data flow in a second direction, which is opposite to the first direction. For example, if the first direction flow is an outbound flow, the second direction flow is an inbound flow, and if the first direction flow is an inbound flow, the second direction flow is an outbound flow.

[0131] Exemplarily, the maximum number of second-direction flows and the minimum number of second-direction flows of the first endpoint switch corresponding to the group on each equivalent edge with the upstream switch can be determined, and then based on the difference between the maximum number of second-direction flows and the minimum number of second-direction flows, it is determined whether the second-direction flows of the first endpoint switch corresponding to the group on each equivalent edge with the upstream switch are balanced.

[0132] If the difference between the maximum number of second-direction flows and the minimum number of second-direction flows is greater than the first threshold, it can be considered that the second-direction flows of the first endpoint switch corresponding to the group on each equivalent edge with the upstream switch are unbalanced; otherwise, it can be considered that the second-direction flows of the first endpoint switch corresponding to the group on each equivalent edge with the upstream switch are balanced.

[0133] Take the example of grouping data flows according to the destination switch, for example, Figure 6 In the figure, the number of inbound flows of the destination switch IBG_6 on the three equivalent edges with the upstream switch is 2, 1, and 0 respectively. It can be seen that the maximum number of inbound flows is 2, the minimum number of inbound flows is 0, and the difference between the two is 2, which is greater than 1, indicating that the inbound flows of the destination switch IBG_6 corresponding to the packet on the three equivalent edges with the upstream switch are unbalanced. Among them, the inbound flows of the target switch IBG_6 on the three equivalent edges with the upstream switch refer to the data flows to the switch IBG_6 transmitted on the three equivalent edges with the upstream switch.

[0134] Step 707: In response to the imbalance of the second direction flows of the first endpoint switch corresponding to any group on each equivalent edge exchanged with the uplink, the second direction flows of the first endpoint switch corresponding to any group on each equivalent edge exchanged with the uplink are balanced and adjusted.

[0135] In the present application, if the first endpoint switch corresponding to any group has an unbalanced second direction flow on each equivalent edge exchanged with the upstream link, it is determined whether the equivalent edge with the smallest number of second direction flows can be balanced adjusted according to the equivalent edge with the largest number of second direction flows. If so, the equivalent edge with the smallest number of second direction flows is balanced adjusted according to the equivalent edge with the largest number of second direction flows, and the equivalent edge with the largest number of second direction flows and the equivalent edge with the smallest number of second direction flows are re-determined, and it is continued to be determined whether the equivalent edge with the smallest number of second direction flows can be balanced adjusted according to the equivalent edge with the largest number of second direction flows.

[0136] If not, continue to determine whether it is possible to balance the equivalent edge with the smallest number of flows in the second direction based on the equivalent edge with the second largest number of flows in the second direction. If it is possible, balance the equivalent edge with the smallest number of flows in the second direction based on the equivalent edge with the second largest number of flows in the second direction, and continue to determine the equivalent edge with the largest number of flows in the second direction and the equivalent edge with the smallest number of flows in the second direction, and continue to determine whether it is possible to balance the equivalent edge with the smallest number of flows in the second direction based on the equivalent edge with the largest number of flows in the second direction.

[0137] If the equivalent edge with the smallest number of flows in the second direction cannot be balanced and adjusted according to the equivalent edge with the second largest number of flows in the second direction, then continue to determine whether the equivalent edge with the smallest number of flows in the second direction can be balanced and adjusted according to the equivalent edge with the third largest number of flows in the second direction, until it is determined that the equivalent edge with the smallest number of flows in the second direction cannot be balanced and adjusted according to the equivalent edge with the second smallest number of flows in the second direction, then continue to determine whether the equivalent edge with the largest number of flows in the second direction can be balanced and adjusted according to the equivalent edge with the second smallest number of flows in the second direction.

[0138] If the equivalent edge with the second smallest number of flows in the second direction cannot be balanced and adjusted according to the equivalent edge with the largest number of flows in the second direction, then continue to determine whether the equivalent edge with the second smallest number of flows in the second direction can be adjusted according to the equivalent edge with the second largest number of flows in the second direction; if not, then continue to determine whether the equivalent edge with the second smallest number of flows in the second direction can be adjusted according to the equivalent edge with the third largest number of flows in the second direction, until the second direction flows of the destination switch corresponding to any group on each equivalent edge are balanced, or it is determined that the equivalent edge with the second largest number of flows in the second direction cannot be balanced and adjusted according to the equivalent edge with the largest number of flows in the second direction.

[0139] Among them, the equivalent edge with the second largest number of flows in the second direction may refer to the equivalent edge that is in the second position in the sorting result of the number of flows in the second direction on each equivalent edge from large to small, and the equivalent edge with the second smallest number of flows in the second direction may be the equivalent edge that is in the second-to-last position in the sorting result. For example, if the number of equivalent edges is M, where M is an integer greater than 1, then the equivalent edge with the second smallest number of flows in the second direction may refer to the equivalent edge that is in the M-1th position in the sorting result, that is, the equivalent edge that is in the second-to-last position in the sorting result.

[0140] The second direction flow balance here may mean that the difference in the number of data flows between the equivalent edge with the largest number of second direction flows and the equivalent edge with the smallest number of second direction flows is 0 or 1.

[0141] Therefore, by performing balancing adjustment on the equivalent edge with the largest number of second direction flows according to the equivalent edge with the largest number of second direction flows, the complexity of the adjustment can be reduced, and the balancing efficiency and degree of the second direction flows on each equivalent edge of the first endpoint switch can be improved.

[0142] Exemplarily, the following method may be used to determine whether the equivalent edge with the smallest number of flows in the second direction can be balanced and adjusted according to the equivalent edge with the largest number of flows in the second direction:

[0143] The fifth number of first-direction flows of the upstream switch corresponding to the equivalent edge with the largest number of second-direction flows in the first-direction flows of at least one second endpoint switch in any group and the sixth number of first-direction flows of the upstream switch corresponding to the equivalent edge with the smallest number of second-direction flows can be determined, and based on the fifth number and the sixth number of each second endpoint switch, it is determined whether there is a second endpoint switch with a fifth number greater than the sixth number in at least one second endpoint switch, and if the fifth number of the third endpoint switch in at least one second endpoint switch is greater than the sixth number, it is determined that the equivalent edge with the smallest number of second-direction flows can be balanced and adjusted based on the equivalent edge with the largest number of second-direction flows.

[0144] If the fifth number is equal to the sixth number, it means that the first direction flow of the upstream switch corresponding to the equivalent edge with the largest number of second direction flows flowing through the second endpoint switch is the same as the first direction flow of the upstream switch corresponding to the equivalent edge with the smallest number of second direction flows flowing through the second endpoint switch. If adjusted, it will affect the balance of the first direction flows on each equivalent edge.

[0145] Therefore, according to the number of first direction flows in the first direction flow of the second endpoint switch that respectively flows through the upstream switch corresponding to the equivalent edge with the largest number of second direction flows and the upstream switch corresponding to the equivalent edge with the smallest number of second direction flows, it can be judged whether the second direction flow of the second endpoint switch can be balanced without affecting the balance of the first direction flow of the second endpoint switch that has been adjusted, thereby improving the judgment efficiency.

[0146] Exemplarily, if the fifth number of third endpoint switches in at least one second endpoint switch is greater than the sixth number, a second direction flow of the third endpoint switch on the equivalent edge with the largest number of second direction flows can be scheduled to be transmitted on the equivalent edge with the smallest number of second direction flows.

[0147] Therefore, without affecting the balance of the adjusted first direction flow of the second endpoint switch, the second direction flow of the second endpoint switch is balanced, so that the second direction flow of the second endpoint switch is as balanced as possible, thereby improving the overall load balance.

[0148] Combine the following Figure 5 and Figure 6 To explain, Figure 5 The number of inbound flows of IBG_5 on the three equivalent edges between IBG_5 and the upstream switches LEG_1, LEG_2, and LEG_3 are 1, 1, and 2 respectively. The difference between the largest number of inbound flows 2 and the smallest number of inbound flows 1 is 1, indicating that the inbound flows of IBG_5 on the three equivalent edges are balanced.

[0149] Figure 6In the figure, the numbers of inbound flows of IBG_6 on the three equivalent edges between IBG_6 and the upstream switches LEG_1, LEG_2, and LEG_3 are 2, 1, and 0, respectively. The difference between the largest number of inbound flows 2 and the smallest number of inbound flows 0 is 2, which is greater than 1, indicating that the inbound flows of IBG_6 on the three equivalent edges are unbalanced. The equivalent edge with the largest number of inbound flows corresponds to the upstream switch LEG_1, and the equivalent edge with the smallest number of inbound flows corresponds to the upstream switch LEG_3. Among the outbound flows of the source switch IBG_1, the numbers of outbound flows passing through LEG_1 and LEG_3 are both 1, and the numbers of outbound flows passing through LEG_1 and LEG_3 among the outbound flows of the source switch IBG_3 are both 1. It can be seen that the inbound flows on the equivalent edge with the smallest number of inbound flows cannot be balanced based on the inbound flows of IBG_6 with the largest number of inbound flows.

[0150] In the embodiment of the present application, after the first direction flow of each second endpoint switch of any group on each equivalent edge is balanced and adjusted, the second direction flow of the first endpoint switch on each equivalent edge corresponding to the group can be balanced and adjusted when the second direction flow of the first endpoint switch on each equivalent edge with the upstream switch is unbalanced and can be adjusted, thereby improving the balance of the second direction flow of the first endpoint switch on each equivalent edge.

[0151] In order to implement the above embodiment, the embodiment of the present application also proposes a switch load balancing device. Figure 8 A schematic diagram of the structure of a switch load balancing device provided in one embodiment of the present application.

[0152] like Figure 8 As shown, the switch load balancing device 800 includes:

[0153] A first determination module 810, configured to determine a first endpoint switch of a data flow in a cluster;

[0154] A grouping module 820, configured to group the data flow according to the first endpoint switch to obtain at least one group;

[0155] A second determination module 830 is configured to determine, for any group in the at least one group, at least one second endpoint switch of each data flow in the any group;

[0156] The third determination module 840 is used to determine, for any second endpoint switch among the at least one second endpoint switch, a first number of first direction flows of any second endpoint switch on each equivalent edge between the any second endpoint switch and an upstream switch; wherein the first direction flow refers to a data flow in the first direction;

[0157] The balancing adjustment module 850 is configured to balance the first direction flows of any second endpoint switch on each equivalent edge according to the first quantity of the first direction flows of any second endpoint switch on each equivalent edge.

[0158] Optionally, the balance adjustment module 850 is used to:

[0159] According to the first quantity of first direction flows of any second endpoint switch on each of the equivalent edges, determine the equivalent edge with the largest quantity of first direction flows and the equivalent edge with the smallest quantity of first direction flows among the equivalent edges;

[0160] Determine a first equivalent edge from the equivalent edges with the largest number of flows in the first direction;

[0161] Determine a second equivalent edge from the equivalent edges with the smallest number of flows in the first direction;

[0162] Scheduling a second number of first-direction flows on the first equivalent edge to be transmitted on the second equivalent edge;

[0163] Continue to determine the equivalent edge with the largest number of first directional flows and the equivalent edge with the smallest number of first directional flows among the equivalent edges, until the difference in the number of first directional flows between the equivalent edge with the largest number of first directional flows and the equivalent edge with the smallest number of first directional flows is less than or equal to the first threshold.

[0164] Optionally, the balance adjustment module 850 is used to:

[0165] Determine a third quantity of first-direction flows of any second endpoint switch in a target group on each equivalent edge; wherein the target group refers to a balanced and adjusted group in the at least one group;

[0166] Adding the first quantity and the third quantity of the first-directional flow on the same equivalent edge to obtain a fourth quantity of the first-directional flow on the same equivalent edge;

[0167] According to the fourth quantity of the first-directional flows on each of the equivalent edges, an equivalent edge with the largest quantity of the first-directional flows and an equivalent edge with the smallest quantity of the first-directional flows are determined from among the equivalent edges.

[0168] Optionally, the balance adjustment module 850 is used to:

[0169] In the case where the third number remains unchanged, the second number of first-direction flows of any second endpoint switch in any group on the first equivalent edge are scheduled to be transmitted on the second equivalent edge.

[0170] Optionally, the balance adjustment module 850 is used to:

[0171] In response to the fact that there are multiple equivalent edges with the largest number of flows in the first direction, determining the number of data flows flowing through the upstream switch corresponding to each equivalent edge with the largest number of flows in the first direction;

[0172] The equivalent edge corresponding to the upstream switch with the largest number of data flows is determined as the first equivalent edge.

[0173] Optionally, the balance adjustment module 850 is used to:

[0174] In response to the fact that there are multiple equivalent edges with the smallest number of flows in the first direction, determining the number of data flows flowing through each uplink switch corresponding to the equivalent edge with the smallest number of flows in the first direction;

[0175] The equivalent edge corresponding to the upstream switch with the smallest number of data flows is determined as the second equivalent edge.

[0176] Optionally, the first endpoint switch is a destination switch, and the first determining module 810 is configured to:

[0177] Parsing the data stream to determine a destination device of the data stream;

[0178] Determine the switch to which the destination device is connected according to the connection relationship between the device and the switch;

[0179] The switch to which the destination device is connected is determined as the first endpoint switch.

[0180] Optionally, the second endpoint switch is a source switch, and the second determining module 830 is configured to:

[0181] Parsing the data stream to determine the source device of the data stream;

[0182] Determine the switch to which the source device is connected according to the connection relationship between the device and the switch;

[0183] The switch to which the source device is connected is determined as the second endpoint switch.

[0184] Optionally, the device may further include: a second directional flow adjustment module, configured to:

[0185] In response to the imbalance of the second direction flow of the first endpoint switch corresponding to any of the groups on each equivalent edge exchanged with the uplink, it is determined whether the equivalent edge with the largest number of second direction flows can be balanced and adjusted for the equivalent edge with the smallest number of second direction flows; wherein the second direction flow refers to the data flow in the second direction, which is opposite to the first direction;

[0186] If so, then according to the equivalent edge with the largest number of flows in the second direction, the equivalent edge with the smallest number of flows in the second direction is balanced and adjusted, and the equivalent edge with the largest number of flows in the second direction and the equivalent edge with the smallest number of flows in the second direction are re-determined, and it is further determined whether the equivalent edge with the largest number of flows in the second direction can be balanced and adjusted according to the equivalent edge with the largest number of flows in the second direction;

[0187] If not, continue to determine whether the equivalent edge with the smallest number of flows in the second direction can be balanced adjusted according to the equivalent edge with the second largest number of flows in the second direction, until it is determined that the equivalent edge with the smallest number of flows in the second direction cannot be balanced adjusted according to the equivalent edge with the second smallest number of flows in the second direction;

[0188] Continue to determine whether the equivalent edge with the largest number of flows in the second direction can be adjusted according to the equivalent edge with the largest number of flows in the second direction, until the second direction flows of the destination switch corresponding to any group on each of the equivalent edges are balanced, or determine that the equivalent edge with the second largest number of flows in the second direction cannot be balanced and adjusted according to the equivalent edge with the largest number of flows in the second direction.

[0189] Optionally, the second direction flow adjustment module is used to:

[0190] Determine the fifth number of first direction flows of the upstream switch corresponding to the equivalent edge with the largest number of second direction flows in the first direction flows of each second endpoint switch and the sixth number of first direction flows of the upstream switch corresponding to the equivalent edge with the smallest number of second direction flows;

[0191] According to the fifth number and the sixth number of each of the second endpoint switches, determining whether there is a second endpoint switch in the at least one second endpoint switch whose fifth number is greater than the sixth number;

[0192] In response to the fifth number of the third endpoint switches in the at least one second endpoint switch being greater than the sixth number, it is determined that the equivalent edge with the smallest number of second directional flows can be balanced-adjusted based on the equivalent edge with the largest number of second directional flows.

[0193] Optionally, the second direction flow adjustment module is used to:

[0194] A second direction flow on the equivalent edge with the largest number of second direction flows of the third endpoint switch is scheduled to be transmitted on the equivalent edge with the smallest number of second direction flows.

[0195] It should be noted that the explanation of the aforementioned switch load balancing method embodiment is also applicable to the switch load balancing device of this embodiment, so it will not be repeated here.

[0196] In the embodiment of the present application, by grouping the data flow in the cluster according to the first endpoint switch, at least one group is obtained, and for any second endpoint switch of the data flow in any group, according to the number of first direction flows of any second endpoint switch on each equivalent edge between any second endpoint switch and the uplink switch, the outgoing flow of any second endpoint switch on each equivalent edge is balanced and adjusted. Thus, by grouping the data flow according to the first endpoint switch, and then balancing the first direction flows of each second endpoint switch in the group on each equivalent edge, the first direction flows of each second endpoint switch on each equivalent edge can be balanced, which can not only improve the load balancing efficiency, but also improve the data transmission efficiency.

[0197] According to an embodiment of the present application, the present application also provides an electronic device, a readable storage medium and a computer program product.

[0198] Fig. 9 A schematic block diagram of an example electronic device 900 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.

[0199] like Fig. 9 As shown, the device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 902 or a computer program loaded from a storage unit 908 to a RAM (Random Access Memory) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An I / O (Input / Output) interface 905 is also connected to the bus 904.

[0200] A number of components in the device 900 are connected to the I / O interface 905, including: an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the device 900 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0201] The computing unit 901 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units that run machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above, such as the switch load balancing method. For example, in some embodiments, the switch load balancing method may be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as a storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the switch load balancing method described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to execute the switch load balancing method in any other appropriate manner (for example, by means of firmware).

[0202] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a dedicated or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0203] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0204] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0205] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

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

[0207] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services (Virtual Private Server). The server may also be a server of a distributed system, or a server combined with a blockchain.

[0208] According to an embodiment of the present application, the present application further provides a computer program product, which, when an instruction processor in the computer program product is executed, executes the switch load balancing method proposed in the above embodiment of the present application.

[0209] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.

[0210] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.

Claims

1. A switch load balancing method, comprising: Determine a first endpoint switch of a data flow in the cluster; Grouping the data stream according to the first endpoint switch to obtain at least one group; For any group in the at least one group, determining at least one second endpoint switch of each data flow in the any group; For any second endpoint switch among the at least one second endpoint switch, determine a first quantity of first direction flows of any second endpoint switch on each equivalent edge between the any second endpoint switch and an upstream switch; wherein the first direction flow refers to a data flow in a first direction; According to the first quantity of the first direction flows of any second endpoint switch on each equivalent edge, the first direction flows of any second endpoint switch on each equivalent edge are balanced and adjusted.

2. The method of claim 1, wherein: The balancing and adjusting the first direction flows of any second endpoint switch on each equivalent edge according to the first quantity of the first direction flows of any second endpoint switch on each equivalent edge includes: According to the first quantity of first direction flows of any second endpoint switch on each of the equivalent edges, determine the equivalent edge with the largest quantity of first direction flows and the equivalent edge with the smallest quantity of first direction flows among the equivalent edges; Determine a first equivalent edge from the equivalent edges with the largest number of flows in the first direction; Determine a second equivalent edge from the equivalent edges with the smallest number of flows in the first direction; Scheduling a second number of first-direction flows on the first equivalent edge to be transmitted on the second equivalent edge; Continue to determine the equivalent edge with the largest number of first directional flows and the equivalent edge with the smallest number of first directional flows among the equivalent edges, until the difference in the number of first directional flows between the equivalent edge with the largest number of first directional flows and the equivalent edge with the smallest number of first directional flows is less than or equal to the first threshold.

3. The method of claim 2, wherein: The determining, according to the number of first direction flows of any second endpoint switch on each of the equivalent edges, an equivalent edge having the largest number of first direction flows and an equivalent edge having the smallest number of first direction flows among the equivalent edges comprises: Determine a third quantity of first-direction flows of any second endpoint switch in a target group on each equivalent edge; wherein the target group refers to a balanced and adjusted group in the at least one group; Adding the first quantity and the third quantity of the first-directional flow on the same equivalent edge to obtain a fourth quantity of the first-directional flow on the same equivalent edge; According to the fourth quantity of the first-directional flows on each of the equivalent edges, an equivalent edge with the largest quantity of the first-directional flows and an equivalent edge with the smallest quantity of the first-directional flows are determined from among the equivalent edges.

4. The method of claim 3, wherein: The step of scheduling the second number of first-direction flows on the first equivalent edge to be transmitted on the second equivalent edge includes: In the case where the third number remains unchanged, the second number of first-direction flows of any second endpoint switch in any group on the first equivalent edge are scheduled to be transmitted on the second equivalent edge.

5. The method of claim 2, wherein: The determining of the first equivalent edge from the equivalent edges with the largest number of flows in the first direction includes: In response to the fact that there are multiple equivalent edges with the largest number of flows in the first direction, determining the number of data flows flowing through the upstream switch corresponding to each equivalent edge with the largest number of flows in the first direction; The equivalent edge corresponding to the upstream switch with the largest number of data flows is determined as the first equivalent edge.

6. The method of claim 2, wherein: The step of determining the second equivalent edge from the equivalent edges with the smallest number of flows in the first direction includes: In response to the fact that there are multiple equivalent edges with the smallest number of flows in the first direction, determining the number of data flows flowing through each uplink switch corresponding to the equivalent edge with the smallest number of flows in the first direction; The equivalent edge corresponding to the upstream switch with the smallest number of data flows is determined as the second equivalent edge.

7. The method of claim 1, wherein: The first endpoint switch is a destination switch, and the step of determining the first endpoint switch of the data flow in the cluster includes: Parsing the data stream to determine a destination device of the data stream; Determine the switch to which the destination device is connected according to the connection relationship between the device and the switch; The switch to which the destination device is connected is determined as the first endpoint switch.

8. The method of claim 1, wherein: The second endpoint switch is a source switch, and the determining of at least one second endpoint switch of each data flow in any one of the packets includes: Parsing the data stream to determine the source device of the data stream; Determine the switch to which the source device is connected according to the connection relationship between the device and the switch; The switch to which the source device is connected is determined as the second endpoint switch.

9. The method according to any one of claims 1 to 8, further comprising: In response to the imbalance of the second direction flow of the first endpoint switch corresponding to any of the groups on each equivalent edge exchanged with the uplink, it is determined whether the equivalent edge with the largest number of second direction flows can be balanced and adjusted for the equivalent edge with the smallest number of second direction flows; wherein the second direction flow refers to the data flow in the second direction, which is opposite to the first direction; If so, then according to the equivalent edge with the largest number of flows in the second direction, the equivalent edge with the smallest number of flows in the second direction is balanced and adjusted, and the equivalent edge with the largest number of flows in the second direction and the equivalent edge with the smallest number of flows in the second direction are re-determined, and it is further determined whether the equivalent edge with the largest number of flows in the second direction can be balanced and adjusted according to the equivalent edge with the largest number of flows in the second direction; If not, continue to determine whether the equivalent edge with the smallest number of flows in the second direction can be balanced adjusted according to the equivalent edge with the second largest number of flows in the second direction, until it is determined that the equivalent edge with the smallest number of flows in the second direction cannot be balanced adjusted according to the equivalent edge with the second smallest number of flows in the second direction; Continue to determine whether the equivalent edge with the largest number of flows in the second direction can be adjusted according to the equivalent edge with the largest number of flows in the second direction, until the second direction flows of the destination switch corresponding to any group on each of the equivalent edges are balanced, or determine that the equivalent edge with the second largest number of flows in the second direction cannot be balanced and adjusted according to the equivalent edge with the largest number of flows in the second direction.

10. The method of claim 9, wherein: The determining whether the equivalent edge with the largest number of flows in the second direction can be balanced and adjusted according to the equivalent edge with the largest number of flows in the second direction includes: Determine the fifth number of first direction flows of the upstream switch corresponding to the equivalent edge with the largest number of second direction flows in the first direction flows of each second endpoint switch and the sixth number of first direction flows of the upstream switch corresponding to the equivalent edge with the smallest number of second direction flows; According to the fifth number and the sixth number of each of the second endpoint switches, determining whether there is a second endpoint switch in the at least one second endpoint switch whose fifth number is greater than the sixth number; In response to the fifth number of the third endpoint switches in the at least one second endpoint switch being greater than the sixth number, it is determined that the equivalent edge with the smallest number of second directional flows can be balanced-adjusted based on the equivalent edge with the largest number of second directional flows.

11. The method of claim 10, wherein: The step of balancing and adjusting the equivalent edge with the smallest number of flows in the second direction according to the equivalent edge with the largest number of flows in the second direction includes: A second direction flow on the equivalent edge with the largest number of second direction flows of the third endpoint switch is scheduled to be transmitted on the equivalent edge with the smallest number of second direction flows.

12. A switch load balancing device, comprising: A first determination module, used to determine a first endpoint switch of a data flow in the cluster; A grouping module, configured to group the data stream according to the first endpoint switch to obtain at least one group; A second determination module, configured to determine, for any group in the at least one group, at least one second endpoint switch of each data flow in the any group; A third determination module is used to determine, for any second endpoint switch among the at least one second endpoint switch, a first number of first direction flows of any second endpoint switch on each equivalent edge between the any second endpoint switch and an upstream switch; wherein the first direction flow refers to a data flow in the first direction; The balancing adjustment module is used to balance the first direction flow of any second endpoint switch on each equivalent edge according to the first quantity of the first direction flow of any second endpoint switch on each equivalent edge.

13. The device of claim 12, wherein: The balance adjustment module is used for: According to the first quantity of first direction flows of any second endpoint switch on each of the equivalent edges, determine the equivalent edge with the largest quantity of first direction flows and the equivalent edge with the smallest quantity of first direction flows among the equivalent edges; Determine a first equivalent edge from the equivalent edges with the largest number of flows in the first direction; Determine a second equivalent edge from the equivalent edges with the smallest number of flows in the first direction; Scheduling a second number of first-direction flows on the first equivalent edge to be transmitted on the second equivalent edge; Continue to determine the equivalent edge with the largest number of first directional flows and the equivalent edge with the smallest number of first directional flows among the equivalent edges, until the difference in the number of first directional flows between the equivalent edge with the largest number of first directional flows and the equivalent edge with the smallest number of first directional flows is less than or equal to the first threshold.

14. The device of claim 13, wherein: The balance adjustment module is used for: Determine a third quantity of first-direction flows of any second endpoint switch in a target group on each equivalent edge; wherein the target group refers to a balanced and adjusted group in the at least one group; Adding the first quantity and the third quantity of the first-directional flow on the same equivalent edge to obtain a fourth quantity of the first-directional flow on the same equivalent edge; According to the fourth quantity of the first-directional flows on each of the equivalent edges, an equivalent edge with the largest quantity of the first-directional flows and an equivalent edge with the smallest quantity of the first-directional flows are determined from among the equivalent edges.

15. The device of claim 14, wherein: The balance adjustment module is used for: In the case where the third number remains unchanged, the second number of first-direction flows of any second endpoint switch in any group on the first equivalent edge are scheduled to be transmitted on the second equivalent edge.

16. The device of claim 13, wherein: The balance adjustment module is used for: In response to the fact that there are multiple equivalent edges with the largest number of flows in the first direction, determining the number of data flows flowing through the upstream switch corresponding to each equivalent edge with the largest number of flows in the first direction; The equivalent edge corresponding to the upstream switch with the largest number of data flows is determined as the first equivalent edge.

17. The device of claim 13, wherein: The balance adjustment module is used for: In response to the fact that there are multiple equivalent edges with the smallest number of flows in the first direction, determining the number of data flows flowing through each uplink switch corresponding to the equivalent edge with the smallest number of flows in the first direction; The equivalent edge corresponding to the upstream switch with the smallest number of data flows is determined as the second equivalent edge.

18. The device of claim 12, wherein: The first endpoint switch is a destination switch, and the first determining module is used to: Parsing the data stream to determine a destination device of the data stream; Determine the switch to which the destination device is connected according to the connection relationship between the device and the switch; The switch to which the destination device is connected is determined as the first endpoint switch.

19. The device of claim 12, wherein: The second endpoint switch is a source switch, and the second determining module is used to: Parsing the data stream to determine the source device of the data stream; Determine the switch to which the source device is connected according to the connection relationship between the device and the switch; The switch to which the source device is connected is determined as the second endpoint switch.

20. The device according to any one of claims 12 to 19, further comprising: The second direction flow adjustment module is used for: In response to the imbalance of the second direction flow of the first endpoint switch corresponding to any of the groups on each equivalent edge exchanged with the uplink, it is determined whether the equivalent edge with the largest number of second direction flows can be balanced and adjusted for the equivalent edge with the smallest number of second direction flows; wherein the second direction flow refers to the data flow in the second direction, which is opposite to the first direction; If so, then according to the equivalent edge with the largest number of flows in the second direction, the equivalent edge with the smallest number of flows in the second direction is balanced and adjusted, and the equivalent edge with the largest number of flows in the second direction and the equivalent edge with the smallest number of flows in the second direction are re-determined, and it is further determined whether the equivalent edge with the largest number of flows in the second direction can be balanced and adjusted according to the equivalent edge with the largest number of flows in the second direction; If not, continue to determine whether the equivalent edge with the smallest number of flows in the second direction can be balanced adjusted according to the equivalent edge with the second largest number of flows in the second direction, until it is determined that the equivalent edge with the smallest number of flows in the second direction cannot be balanced adjusted according to the equivalent edge with the second smallest number of flows in the second direction; Continue to determine whether the equivalent edge with the largest number of flows in the second direction can be adjusted according to the equivalent edge with the largest number of flows in the second direction, until the second direction flows of the destination switch corresponding to any group on each of the equivalent edges are balanced, or determine that the equivalent edge with the second largest number of flows in the second direction cannot be balanced and adjusted according to the equivalent edge with the largest number of flows in the second direction.

21. The device of claim 20, wherein: The second direction flow adjustment module is used to: Determine the fifth number of first direction flows of the upstream switch corresponding to the equivalent edge with the largest number of second direction flows in the first direction flows of each second endpoint switch and the sixth number of first direction flows of the upstream switch corresponding to the equivalent edge with the smallest number of second direction flows; According to the fifth number and the sixth number of each of the second endpoint switches, determining whether there is a second endpoint switch in the at least one second endpoint switch whose fifth number is greater than the sixth number; In response to the fifth number of the third endpoint switches in the at least one second endpoint switch being greater than the sixth number, it is determined that the equivalent edge with the smallest number of second directional flows can be balanced-adjusted based on the equivalent edge with the largest number of second directional flows.

22. The device of claim 21, wherein: The second direction flow adjustment module is used to: A second direction flow on the equivalent edge with the largest number of second direction flows of the third endpoint switch is scheduled to be transmitted on the equivalent edge with the smallest number of second direction flows.

23. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 11.

24. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-11.

25. A computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 11.