Aggregated links load sharing method and device
Technical field
The present invention relates to the link aggregation technical field, be specifically related to aggregated links load sharing method and device.
Background technology
Link aggregation is the normal a kind of technology of disposing of Ethernet, by a plurality of physical interfaces being pooled a logic interface, has increased link bandwidth and reliability.Fig. 1 has provided existing representative link polymerization schematic diagram.
Adopt the major advantage of link aggregation as follows:
Bandwidth is linear to be increased: in theory, bandwidth is the bandwidth sum of all links in the aggregated links group;
Reliability increases: the damage of a link can not cause the failure of whole transmission;
Load balancing: user's flow is assigned on each link and transmits;
Dynamic-configuration: lack in the situation of human configuration, the aggregated links group can dynamic-configuration, and link can dynamically add the aggregated links group;
Predictability as a result: according to the algorithm of selecting, the link aggregation configuration problem-solving ability is deterministic, for example, polymerization can be independent of the order that event occurs, and the result of polymerization is determined by ability and their physical connection of each link in the aggregated links group.
Wherein, load balancing generally adopts the HASH algorithm, according to some field of message or the ingress port information that enters the network equipment, carries out HASH and calculates, and determines the physical outlet of flow according to result of calculation.Whether load balancing evenly is the standard of judging its algorithm quality.
Switch device is all supported multiple load balancing algorithm at present, to satisfy the multiple business demand.The network manager can check and configuration by manual, determine optimal load balancing algorithm.
Existing load balancing algorithm for link aggregation group has following two shortcomings:
One, specific to real network, the network manager and do not know which kind of load balancing algorithm can share ground more even, need manual configuration to verify one by one, just can find the most uniform load balancing algorithm, for large-scale networking, a lot of aggregated links are arranged, workload is very large; Often adopt first default load to share algorithm, if there is packet loss, use other load balancing algorithm instead again, this method belongs to remedial measure, can't prevent trouble before it happens.
If two Networks change, the business after the improper variation of current load balancing algorithm, not having a kind of mechanism can the informing network keeper make amendment.
Summary of the invention
The invention provides aggregated links load sharing method and device, to improve aggregated links load balancing efficient.
Technical scheme of the present invention is achieved in that
A kind of aggregated links load sharing method, at the multiple load balancing algorithm of network equipment configuration, the method comprises in advance:
The network equipment starts, and for the every kind of load balancing algorithm that self configures, duration is preset in test respectively;
In each length of testing speech, the load balancing algorithm that adopts current test with the inbound port traffic sharing to each member port of aggregated links group, and when test finishes, calculate the bandwidth of each member port of aggregated links group, calculate and record the difference of member port maximum bandwidth and minimum bandwidth;
When all load balancing algorithms all are completed, select load balancing algorithm corresponding to minimum bandwidth difference as the final load balancing algorithm that adopts.
Load balancing algorithm corresponding to described selection minimum bandwidth difference further comprises as the final load balancing algorithm that adopts afterwards:
The network equipment periodically detects the bandwidth of each member port of aggregated links group, calculate and record the difference of member port maximum bandwidth and minimum bandwidth, judge whether the bandwidth difference that this cycle obtains is not more than the bandwidth difference that the last cycle obtains, if keep present load to share algorithm constant; Otherwise, return described every kind of load balancing algorithm for self configuring, respectively the action of the default duration of test.
A kind of in the described multiple load balancing algorithm shares algorithm for default load,
And, described every kind of load balancing algorithm for self configuring, the default duration of test is respectively:
At first test default load and share algorithm, then test other load balancing algorithm.
Load balancing algorithm corresponding to described selection minimum bandwidth difference comprises as the final load balancing algorithm that adopts:
When the corresponding multiple load balancing algorithm of minimum bandwidth difference, judge current algorithm whether one of them, if select current algorithm as the final load balancing algorithm that adopts; Otherwise, the load balancing algorithm of in this multiple load balancing algorithm, choosing any one kind of them and adopting as final.
A kind of aggregated links load balancing device comprises:
Algorithm is selected module: during startup, for the every kind of load balancing algorithm that self configures, duration is preset in test respectively, when each test of heuristics begins, this algorithm title is sent to the load balancing module, when each algorithm uses end, calculate the bandwidth of each member port of aggregated links group, calculate and record the difference of member port maximum bandwidth and minimum bandwidth; When all load balancing algorithms all are completed, select load balancing algorithm corresponding to minimum bandwidth difference as the final load balancing algorithm that adopts, this algorithm is sent to the load balancing module;
The load balancing module: when receiving algorithm and select algorithm that module sends, begin to adopt this algorithm with the inbound port traffic sharing to each member port of aggregated links group.
Described algorithm selects module to be further used for,
After selecting the load balancing algorithm of load balancing algorithm corresponding to minimum bandwidth difference as final employing, periodically detect the bandwidth of each member port of aggregated links group, calculate and record the difference of member port maximum bandwidth and minimum bandwidth, judge whether the bandwidth difference that this cycle obtains is not more than the bandwidth difference that the last cycle obtains, if keep present load to share algorithm constant; Otherwise, return described every kind of load balancing algorithm for self configuring, respectively the action of the default duration of test.
Described algorithm selects module to be further used for, and when a kind of in the load balancing algorithm of self configuration shares algorithm for default load, when testing, at first tests default load and shares algorithm.
Described algorithm selects module to be further used for, when selecting load balancing algorithm corresponding to minimum bandwidth difference as the final load balancing algorithm that adopts, if the corresponding multiple load balancing algorithm of minimum bandwidth difference, then judge current algorithm whether one of them, if select current algorithm as the final load balancing algorithm that adopts; Otherwise, the load balancing algorithm of in this multiple load balancing algorithm, choosing any one kind of them and adopting as final.
Described device is positioned on the network equipment of supporting link aggregation.
Compared with prior art, the present invention can so that the network equipment finds optimal load to share algorithm automatically, improve the load balancing efficient of aggregated links.
Description of drawings
Fig. 1 is existing representative link polymerization schematic diagram;
The method flow diagram that in the aggregated links group, carries out load balancing that Fig. 2 provides for the embodiment of the invention;
The composition schematic diagram of the aggregated links load balancing device that Fig. 3 provides for the embodiment of the invention.
Embodiment
The present invention is further described in more detail below in conjunction with drawings and the specific embodiments.
The method flow diagram that in the aggregated links group, carries out load balancing that Fig. 2 provides for the embodiment of the invention, as shown in Figure 2, its concrete steps are as follows:
Step 200: pre-configured N(N is positive integer and N on the network equipment〉1) plant the load balancing algorithm, wherein share algorithm for default load for a kind, set in advance length of testing speech T.
Here, which kind of the load balancing algorithm of configuration specifically selects, and can rule of thumb determine.
Step 201: when initial, the network equipment adopts default load to share algorithm, with the inbound port traffic sharing to each bar Member Link of aggregated links group.
Usually, all configured default load on the network equipment and shared algorithm, default load is shared algorithm normally through long-term practice check, can satisfy the most cases needs.
Step 202: behind the T duration, the network equipment detects the bandwidth of each member port of aggregated links group, calculates and record the difference of member port maximum bandwidth and minimum bandwidth.
Step 203: the network equipment begins to adopt another kind of load balancing algorithm, with the inbound port traffic sharing to each bar Member Link of aggregated links group.
Step 204: behind the T duration, the network equipment detects the bandwidth of each member port of aggregated links group, calculates and record the difference of member port maximum bandwidth and minimum bandwidth.
Step 205: the network equipment judges whether that all load balancing algorithms all tested, if, execution in step 206; Otherwise, return step 203.
Step 206: the network equipment selects the load balancing algorithm of bandwidth difference minimum to share algorithm as optimal load, begins to adopt optimal load to share algorithm, with the inbound port traffic sharing to each bar Member Link of aggregated links group.
If it is a plurality of that the load balancing algorithm of bandwidth difference minimum has, then judge current algorithm whether one of them, if then selecting current algorithm is that optimal load is shared algorithm, otherwise, in the algorithm of bandwidth difference minimum, share algorithm as optimal load for optional one.
When finding optimal load to share algorithm, can notify the keeper by daily record (log) or trap (Trap) information, so that follow-up when disposing identical network, the keeper can be with this as a reference.
Step 207: the network equipment periodically detects the bandwidth of each member port of aggregated links group, calculates and record the difference of member port maximum bandwidth and minimum bandwidth.
Cycle in this step can equal the length of testing speech T in the step 200.
Step 208: the network equipment judges whether the bandwidth difference that this cycle obtains is not more than the bandwidth difference that the last cycle obtains, if, execution in step 209; Otherwise, return step 201.
Step 209: it is constant that the network equipment keeps present load to share algorithm, returns step 207.
If the bandwidth difference diminishes, show that traffic sharing is more even, at this moment, does not need to change the load balancing algorithm because business changes.
If it is large that the bandwidth difference becomes, show that traffic sharing is inhomogeneous because business changes, need to reselect the load balancing algorithm this moment.
The composition schematic diagram of the aggregated links load balancing device that Fig. 3 provides for the embodiment of the invention, as shown in Figure 3, it mainly comprises: algorithm is selected module 31 and load balancing module 32, wherein:
Algorithm is selected module 31: during startup, every kind of load balancing algorithm for the configuration of present networks equipment, duration is preset in test respectively, when each test of heuristics begins, this algorithm title is sent to load balancing module 32, when each algorithm uses end, calculate the bandwidth of each member port of aggregated links group, calculate and record the difference of member port maximum bandwidth and minimum bandwidth; When all load balancing algorithms all are completed, select load balancing algorithm corresponding to minimum bandwidth difference as the final load balancing algorithm that adopts, this algorithm is sent to load balancing module 32.
Load balancing module 32: when receiving algorithm and select load balancing algorithm that module 31 sends, begin to adopt this algorithm with the inbound port traffic sharing to each member port of aggregated links group.
Algorithm selects module 31 to be further used for, after selecting the load balancing algorithm of load balancing algorithm corresponding to minimum bandwidth difference as final employing, periodically detect the bandwidth of each member port of aggregated links group, calculate and record the difference of member port maximum bandwidth and minimum bandwidth, judge whether the bandwidth difference that this cycle obtains is not more than the bandwidth difference that the last cycle obtains, if keep present load to share algorithm constant; Otherwise, return described every kind of load balancing algorithm for the configuration of present networks equipment, respectively the action of the default duration of test.
Algorithm selects module 31 to be further used for, and when a kind of in the load balancing algorithm of present networks equipment configuration shares algorithm for default load, when testing, at first tests default load and shares algorithm.
Algorithm selects module 31 to be further used for, when selecting load balancing algorithm corresponding to minimum bandwidth difference as the final load balancing algorithm that adopts, if the corresponding multiple load balancing algorithm of minimum bandwidth difference, then judge current algorithm whether one of them, if select current algorithm as the final load balancing algorithm that adopts; Otherwise, the load balancing algorithm of in this multiple load balancing algorithm, choosing any one kind of them and adopting as final.
Device shown in Figure 3 can be positioned on the network equipment of supporting link aggregation.
The above only is preferred embodiment of the present invention, and is in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of making, is equal to replacement, improvement etc., all should be included within the scope of protection of the invention.