Aggregated links load sharing method and device
Technical field
The present invention relates to link aggregation technical field, be specifically related to aggregated links load sharing method and device.
Background technology
Link aggregation is a kind of technology that Ethernet is often disposed, and by multiple physical interface is pooled a logic interface, adds link bandwidth and reliability.Fig. 1 gives existing representative link polymerization schematic diagram.
Adopt the major advantage of link aggregation as follows:
Bandwidth linear increases: in theory, bandwidth is the bandwidth sum of all links in aggregated links group;
Reliability increases: the damage of a link can not cause the failure of whole transmission;
Load balancing: the flow of user is assigned on each link and transmits;
Dynamic-configuration: when lacking human configuration, aggregated links group can dynamic-configuration, and link can dynamically add aggregated links group;
Result predictability: according to the algorithm selected, link aggregation configuration problem-solving ability is deterministic, such as, the order that polymerization can occur independent of event, the result of polymerization is determined with their physical connection by the ability of each link in aggregated links group.
Wherein, load balancing generally adopts HASH algorithm, according to some field of message or the ingress port information entering the network equipment, carries out HASH calculating, determines the physical outlet of flow according to result of calculation.Whether load balancing is evenly the standard judging its algorithm quality.
Current switch device all supports multiple Load Sharing Algorithm, to meet multiple business demand.Network manager can be checked and configuration by manual, determines optimal Load Sharing Algorithm.
The existing Load Sharing Algorithm for link aggregation group has following two shortcomings:
One, specific to real network, network manager and do not know which kind of Load Sharing Algorithm can share ground evenly, need manual configuration to verify one by one, just the most uniform Load Sharing Algorithm can be found, for large-scale networking, have a lot of aggregated links, workload is very large; Often first adopt default load Sharing Algorithm, if there is packet loss, then use other Load Sharing Algorithm instead, this method belongs to remedial measure, cannot prevent trouble before it happens.
If two Networks change, current Load Sharing Algorithm may business after improper change, and not a kind of mechanism can informing network keeper be modified.
Summary of the invention
The invention provides aggregated links load sharing method and device, to improve aggregated links load balancing efficiency.
Technical scheme of the present invention is achieved in that
A kind of aggregated links load sharing method, configure multiple Load Sharing Algorithm on network devices in advance, the method comprises:
The network equipment starts, and for often kind of Load Sharing Algorithm of self configuration, tests preset duration respectively;
In each length of testing speech, adopt the Load Sharing Algorithm of current test by inbound port traffic sharing on each member port of aggregated links group, and at the end of test, 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 Sharing Algorithm are all completed, the Load Sharing Algorithm selecting minimum bandwidth difference corresponding is as the final Load Sharing Algorithm adopted.
Load Sharing Algorithm corresponding to described selection minimum bandwidth difference comprises further as after the final Load Sharing Algorithm adopted:
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 bandwidth difference that this cycle obtains is not more than the bandwidth difference that the last cycle obtains, and if so, keeps present load Sharing Algorithm constant; Otherwise, return described often kind of Load Sharing Algorithm for self configuration, test the action of preset duration respectively.
One in described multiple Load Sharing Algorithm is default load Sharing Algorithm,
And, described often kind of Load Sharing Algorithm for self configuration, testing preset duration is respectively:
First test default load Sharing Algorithm, then test other Load Sharing Algorithm.
Load Sharing Algorithm corresponding to described selection minimum bandwidth difference comprises as the final Load Sharing Algorithm adopted:
When the corresponding multiple Load Sharing Algorithm of minimum bandwidth difference, judge whether current algorithm is one of them, if so, select current algorithm as the final Load Sharing Algorithm adopted; Otherwise, choose any one kind of them in this multiple Load Sharing Algorithm as the final Load Sharing Algorithm adopted.
A kind of aggregated links load balancing device, comprising:
Algorithms selection module: during startup, for often kind of Load Sharing Algorithm of self configuration, test preset duration respectively, when each test of heuristics starts, this algorithm title is sent to load balancing module, at the end of each algorithm uses, 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 Sharing Algorithm are all completed, this algorithm, as the final Load Sharing Algorithm adopted, is sent to load balancing module by the Load Sharing Algorithm selecting minimum bandwidth difference corresponding;
Load balancing module: when receiving the algorithm that algorithms selection module is sent, starts to adopt this algorithm by inbound port traffic sharing on each member port of aggregated links group.
Described algorithms selection module is further used for,
After the Load Sharing Algorithm selecting minimum bandwidth difference corresponding is as the final Load Sharing Algorithm adopted, 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 bandwidth difference that this cycle obtains is not more than the bandwidth difference that the last cycle obtains, if so, keep present load Sharing Algorithm constant; Otherwise, return described often kind of Load Sharing Algorithm for self configuration, test the action of preset duration respectively.
Described algorithms selection module is further used for, and when the one in the Load Sharing Algorithm of self configuration is default load Sharing Algorithm, when testing, first tests default load Sharing Algorithm.
Described algorithms selection module is further used for, when the Load Sharing Algorithm selecting minimum bandwidth difference corresponding is as the final Load Sharing Algorithm adopted, if the corresponding multiple Load Sharing Algorithm of minimum bandwidth difference, then judge whether current algorithm is one of them, if so, select current algorithm as the final Load Sharing Algorithm adopted; Otherwise, choose any one kind of them in this multiple Load Sharing Algorithm as the final Load Sharing Algorithm adopted.
Described device is positioned on the network equipment of support link aggregation.
Compared with prior art, the present invention can make the network equipment be automatically found optimal load Sharing Algorithm, improves the load balancing efficiency of aggregated links.
Accompanying drawing explanation
Fig. 1 is existing representative link polymerization schematic diagram;
The method flow diagram carrying out load balancing in aggregated links group that Fig. 2 provides for the embodiment of the present invention;
The composition schematic diagram of the aggregated links load balancing device that Fig. 3 provides for the embodiment of the present invention.
Embodiment
Below in conjunction with drawings and the specific embodiments, the present invention is further described in more detail.
The method flow diagram carrying out load balancing in aggregated links group that Fig. 2 provides for the embodiment of the present invention, as shown in Figure 2, its concrete steps are as follows:
Step 200: pre-configured N(N is positive integer and N>1 on network devices) plant Load Sharing Algorithm, wherein a kind is default load Sharing Algorithm, pre-sets length of testing speech T.
Here, which kind of the Load Sharing Algorithm of configuration specifically selects, and can rule of thumb determine.
Step 201: time initial, the network equipment adopts default load Sharing Algorithm, by inbound port traffic sharing on each bar Member Link of aggregated links group.
Usually, the network equipment is all configured with default load Sharing Algorithm, default load Sharing Algorithm normally through long-term practice inspection, can meet most cases needs.
Step 202: after T duration, the network equipment detects the bandwidth of each member port of aggregated links group, calculates and records the difference of member port maximum bandwidth and minimum bandwidth.
Step 203: the network equipment starts to adopt another kind of Load Sharing Algorithm, by inbound port traffic sharing on each bar Member Link of aggregated links group.
Step 204: after T duration, the network equipment detects the bandwidth of each member port of aggregated links group, calculates and records the difference of member port maximum bandwidth and minimum bandwidth.
Step 205: the network equipment judges whether that all Load Sharing Algorithm were tested all, if so, performs step 206; Otherwise, return step 203.
Step 206: the Load Sharing Algorithm that the network equipment selects bandwidth difference minimum, as optimal load Sharing Algorithm, starts to adopt optimal load Sharing Algorithm, by inbound port traffic sharing on each bar Member Link of aggregated links group.
If the minimum Load Sharing Algorithm of bandwidth difference has multiple, then judge whether current algorithm is one of them, if so, then select current algorithm to be optimal load Sharing Algorithm, otherwise, in the algorithm that bandwidth difference is minimum optional one as optimal load Sharing Algorithm.
When finding optimal load Sharing Algorithm, can pass through daily record (log) or trap (Trap) message notice keeper, so that follow-up when disposing identical network, keeper can in this, as reference.
Step 207: the network equipment periodically detects the bandwidth of each member port of aggregated links group, calculates and records the difference of member port maximum bandwidth and minimum bandwidth.
Cycle in this step can equal the length of testing speech T in step 200.
Step 208: the network equipment judges whether bandwidth difference that this cycle obtains is not more than the bandwidth difference that the last cycle obtains, and if so, performs step 209; Otherwise, return step 201.
Step 209: the network equipment keeps present load Sharing Algorithm constant, returns step 207.
If bandwidth difference diminishes, show because of business change, traffic sharing evenly, now, do not need to change Load Sharing Algorithm.
If bandwidth difference becomes large, show that traffic sharing is uneven, now needs to reselect Load Sharing Algorithm because of business change.
The composition schematic diagram of the aggregated links load balancing device that Fig. 3 provides for the embodiment of the present invention, as shown in Figure 3, it mainly comprises: algorithms selection module 31 and load balancing module 32, wherein:
Algorithms selection module 31: during startup, for often kind of Load Sharing Algorithm of present networks Equipments Setting, test preset duration respectively, when each test of heuristics starts, this algorithm title is sent to load balancing module 32, at the end of each algorithm uses, 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 Sharing Algorithm are all completed, this algorithm, as the final Load Sharing Algorithm adopted, is sent to load balancing module 32 by the Load Sharing Algorithm selecting minimum bandwidth difference corresponding.
Load balancing module 32: when receiving the Load Sharing Algorithm that algorithms selection module 31 is sent, starts to adopt this algorithm by inbound port traffic sharing on each member port of aggregated links group.
Algorithms selection module 31 is further used for, after the Load Sharing Algorithm selecting minimum bandwidth difference corresponding is as the final Load Sharing Algorithm adopted, 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 bandwidth difference that this cycle obtains is not more than the bandwidth difference that the last cycle obtains, if so, keep present load Sharing Algorithm constant; Otherwise, return described often kind of Load Sharing Algorithm for present networks Equipments Setting, test the action of preset duration respectively.
Algorithms selection module 31 is further used for, and when the one in the Load Sharing Algorithm of present networks Equipments Setting is default load Sharing Algorithm, when testing, first tests default load Sharing Algorithm.
Algorithms selection module 31 is further used for, when the Load Sharing Algorithm selecting minimum bandwidth difference corresponding is as the final Load Sharing Algorithm adopted, if the corresponding multiple Load Sharing Algorithm of minimum bandwidth difference, then judge whether current algorithm is one of them, if so, select current algorithm as the final Load Sharing Algorithm adopted; Otherwise, choose any one kind of them in this multiple Load Sharing Algorithm as the final Load Sharing Algorithm adopted.
Fig. 3 shown device can be positioned on the network equipment of support link aggregation.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment made, equivalent replacement, improvement etc., all should be included within the scope of protection of the invention.