CN-116743661-B - LACP load balancing method and system
Abstract
The invention discloses a method and a system for LACP load balancing, wherein the method comprises the steps of counting the quantity, the speed and the load balancing parameters of a message segment of a service message forwarded by a selected active port in an aggregation link through a load balancing state machine in a set time period, calculating the weight of the quantity of the service message forwarded by the port counted by the load balancing state machine in an integral aggregation link through a load balancing monitoring unit after the set time period is over, judging whether the set load sharing mode switching condition is met in the current counting period according to the weight and the load balancing parameters, and if the load sharing mode switching condition is met and the current LACP load balancing mode is not the optimal load balancing mode, notifying the LACP to be switched to the optimal load balancing mode. The invention can timely inform LACP to switch proper load balancing mode when the flow distribution is uneven, so as to cope with the change of network environment, and the flow can be distributed on each member link relatively uniformly.
Inventors
- Tao Mengxiong
- ZHOU HOUMING
- CHEN NAN
Assignees
- 武汉迈威通信股份有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20230529
Claims (6)
- 1. A method of LACP load balancing, the method comprising: in a set time period, counting the quantity and the speed of forwarding service messages of the selected active ports in the aggregation link and the load balancing parameters under the message segment through a load balancing state machine; After the set time period is over, calculating the weight of the quantity of the service messages forwarded by the ports counted by the load balancing state machine in the whole aggregation link through the load balancing monitoring unit; The weight is calculated in the following way: ; wherein R is a weight; Judging whether a set load sharing mode switching condition is met in a current statistical period according to the weight and the load balancing parameter, calculating an optimal load balancing mode in the current statistical period according to the load balancing parameter, if the load sharing mode switching condition is met and the current LACP load balancing mode is not the optimal load balancing mode, informing that the LACP is switched to the optimal load balancing mode, simultaneously clearing the statistical result of a port in a load balancing state machine, and entering the next time period; the judging whether the set load sharing mode switching condition is met in the current statistical period according to the weight and the load balancing parameter specifically comprises the following steps: the following load sharing mode switching conditions are set: ① The movable port is not less than 1; ② The flow weight R of the active port is not in a reasonable weight interval [ , Within ], N 1 represents the maximum active port number and N 1 >1; ③ There is a better load sharing mode; When the above 3 load sharing mode switching conditions are all satisfied, the traffic flow in the current statistical period is uneven, and the LACP needs to be notified to switch the load sharing mode.
- 2. The method of LACP load balancing according to claim 1, wherein before the counting, by the load balancing state machine, the number, rate, and load balancing parameters under the message field of forwarding service packets by the selected active ports in the aggregated link further comprises: when the LACP operates, the message statistical information and the load balancing parameter statistical information of the LACP port are initialized, and after the aggregated link election is stable, the load balancing state machine starts to work, and simultaneously, the timer starts to work.
- 3. The method of LACP load balancing according to claim 2, wherein the load balancing parameters include source MAC, destination MAC, source and destination MAC, source IP, destination IP, and source and destination IP.
- 4. The method of LACP load balancing according to claim 3, wherein before the calculating, by the load balancing monitoring unit, the weight of the number of traffic messages forwarded by the ports counted by the load balancing state machine in the overall aggregated link, the method further comprises: In the continuous working process of the load balancing state machine in the set time period, when the uneven and overlarge difference of the service flow occurs or the set time period expires, the load balancing monitoring unit is started to analyze the forwarding condition of the service message in the aggregation link.
- 5. The LACP load balancing method according to claim 1, wherein the manner of determining whether a better load sharing mode exists is: Calculating an optimal load balancing mode in a current statistical period according to the load balancing parameters, and judging whether the current LACP load balancing mode is consistent with the optimal load balancing mode or not; the calculating the optimal load balancing mode in the current statistical period according to the load balancing parameters specifically comprises the following steps: the most-typed parameter in six types of load balancing parameters including source MAC, destination MAC, source and destination MAC, source IP, destination IP and source and destination IP is selected as the optimal load balancing parameter for the calculation of the round.
- 6. A system for LACP load balancing, for performing a method of LACP load balancing according to any one of claims 1-5, the system comprising: the data statistics module is used for counting the quantity and the speed of the forwarding service messages of the selected active ports in the aggregation link and the load balancing parameters under the message segment through the load balancing state machine in a set time period; The weight calculation module is used for calculating the weight of the number of the service messages forwarded by the port counted by the load balancing state machine in the whole aggregation link through the load balancing monitoring unit after the set time period is over; And the mode switching module is used for judging whether the set load sharing mode switching condition is met in the current statistical period according to the weight and the load balancing parameter, calculating the optimal load balancing mode in the current statistical period according to the load balancing parameter, and if the load sharing mode switching condition is met and the current LACP load balancing mode is not the optimal load balancing mode, informing the LACP to switch to the optimal load balancing mode, simultaneously clearing the statistical result of the ports in the load balancing state machine and entering the next time period.
Description
LACP load balancing method and system Technical Field The invention belongs to the field of industrial Ethernet switches, and particularly relates to a LACP load balancing method and system. Background Link Aggregation (Link Aggregation) refers to a method of bundling a set of physical ports together as a logical interface to increase bandwidth. By establishing a link aggregation group (Link Aggregation Group) between two devices, higher communication bandwidth and higher reliability can be provided, without requiring hardware upgrades, and also redundancy protection for the communication of the two devices. The LACP (Link Aggregation Control Protocol ) based on IEEE802.3ad standard is a protocol for realizing dynamic aggregation of links, provides a standard negotiation mode for devices exchanging data, forms an aggregation link according to the configuration (namely rate, duplex, basic configuration and management Key) of the ports of the devices, and starts the aggregation link to transmit and receive data. After the aggregation link is formed, the LACP is responsible for maintaining the link state, and when the aggregation condition is changed, the link aggregation is automatically adjusted or released, so that the two-end equipment can agree on the port joining or exiting a certain dynamic aggregation group, a plurality of connected ports are bound into a logic connection, and the bandwidth after binding is the sum of the bandwidths of the selected active ports. When the traffic on the ports increases to become a bottleneck limiting the performance of the network, the switch supporting the characteristic can easily increase the bandwidth of the network, and the active member ports in the aggregation group share the traffic according to the appointed mode. The link aggregation technology is widely applied in the datA transmission process, realizes the sharing of outgoing/incoming loads in each member port in A convergence group, simultaneously provides higher connection reliability, is difficult to utilize ideal maximum bandwidth in the actual application process although the bandwidth after link aggregation can be multiplied, and has traffic congestion accompanied by unbalanced member link loads, packet loss can occur in extreme cases to influence the normal operation of the service, the current link aggregation technology is in A load balancing mode configured fixedly, and the load balancing mode cannot be flexibly adjusted according to real-time network environments, so that the traffic of different service scenes can be uniformly distributed in member links, as shown in A convergence link schematic diagram in fig. 1, other PCs (personal computer-A) are required to communicate with other PCs at the other end, if the load sharing algorithm of the convergence link is configured as source MAC (mediA access control) or source IP (Internet protocol), the service message can only pass through one of the convergence links at the moment, the load sharing is not realized in practice, and the network traffic is unevenly distributed in the convergence link. The invention patent with publication number CN105490958A discloses a method and a system for load balancing of LACP, which adopts a message field to realize a load balancing mechanism, calculates a sub-link and load balancing parameters under the message field, selects the load balancing parameter with the smallest as the optimal load balancing mechanism, but the whole calculation process is complicated, and is not beneficial to the dynamic adjustment of a load balancing mode. Therefore, a more flexible and faster LACP load balancing scheme needs to be designed to quickly realize uniform distribution of aggregate link network traffic and more efficiently utilize aggregate link bandwidths. Disclosure of Invention In view of this, the invention provides a method and a system for LACP load balancing, which are used for solving the problem that the existing LACP load balancing mode cannot be dynamically adjusted in time. In a first aspect of the present invention, a method for LACP load balancing, the method includes: in a set time period, counting the quantity and the speed of forwarding service messages of the selected active ports in the aggregation link and the load balancing parameters under the message segment through a load balancing state machine; After the set time period is over, calculating the weight of the quantity of the service messages forwarded by the ports counted by the load balancing state machine in the whole aggregation link through the load balancing monitoring unit; Judging whether a set load sharing mode switching condition is met in a current statistical period according to the weight and the load balancing parameter, calculating an optimal load balancing mode in the current statistical period according to the load balancing parameter, and if the load sharing mode switching condition is met and the current LACP load balancing mode is n