Summary of the invention
Embodiments of the invention provide a kind of method and device of adjusting the load balancing inequality, in the situation that the load balancing inequality can realize the load balancing adjustment fast, have solved efficient and low this problem of accuracy rate that load balancing is adjusted.
For achieving the above object, embodiments of the invention adopt following technical scheme:
First aspect, a kind of method of adjusting the load balancing inequality comprises:
Obtain the flow of each load balancing item, described load balancing item represents to deposit the list item of service traffics outgoing interface;
Carry out the load balancing adjustment according to the flow of all described load balancing items that get.
In the possible implementation of the first of first aspect, the described flow that obtains each load balancing item comprises:
Receive service traffics, described service traffics are the flow of incoming interface;
According to preset algorithm, obtain the corresponding relation of described service traffics and described load balancing item, described preset algorithm comprises the load balancing algorithm;
According to the corresponding relation of described service traffics and described load balancing item, obtain the flow of described each load balancing item.
May implementation in conjunction with the first of first aspect, first aspect, in the second of first aspect may implementation, before the described flow that obtains each load balancing item, also comprise:
Obtain the preset configuration ratio of outgoing interface, described outgoing interface comprises the outlet of service traffics;
Determine the corresponding relation of each load balancing item and described outgoing interface.
In conjunction with the first possibility implementation of first aspect, first aspect, the second possibility implementation of first aspect, in the third possibility implementation of first aspect, before carrying out described load balancing adjustment, also comprise:
According to the corresponding relation of described each load balancing item and described outgoing interface, obtain the flow of each outgoing interface, obtain the current allocation ratio of described outgoing interface;
When the preset configuration ratio of described outgoing interface and described current allocation ratio not simultaneously, determine that present load shares inequality.
In conjunction with the first of first aspect, first aspect may implementation, the second of first aspect may implementation, first aspect the third may implementation, the 4th kind of first aspect may implementation in, after inequality is shared in definite present load, also comprise:
Adjust the corresponding relation of described load balancing item and described outgoing interface, be adjusted the allocation ratio of rear outgoing interface;
When the allocation ratio of outgoing interface surpasses preset value after adjusting back loading to share uneven and described adjustment, the allocation ratio of each outgoing interface after adjusting and the preset configuration ratio of each outgoing interface are compared;
According to the comparative result on the preset configuration ratio of the allocation ratio of described each outgoing interface and each outgoing interface, obtain the maximum or minimum outgoing interface of ratio, on the maximum or minimum outgoing interface of described ratio, increase or reduce described load balancing item.
Second aspect provides a kind of device of adjusting the load balancing inequality, comprising:
Acquiring unit, for the flow that obtains each load balancing item, described load balancing item represents to deposit the list item of service traffics outgoing interface;
Adjustment unit, the flow that is used for all described load balancing items of getting according to described acquiring unit carries out the load balancing adjustment.
In the first possibility implementation of second aspect, described acquiring unit comprises:
Receive subelement, be used for receiving service traffics, described service traffics are the flow of incoming interface;
Obtain subelement, be used for according to preset algorithm, obtain the corresponding relation of described service traffics and described load balancing item, described preset algorithm comprises the load balancing algorithm; And obtain the flow of described each load balancing item.
In conjunction with the first possibility implementation of first aspect, first aspect, in the second possibility implementation of first aspect, this device also comprises:
Described acquiring unit, also for the preset configuration ratio of obtaining outgoing interface, described outgoing interface comprises the outlet of service traffics;
Determining unit is for the corresponding relation of determining each load balancing item and described outgoing interface.
In conjunction with the first possibility implementation of first aspect, first aspect, the second possibility implementation of first aspect, in the third possibility implementation of first aspect, comprising:
Described acquiring unit also is used for according to the corresponding relation of described each load balancing item and described outgoing interface, obtaining the flow of each outgoing interface before described adjustment unit carries out the load balancing adjustment, obtains the current allocation ratio of described outgoing interface;
Described determining unit, also be used for when the current allocation ratio of the preset configuration ratio of described outgoing interface and the described outgoing interface that described acquiring unit obtains not simultaneously, determine that present load shares inequality.
In conjunction with the first of first aspect, first aspect may implementation, the second of first aspect may implementation, first aspect the third may implementation, the 4th kind of first aspect may the side of realization in, comprising:
Described adjustment unit also is used for adjusting the corresponding relation of described load balancing item and described outgoing interface after inequality is shared in definite present load, is adjusted the allocation ratio of rear outgoing interface;
This device also comprises:
Comparing unit when the allocation ratio that is used for outgoing interface after adjusting back loading to share uneven and described adjustment surpasses preset value, compares the allocation ratio of each outgoing interface after adjustment and the preset configuration ratio of each outgoing interface;
Processing unit, be used for the comparative result on the preset configuration ratio of the allocation ratio of described each outgoing interface of obtaining according to described comparing unit and each outgoing interface, obtain ratio maximum or minimum outgoing interface, on the maximum or minimum outgoing interface of described ratio, increase or reduce described load balancing item.
Method and the device of the adjustment load balancing inequality that the embodiment of the present invention provides, after receiving the flow of incoming interface, by flow and load balancing item corresponding relation, obtain the statistic flow of each load balancing item, and then carry out the load balancing adjustment according to the statistic flow of each load balancing item.Technical solution of the present invention in the situation that the load balancing inequality can realize the load balancing adjustment fast, is carried out load balancing when adjusting thereby solved prior art, and efficient and accuracy rate are hanged down this problem.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, rather than whole embodiment.Based on the embodiment in the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that obtains under the creative work prerequisite.
One embodiment of the invention provides a kind of method of adjusting the load balancing inequality, and as shown in Figure 1, the method comprises:
101, obtain the flow of each load balancing item.
Wherein, the load balancing item represents to deposit the list item of service traffics outgoing interface, be positioned on the veneer of each flow incoming interface, and the outgoing interface that several load balancing items are deposited is identical.
102, the flow according to all load balancing items that get carries out the load balancing adjustment.
Wherein, carrying out the load balancing adjustment comprises:
A, according to the corresponding relation of load balancing item and outgoing interface, obtain the current flow of each outgoing interface;
B, calculate current allocation ratio according to present flow rate;
After getting current allocation ratio, the pre-configured ratio of current allocation ratio and outgoing interface is compared.
C, at current allocation ratio with the pre-configured ratio of outgoing interface not simultaneously, adjust the corresponding relation of interface and load balancing item, just can adjust the allocation ratio of interface, can be identical with pre-configured ratio or approaching in allowed band, the allocation ratio of the outgoing interface after namely adjusting.
What deserves to be explained is, when the allocation ratio of the outgoing interface after adjusting surpasses preset value, the allocation ratio of each outgoing interface after adjusting is compared; Obtain the outgoing interface of ratio maximum or ratio minimum, and increase or reduce a load balancing item on the maximum or minimum outgoing interface of this ratio.
The method of the adjustment load balancing inequality that the embodiment of the present invention provides, after receiving the flow of incoming interface, by flow and load balancing item corresponding relation, obtain the statistic flow of each load balancing item, and then carry out the load balancing adjustment according to the statistic flow of each load balancing item.Technical solution of the present invention in the situation that the load balancing inequality can realize the load balancing adjustment fast, is carried out load balancing when adjusting thereby solved prior art, and efficient and accuracy rate are hanged down this problem.
Another embodiment of the present invention provides a kind of method of adjusting the load balancing inequality, and as shown in Figure 2, the method comprises:
201, receive service traffics.
Wherein, service traffics are the flow of incoming interface.
202, according to preset algorithm, obtain the corresponding relation of described service traffics and described load balancing item.
Optionally, preset algorithm comprises the load balancing algorithm, and this algorithm can be hash algorithm, can obtain the corresponding relation of service traffics and load balancing item from this algorithm.
203, according to the corresponding relation of described service traffics and described load balancing item, obtain the flow of each load balancing item.
Wherein, according to the corresponding relation of service traffics and load balancing item, by the method for accumulative total addition, can obtain the flow of each load balancing item.
204, according to the corresponding relation of each load balancing item and outgoing interface, obtain the flow of each outgoing interface, obtain the current allocation ratio of described outgoing interface.
What deserves to be explained is, obtain the flow of each outgoing interface herein, in above-mentioned 203, the flow that obtains each load balancing item is identical, namely does equally addition and processes.And then the flow of all outgoing interfaces is carried out ratio calculation, obtain factor number identical with outgoing interface quantity, the simplest ratio of one group of data.
Further, when the preset configuration ratio of outgoing interface and described current allocation ratio not simultaneously, determine that present load is shared unevenly to carry out following 205.
205, carry out the load balancing adjustment.
Concrete, carry out the load balancing adjustment and comprise:
A, adjust the corresponding relation of load balancing item and described outgoing interface, be adjusted the allocation ratio of rear outgoing interface.
B, when adjust back loading share inequality and adjust after the allocation ratio of outgoing interface when surpassing preset value, the allocation ratio of each outgoing interface after adjusting and the preset configuration ratio of each outgoing interface are compared.
C, in conjunction with b, obtain the maximum or minimum outgoing interface of ratio, on the maximum or minimum outgoing interface of ratio, increase or reduce the load balancing item.
Optionally, the implementation that load balancing is adjusted in 205, including but not limited to following two kinds:
The first implementation: dynamically adjustment, the implementation of dynamically adjusting comprise adopts the mode of permutation and combination to realize.
The second implementation: manually adjust, refer to that the user carries out according to the statistic flow of each load balancing item, the adjustment of the corresponding relation of load balancing item and outgoing interface.
What deserves to be explained is, adjust the corresponding relation of load balancing item and outgoing interface, namely adjust the position of interface, adjust the number of interface.
The method of the adjustment load balancing inequality that the embodiment of the present invention provides, after receiving the flow of incoming interface, by flow and load balancing item corresponding relation, obtain the statistic flow of each load balancing item, and then carry out the load balancing adjustment according to the statistic flow of each load balancing item.Technical solution of the present invention in the situation that the load balancing inequality can realize the load balancing adjustment fast, is carried out load balancing when adjusting thereby solved prior art, and efficient and accuracy rate are hanged down this problem.
The present invention another embodiment a kind of method of adjusting the load balancing inequality is provided, the method can use with instantiation in.The specific implementation flow process of the method is as follows:
In the present embodiment, the load balancing algorithm is hash algorithm.And comprise 4 outgoing interfaces, be designated as respectively, B, C, D, and the preset configuration ratio of outgoing interface is: A: B: C: D=3: 2: 2: 1, the number of load balancing item was outgoing interface weight sum, was 8.
And according to the corresponding relation of load balancing item and service traffics, the statistic flow that obtains each load balancing item is as follows:
The statistic flow of load balancing item 1 is 200M;
The statistic flow of load balancing item 2 is 0M;
The statistic flow of load balancing item 3 is 250M;
The statistic flow of load balancing item 4 is 420M;
The statistic flow of load balancing item 5 is 180M;
The statistic flow of load balancing item 6 is 150M;
The statistic flow of load balancing item 7 is 50M;
The statistic flow of load balancing item 8 is 400M.
And according to hash algorithm, the corresponding relation of load balancing item and outgoing interface is, load balancing item 1-3, corresponding outgoing interface A, the corresponding outgoing interface B of load balancing item, load balancing item 6,7, corresponding outgoing interface C, load balancing item 8, corresponding outgoing interface D, the actual flow that obtains current outgoing interface A, B, C, D is followed successively by: 450M, 600M, 200M, 400M, the current allocation ratio of corresponding outgoing interface is 450: 600: 200: 400=2.2: 3: 1: 2, be different from the preset configuration ratio.Adjust the corresponding relation of load balancing item and outgoing interface, the adjustment principle is: make the allocation ratio of the outgoing interface after adjustment identical or approaching as far as possible with the preset configuration ratio of outgoing interface, the adjustment mode comprises: dynamically adjust or manually adjust, the adjustment of this moment be the position of outgoing interface.
Load balancing item after adjustment with the corresponding relation of outgoing interface is: the corresponding outgoing interface D of load balancing item 1; Load balancing item 2,8 corresponding outgoing interface C, load balancing item 3,6 corresponding outgoing interface B, load balancing item 4,5,7 corresponding outgoing interface A.Flow after adjusting is: A=650M, and B=400M, C=400M, D=200M meets substantially, A: B: C: D=3: 2: 2: 1, as shown in table 1, think that this adjustment scheme is preferred plan, need not to carry out follow-up adjustment.
Table 1
The method of the adjustment load balancing inequality that the embodiment of the present invention provides, after receiving the flow of incoming interface, by flow and load balancing item corresponding relation, obtain the statistic flow of each load balancing item, and then carry out the load balancing adjustment according to the statistic flow of each load balancing item.Technical solution of the present invention in the situation that the load balancing inequality can realize the load balancing adjustment fast, is carried out load balancing when adjusting thereby solved prior art, and efficient and accuracy rate are hanged down this problem.
Another embodiment of the present invention provides a kind of device of adjusting the load balancing inequality, and as shown in Figure 3, this device comprises: acquiring unit 31, adjustment unit 32.
Acquiring unit 31 is for the flow that obtains each load balancing item.
Wherein, the load balancing item represents to deposit the list item of service traffics outgoing interface, be positioned on the veneer of each flow incoming interface, and a plurality of load balancing item can share an outgoing interface.
Adjustment unit 32, the flow that is used for all load balancing items of getting according to described acquiring unit 31 carries out the load balancing adjustment.
Optionally, as shown in Figure 4, described acquiring unit 31 comprises: receive subelement 311, obtain subelement 312; This device also comprises: determining unit 33, comparing unit 34, processing unit 35.
Receive subelement 311, be used for receiving service traffics.
Optionally, service traffics are the flow of incoming interface.
Obtain subelement 312, be used for according to preset algorithm, obtain the corresponding relation of described service traffics and described load balancing item, and obtain the flow of described each load balancing item.
Wherein, preset algorithm comprises the load balancing algorithm.
Determining unit 33 is for the corresponding relation of determining each load balancing item and described outgoing interface.
Optionally,
Described acquiring unit 31 also is used for according to the corresponding relation of described each load balancing item and described outgoing interface, obtaining the flow of each outgoing interface before described adjustment unit 32 carries out the load balancing adjustment, obtains the current allocation ratio of described outgoing interface.
Described determining unit 33, also be used for when the current allocation ratio of the preset configuration ratio of described outgoing interface and the described outgoing interface that described acquiring unit 31 obtains not simultaneously, determine that present load shares inequality.
Optionally, described adjustment unit 32 also is used for adjusting the corresponding relation of described load balancing item and described outgoing interface after inequality is shared in definite present load, is adjusted the allocation ratio of rear outgoing interface.
Comparing unit 34 is used for when described adjustment unit 32, adjusts back loading and shares when the allocation ratio of outgoing interface surpasses preset value after uneven and described adjustment, and the allocation ratio of each outgoing interface after adjusting and the preset configuration ratio of each outgoing interface are compared.
Processing unit 35, be used for the comparative result on the preset configuration ratio of the allocation ratio of described each outgoing interface of obtaining according to described comparing unit 34 and each outgoing interface, obtain ratio maximum or minimum outgoing interface, on the maximum or minimum outgoing interface of described ratio, increase or reduce described load balancing item.
The device of the adjustment load balancing inequality that the embodiment of the present invention provides, after receiving the flow of incoming interface, by flow and load balancing item corresponding relation, obtain the statistic flow of each load balancing item, and then carry out the load balancing adjustment according to the statistic flow of each load balancing item.Technical solution of the present invention in the situation that the load balancing inequality can realize the load balancing adjustment fast, is carried out load balancing when adjusting thereby solved prior art, and efficient and accuracy rate are hanged down this problem.
Another embodiment of the present invention provides a kind of device of adjusting the load balancing inequality, and as shown in Figure 5, this device comprises: receiver 01, processor 02, memory 03.
Receiver 01 is used for receiving service traffics.
Optionally, these service traffics are the flow of incoming interface.
Memory 03 is used for storing the service traffics that described receiver 01 receives.
Processor 02 for the preset configuration ratio of obtaining outgoing interface, is determined the corresponding relation of each load balancing item and outgoing interface; Again according to preset algorithm, the described service traffics that described receiver 01 is received and the corresponding relation of load balancing item; And according to this corresponding relation, obtain the flow of each load balancing item.
Optionally, described outgoing interface comprises the outlet of service traffics; Described processor 02, the preset algorithm of use comprises the load balancing algorithm.
Described processor 02, concrete for the corresponding relation according to described each load balancing item and described outgoing interface, obtain the flow of each outgoing interface, obtain the current allocation ratio of described outgoing interface.When the preset configuration ratio of described outgoing interface and described current allocation ratio not simultaneously, determine that present load shares inequality.
And then adjust the corresponding relation of described load balancing item and described outgoing interface, be adjusted the allocation ratio of rear outgoing interface; When the allocation ratio of outgoing interface surpasses preset value after adjusting back loading to share uneven and described adjustment, the allocation ratio of each outgoing interface after adjusting and the preset configuration ratio of each outgoing interface are compared; According to the comparative result on the preset configuration ratio of the allocation ratio of described each outgoing interface and each outgoing interface, obtain the maximum or minimum outgoing interface of ratio, on the maximum or minimum outgoing interface of described ratio, increase or reduce described load balancing item.
Described memory 03, the current allocation ratio, the preset configuration ratio that are used for storing outgoing interface, and described processor 02, the comparative result that obtains.
The device of the adjustment load balancing inequality that the embodiment of the present invention provides, after receiver receives the flow of incoming interface, processor is by flow and load balancing item corresponding relation, obtain the statistic flow of each load balancing item, and then carry out the load balancing adjustment according to the statistic flow of each load balancing item.Technical solution of the present invention in the situation that the load balancing inequality can realize the load balancing adjustment fast, is carried out load balancing when adjusting thereby solved prior art, and efficient and accuracy rate are hanged down this problem.
Through the above description of the embodiments, the those skilled in the art can be well understood to the present invention and can realize by the mode that software adds essential common hardware, can certainly pass through hardware, but in a lot of situation, the former is better execution mode.Based on such understanding, the part that technical scheme of the present invention contributes to prior art in essence in other words can embody with the form of software product, this computer software product is stored in the storage medium that can read, floppy disk as computer, hard disk or CD etc., comprise some instructions with so that computer equipment (can be personal computer, server, the perhaps network equipment etc.) carry out the described method of each embodiment of the present invention.
The above; be only the specific embodiment of the present invention, but protection scope of the present invention is not limited to this, anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; can expect easily changing or replacing, within all should being encompassed in protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection range of described claim.