Disclosure of Invention
The embodiment of the invention provides a load balancing method and device of network equipment based on a CLOS framework, which are used for solving the problems of unbalanced load of the network equipment and loss of forwarding flow in the prior art.
The embodiment of the invention provides a load balancing method of network equipment based on a CLOS framework, which is applied to the network equipment comprising at least one switching matrix board card and at least one service board card, and comprises the following steps:
detecting whether a panel bandwidth and a back board bandwidth are equal, wherein the panel bandwidth is the sum of bandwidths of all ports of the at least one service board card, and the back board bandwidth is the sum of bandwidths provided by the at least one switching matrix board card;
if the panel bandwidth is equal to the backboard bandwidth, selecting a first preset load balancing algorithm for load balancing;
and if the panel bandwidth is not equal to the backboard bandwidth, selecting a second preset load balancing algorithm to perform load balancing.
The second preset load balancing algorithm is a load balancing algorithm based on message content; the first load balancing algorithm is a load balancing algorithm based on a source port.
Optionally, the method further comprises:
obtaining the panel bandwidth according to the port number and the port rate of the at least one service board card;
and obtaining the backplane bandwidth according to the number of backplane ports and the backplane port rate of the interconnection of the at least one switching matrix board card and the at least one service board card.
Optionally, when a second preset load balancing algorithm is selected for load balancing, the method further includes:
acquiring the flow rate of a backplane port of the at least one switching matrix board card according to a first preset period;
calculating to obtain a maximum flow deviation value of the backboard opening according to the flow rate;
and when the maximum flow deviation value is larger than a preset flow deviation threshold value, adjusting the second preset load balancing algorithm by adjusting a balancing factor.
Optionally, when a second preset load balancing algorithm is selected for load balancing, the method further includes:
acquiring the flow rate of a backplane port of the at least one switching matrix board card according to a second preset period;
and when the flow rate of the first backboard port reaches a first preset flow rate threshold value and the flow rates of other backboard ports do not exceed respective corresponding second preset flow rate threshold values, adjusting the second preset load balancing algorithm by adjusting the balancing factor.
An embodiment of the present invention further provides a load balancing apparatus for a network device based on a CLOS architecture, where the apparatus is applied to a network device including at least one switching matrix board card and at least one service board card, and the apparatus includes: the device comprises a bandwidth detection module and an algorithm determination module; wherein,
the bandwidth detection module is configured to detect whether a panel bandwidth and a backplane bandwidth are equal, where the panel bandwidth is a sum of bandwidths of all ports of the at least one service board card, and the backplane bandwidth is a sum of bandwidths provided by the at least one switching matrix board card;
the algorithm determining module is used for selecting a first preset load balancing algorithm to perform load balancing if the panel bandwidth is equal to the backboard bandwidth; and if the panel bandwidth is not equal to the backboard bandwidth, selecting a second preset load balancing algorithm to perform load balancing.
The second preset load balancing algorithm is a load balancing algorithm based on message content; the first load balancing algorithm is a load balancing algorithm based on a source port.
Optionally, the bandwidth detection module is further configured to obtain the panel bandwidth according to the port number and the port rate of the at least one service board card; and obtaining the backplane bandwidth according to the number of backplane ports and the backplane port rate of the interconnection of the at least one switching matrix board card and the at least one service board card.
Optionally, the apparatus further comprises: the flow detection module and the algorithm adjustment module; wherein,
the traffic detection module is used for determining the traffic rate of the backplane port of the at least one switching matrix board card according to a first preset period when a second preset load balancing algorithm is selected for load balancing; calculating to obtain a maximum flow deviation value of the backboard opening according to the flow rate;
and the algorithm adjusting module is used for adjusting the second preset load balancing algorithm by adjusting a balancing factor when the maximum flow deviation value is larger than a preset flow deviation threshold value.
Optionally, the apparatus further comprises: the flow detection module and the algorithm adjustment module; wherein,
the traffic detection module is configured to, when a second preset load balancing algorithm is selected for load balancing, obtain a traffic rate of a backplane port of the at least one switch matrix board card according to a second preset period;
and the algorithm adjusting module is used for adjusting the second preset load balancing algorithm by adjusting the balancing factor when the flow rate of the first backboard port reaches a first preset flow rate threshold and the flow rates of other backboard ports do not exceed respective corresponding second preset flow rate thresholds.
The invention has the following beneficial effects:
according to the load balancing method and device for the network equipment based on the CLOS framework, provided by the embodiment of the invention, whether a panel bandwidth and a back plate bandwidth are equal or not is detected, wherein the panel bandwidth is the sum of bandwidths of all ports of at least one service board card, and the back plate bandwidth is the sum of bandwidths provided by at least one switching matrix board card; if the panel bandwidth is equal to the backboard bandwidth, selecting a first preset load balancing algorithm for load balancing; and if the panel bandwidth is not equal to the backboard bandwidth, selecting a second preset load balancing algorithm to perform load balancing. The second preset load balancing algorithm is a load balancing algorithm based on message content; the first load balancing algorithm is a load balancing algorithm based on a source port. According to the embodiment of the invention, the load balancing algorithm is selected in a self-adaptive manner according to the backboard bandwidth and the panel bandwidth in the operation process of the network equipment, so that the accuracy of algorithm selection is ensured. The load balancing effect can be detected based on the actual network flow, and when the effect is poor, the load balancing algorithm can be adjusted by automatically adjusting the balancing factor, so that the manual intervention is greatly reduced, the resources are saved, the embodiment of the invention can accelerate the fault recovery when the port has load deviation, and the stability of the network is ensured.
Detailed Description
Aiming at the problems of unbalanced network equipment load and lost forwarding flow in the prior art, the load balancing method of the network equipment based on the CLOS framework provided by the embodiment of the invention ensures the accuracy of algorithm selection by adaptively selecting a load balancing algorithm according to the back plate bandwidth and the panel bandwidth in the running process of the network equipment. The flow of the method of the present invention is shown in fig. 1, and the method is applied to a network device including at least one switching matrix board card and at least one service board card, and the steps are executed as follows:
step 101, detecting whether a panel bandwidth and a backplane bandwidth are equal, wherein the panel bandwidth is the sum of bandwidths of all ports of the at least one service board card, and the backplane bandwidth is the sum of bandwidths provided by the at least one switching matrix board card;
the network device may include a plurality of traffic boards and a plurality of switch matrix boards. The panel bandwidth refers to the sum of bandwidths of all panel ports of the service board card, namely the number of the panel ports and the rate of the panel ports; the backplane bandwidth refers to the line speed bandwidth that all the switching matrix board cards can provide, and is limited by the chip capacity of the service board cards because the number of the ports of the service board cards and the switching matrix board cards which are interconnected is fixed; for example, if the number of backplane ports where the service board and each switch matrix board are interconnected is M, and the number of switch matrix boards is N, the backplane bandwidth is M × N × backplane port rate.
102, if the panel bandwidth is equal to the backboard bandwidth, selecting a first preset load balancing algorithm to perform load balancing;
step 103, if the panel bandwidth is not equal to the backplane bandwidth, selecting a second preset load balancing algorithm for load balancing. ,
further, the second preset load balancing algorithm is a load balancing algorithm based on message content; the first load balancing algorithm is a load balancing algorithm based on a source port.
In step 102, when the panel bandwidth and the backplane bandwidth are equal, a load balancing algorithm based on a source port may be adopted, that is, which backplane port the message is forwarded from is determined according to the source port of the message, because the panel bandwidth of the service board card is equal to the backplane bandwidth of the switching matrix board card, the panel port and the backplane port are in one-to-one correspondence when forwarding by adopting the load balancing algorithm based on the source port, so that full loading of the panel is realized, and the problem of packet loss is avoided.
In step 103, when the panel bandwidth and the backplane bandwidth are not equal, a load balancing algorithm based on message content may be adopted; the load balancing algorithm based on the message content performs load balancing according to the message fields specified by user configuration, wherein the message fields are balancing factors, such as message fields src-mac, dst-mac, L2-protocol, vlan and src-port corresponding to the L2 message; corresponding fields of an ipv4 message, src-ip, dst-ip, protocol, l4-src-port, l4-dst-port, vlan and src-port; fields src-ip, dst-ip, protocol, l4-src-port, l4-dst-port, vlan and src-port of the ipv6 message; and the fields top-label, 2 nd-label, src-ip, dst-ip, vlan, src-port and the like corresponding to the mpls message. Load balancing can be performed according to a plurality of field combinations with different message types.
Further, the method further comprises:
obtaining the panel bandwidth according to the port number and the port rate of the at least one service board card;
and obtaining the backplane bandwidth according to the number of backplane ports and the backplane port rate of the interconnection of the at least one switching matrix board card and the at least one service board card.
It should be understood that the panel bandwidth and the backplane bandwidth may also be stored directly in the network device as configuration parameters.
Further, when a second preset load balancing algorithm is selected for load balancing, the method further includes:
acquiring the flow rate of a backplane port of the at least one switching matrix board card according to a first preset period;
calculating to obtain a maximum flow deviation value of the backboard opening according to the flow rate; here, the maximum flow deviation value may be calculated according to the existing calculation formula of the deviation value and the flow rate, which is not limited in the embodiment of the present invention.
And when the maximum flow deviation value is larger than a preset flow deviation threshold value, adjusting the second preset load balancing algorithm by adjusting a balancing factor.
Further, when a second preset load balancing algorithm is selected for load balancing, the method further includes:
acquiring the flow rate of a backplane port of the at least one switching matrix board card according to a second preset period;
and when the flow rate of the first backboard port reaches a first preset flow rate threshold value and the flow rates of other backboard ports do not exceed respective corresponding second preset flow rate threshold values, adjusting the second preset load balancing algorithm by adjusting the balancing factor. Preferably, when the flow rate of one backplane port (for convenience of description, referred to as a first backplane port) reaches 90% of the port rate, and the flow rates of the other ports do not exceed 30% of the corresponding port rates, the equalization factor is adjusted to adjust the second preset equalization algorithm. Specifically, for the messages of different message types, the second preset equalization algorithm may be adjusted by increasing or decreasing or changing the equalization factor corresponding to each message type.
Based on the same inventive concept, an embodiment of the present invention provides a load balancing apparatus for a network device based on a CLOS architecture, where the apparatus is applied to a network device including at least one switch matrix board and at least one service board, and a structure of the apparatus is shown in fig. 2, where the apparatus includes: a bandwidth detection module 21, an algorithm determination module 22; wherein,
the bandwidth detection module 21 is configured to detect whether a panel bandwidth and a backplane bandwidth are equal, where the panel bandwidth is a sum of bandwidths of all ports of the at least one service board card, and the backplane bandwidth is a sum of bandwidths provided by the at least one switching matrix board card;
the algorithm determining module 22 is configured to select a first preset load balancing algorithm for load balancing if the panel bandwidth is equal to the backplane bandwidth; and if the panel bandwidth is not equal to the backboard bandwidth, selecting a second preset load balancing algorithm to perform load balancing.
The second preset load balancing algorithm is a load balancing algorithm based on message content; the first load balancing algorithm is a load balancing algorithm based on a source port.
Further, the bandwidth detection module 21 is further configured to obtain the panel bandwidth according to the port number and the port rate of the at least one service board card; and obtaining the backplane bandwidth according to the number of backplane ports and the backplane port rate of the interconnection of the at least one switching matrix board card and the at least one service board card.
Optionally, the apparatus further comprises: the flow detection module and the algorithm adjustment module; wherein,
the traffic detection module is used for determining the traffic rate of the backplane port of the at least one switching matrix board card according to a first preset period when a second preset load balancing algorithm is selected for load balancing; calculating to obtain a maximum flow deviation value of the backboard opening according to the flow rate;
and the algorithm adjusting module is used for adjusting the second preset load balancing algorithm by adjusting a balancing factor when the maximum flow deviation value is larger than a preset flow deviation threshold value.
Optionally, the apparatus further comprises: the flow detection module and the algorithm adjustment module; wherein,
the traffic detection module is configured to, when a second preset load balancing algorithm is selected for load balancing, obtain a traffic rate of a backplane port of the at least one switch matrix board card according to a second preset period;
and the algorithm adjusting module is used for adjusting the second preset load balancing algorithm by adjusting the balancing factor when the flow rate of the first backboard port reaches a first preset flow rate threshold and the flow rates of other backboard ports do not exceed respective corresponding second preset flow rate thresholds.
It should be understood that the implementation principle and process of the load balancing apparatus for network devices based on CLOS architecture according to the embodiment of the present invention are similar to those of the foregoing fig. 1 and the illustrated embodiment, and are not described herein again.
According to the load balancing method and device for the network equipment based on the CLOS framework, whether a panel bandwidth and a back plate bandwidth are equal or not is detected, wherein the panel bandwidth is the sum of bandwidths of all ports of at least one service board card, and the back plate bandwidth is the sum of bandwidths provided by at least one switching matrix board card; if the panel bandwidth is equal to the backboard bandwidth, selecting a first preset load balancing algorithm for load balancing; and if the panel bandwidth is not equal to the backboard bandwidth, selecting a second preset load balancing algorithm to perform load balancing. The second preset load balancing algorithm is a load balancing algorithm based on message content; the first load balancing algorithm is a load balancing algorithm based on a source port. According to the embodiment of the invention, the load balancing algorithm is selected in a self-adaptive manner according to the backboard bandwidth and the panel bandwidth in the operation process of the network equipment, so that the accuracy of algorithm selection is ensured. The load balancing effect can be detected based on the actual network flow, and when the effect is poor, the load balancing algorithm can be adjusted by automatically adjusting the balancing factor, so that the manual intervention is greatly reduced, the resources are saved, the embodiment of the invention can accelerate the fault recovery when the port has load deviation, and the stability of the network is ensured.
Those of ordinary skill in the art will understand that: the figures are merely schematic representations of one embodiment, and the blocks or flow diagrams in the figures are not necessarily required to practice the present invention.
From the above description of the embodiments, it is clear to those skilled in the art that the present invention can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which may be stored in a storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for apparatus or system embodiments, since they are substantially similar to method embodiments, they are described in relative terms, as long as they are described in partial descriptions of method embodiments. The above-described embodiments of the apparatus and system are merely illustrative, and the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
In addition, in some of the flows described in the above embodiments and the drawings, a plurality of operations are included in a specific order, but it should be clearly understood that the operations may be executed out of the order presented herein or in parallel, and the sequence numbers of the operations, such as 201, 202, 203, etc., are merely used for distinguishing different operations, and the sequence numbers themselves do not represent any execution order. Additionally, the flows may include more or fewer operations, and the operations may be performed sequentially or in parallel. It should be noted that, the descriptions of "first", "second", etc. in this document are used for distinguishing different messages, devices, modules, etc., and do not represent a sequential order, nor limit the types of "first" and "second" to be different.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While alternative embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following appended claims be interpreted as including alternative embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made in the embodiments of the present invention without departing from the spirit or scope of the embodiments of the invention. Thus, if such modifications and variations of the embodiments of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to encompass such modifications and variations.