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 carried out clear, complete
Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art are obtained every other under the premise of creative work is not made
Embodiment, belong to the scope of protection of the invention.
The system architecture and business scenario of description of the embodiment of the present invention are in order to which more clearly the explanation present invention is implemented
The technical scheme of example, does not form the restriction for technical scheme provided in an embodiment of the present invention, those of ordinary skill in the art
Understand, with the differentiation of system architecture and the appearance of new business scene, technical scheme provided in an embodiment of the present invention is for similar
Technical problem, it is equally applicable.
The above method is described in detail with reference to specific embodiment.Shown in reference picture 1, embodiments of the invention should
For following communication system, including:More interchangers, the communication system applications in SDN therefore embodiments herein also
Including an at least SDN controller, wherein every SDN controller controls the forwarding data flow of one or more interchanger;Such as Fig. 1
Shown, at least being established between interchanger has two data links (data link one and data link two), and interchanger is with using
Family network or service network connection, to realize the data stream transmitting between user network and service network.
Based on above-mentioned communication system, embodiments of the invention provide a kind of load-balancing method of SDN, reference picture
Shown in 2, comprise the following steps:
101st, data link workable for the link information that SDN controllers report according to interchanger calculates SDN, wherein
Link information includes link capacity.
Before step 101, connection, SDN controls are established using OpenFlow protocol interfaces between SDN controllers and interchanger
Device processed generates visual network topology structure, based on the network topology knot using LLDP protocol discovery overall situations SDN topology
Data link, wherein link information workable for the link information that structure SDN controllers report according to interchanger calculates SDN are also
Can including port status etc. information.
102nd, port corresponding to the data link with identical destination address is added load port group by SDN controllers, and
According to the weight of corresponding ports in the link capacity configuration load port set of each data link, wherein, the weight of corresponding ports
For port number.
Wherein in step 102, port corresponding to the data link with identical destination address is added load by SDN controllers
Port set portGroup, and the member in portGroup can configure, and can only at most include 8 ports, a port
A port group can only be added.According to the weight of corresponding ports in the link capacity configuration load port set of link, according to port
Weight load port group portGroup can be expanded to the extension load port group weightPortGroup based on weight,
Wherein port number corresponding to data link adds according to the ratio of weight, and is discrete addition.Such as:One portGroup
Comprising two ports, corresponding link capacity is respectively 1M and 2M, then its corresponding weighted value is 1:2.Shown in table specific as follows:
Foundation load port set portGroup:Include two ports:Port1 and Port2, its link capacity are respectively
1M data link corresponds to port1, and link capacity is respectively that 2M data link corresponds to port2;
Extend load port group WeightPortGroup:Corresponding weight is 1:2, include three ports
This port combination so that port2 is easier to be selected as exit port.That is the big link of link capacity can have more
Big chance is utilized.
103rd, SDN controllers obtain the first message for the data flow that interchanger is sent, and obtain the header information of first message.
Specifically, the first message for the data flow for being not matched to flow table is encapsulated in packet_in message by interchanger, hair
SDN controllers are given, wherein, header information includes source MAC, purpose MAC, source IP address, purpose IP address, L4 ports or wherein
Any combination, such as triple or five-tuple information are formed by above-mentioned element.In addition before the header information of first message is obtained also
Whether the first message that the data flow can be detected first is legal message, if the header information of first message is then parsed, if otherwise
Abandon the first message of the data flow.
104th, SDN controllers carry out Hash operation according to header information and obtain the load balancing factor.
105th, SDN controllers forward port according to the weight selection of each port in the load balancing factor and load port group.
Specifically, the scheme of step 105 is, SDN controllers will respectively be held according in the load balancing factor and load port group
The weight of mouth and the port being calculated alternately forward port, and it is averagely surplus in scheduled duration to detect alternative forwarding port
Remaining bandwidth;If SDN controllers determine that average residual bandwidth is more than or equal to the bandwidth threshold of setting, alternative forwarding port is set
It is set to forwarding port;Otherwise average residual bandwidth of other ports in scheduled duration in load port group is detected, and will be negative
The maximum port of average residual bandwidth is arranged to forward port in load port group.Such as:SDN controllers pass through traffic statistics work(
Can, the traffic statistics of standby port port1 in one or more detection cycle are detected, standby port port1 is calculated and exists
Average residual bandwidth in scheduled duration t., will if standby port port1 average residuals bandwidth is more than or equal to bandwidth threshold T
Standby port port1 is arranged to the forwarding port of data flow, if standby port port1 average residuals bandwidth is less than bandwidth threshold
T, then other ports in searching loop portGroup, choose the maximum port of current average residual bandwidth, then with bandwidth threshold
Value T compares, if meeting comparative result, the port is arranged to forward port, if traversal terminates again without qualified
Standby port, then the maximum standby port of current average residual bandwidth is chosen as forwarding port.
Specifically, SDN controllers carry out modulo operation using the summation of the load balancing factor and weight, chosen according to result
Port numbering in weightPortGroup, by the port alternately port.For example breathed out by the tuple of heading 5
The load balancing factor that uncommon computing obtains a message is 2, when the capacity of port1 and port2 respective links is respectively 1M and 4M,
So as to which the weight of weightPortGroup middle ports is 1:4, altogether comprising 5 ports, stored and (do not made according to port order
It is specific to limit), it is as shown in the table.
Port1 |
Port2 |
Port2 |
Port2 |
Port2 |
Modulo operation is carried out according to the load balancing factor and each port weight sum, the result of selection port is:2mod5=
2, then according to the storage address of each port in weightPortGroup, choose port port2.In embodiments of the present invention, according to
The extension of port weight so that the probability for obtaining port2 increases, it is easier to uses the link that bandwidth is larger.
106th, SDN controllers are according to forwarding port generation forwarding flow table, and forwarding flow table is sent to interchanger.
Forwarding flow gauge seal is turned in packet_out message according to port is forwarded, is sent to interchanger by SDN controllers,
Interchanger will forward flow table translation to be written to hardware resource, then will be by stream compression according to the action of the instruction of forwarding flow table
Hair.
In such scheme, SDN controllers calculate SDN according to what interchanger reported comprising link capacity link information
Workable data link;Then port corresponding to the data link with identical destination address is added into load port group, and
According to the weight of corresponding ports in the link capacity configuration load port set of each data link, the weight of corresponding ports is port
Quantity;The first message for the data flow that interchanger is sent is obtained, obtains the header information of first message;Hash is carried out according to header information
(Hash) computing obtains the load balancing factor;Forwarding is selected according to the weight of each port in the load balancing factor and load port group
Port;Finally according to forwarding port generation forwarding flow table, and forwarding flow table is sent to interchanger, such interchanger can basis
When the forwarding flow table flows into row forwarding to data;Due to considering the chain appearance of a street of data link simultaneously when it is determined that forwarding flow table
Amount, therefore the link circuit resource of SDN can be made full use of, improve overall performance of network.
In another embodiment, shown in reference picture 3, in addition in step 107, SDN monitoring control devices load port groups respectively
The state of individual port, when it is determined that the state of either port is down, then either port being removed into load port group, and delete any
Forwarding flow table corresponding to port.Flow table is forwarded corresponding to the either port due to deleting, therefore when interchanger receives again
When having the data flow that can not be forwarded, SDN controllers determine that needs reselect forwarding port, and perform the step after step 102
Suddenly.This avoid influence of the port status to network performance.
In a kind of embodiment as shown in Figure 3, also include step 108 after step 106, SDN monitoring control devices turn
The packet loss of originator mouth;When it is determined that the packet loss of forwarding port is more than packet loss threshold value, then forwarding port is reselected, and delete
Except forwarding flow table is forwarded corresponding to port.Carry out carrying out packet loss system by monitoring the packet loss of forwarding port within a period of time
Meter, is avoided because burst (burst) flow causes to recalculate routing, causes TCP disconnections, reduces network performance.Wherein in step
Rapid 108 kinds, in a kind of exemplary scheme, forwarding port is reselected, is specifically included:SDN controllers obtain and are dropped message
Header information;Hash (Hash) computing is carried out according to header information and obtains the new load balancing factor;It is equal according to new load
The weight of each port reselects forwarding port in the weighing apparatus factor and load port group.Wherein the process specific implementation and step
103-105 is similar to be repeated no more here.
Embodiments of the invention shown in reference picture 4 provide a kind of SDN controllers, including:
Link management module 41, Data-Link workable for the link information for being reported according to interchanger calculates SDN
Road, wherein the link information includes link capacity;
Link management module 41, it is additionally operable to port corresponding to the data link with identical destination address adding load end
Mouth group, and according to the weight of corresponding ports in the link capacity of each data link configuration load port group, wherein, it is described
The weight of corresponding ports is port number;
Message processing module (MPM) 42, the first message of the data flow for obtaining interchanger transmission, obtains the head of the first message
Portion's information;
Routing module control 43, the header information for being obtained according to the message processing module (MPM) 42 carry out Hash fortune
Calculate and obtain the load balancing factor;
Link management module 41, it is additionally operable to the load balancing factor according to the routing module control 43 acquisition and the chain
The weight selection forwarding port of each port in the load port group that road management module 41 obtains;
The routing module control 43, the forwarding port for being additionally operable to be selected according to the link management module 41 generate forwarding
Flow table, and the forwarding flow table is sent to interchanger.
Optionally, as shown in figure 5, SDN controllers also include:The link management module 41 is specifically used for will be according to described
The weight of each port and the port being calculated alternately forward port in the load balancing factor and the load port group, examine
Survey average residual bandwidth of the alternative forwarding port in scheduled duration;If it is determined that the average residual bandwidth is more than or equal to
The bandwidth threshold of setting, then the alternative forwarding port is arranged to forward port;Otherwise detect in the load port group
Average residual bandwidth of other ports in scheduled duration, and by the maximum port of average residual bandwidth in the load port group
It is arranged to forward port.
Optionally, the link management module 41, it is additionally operable to monitor the state of each port in the load port group, when
The state for determining either port is down, then the either port is removed into the load port group, the routing module control
43 are additionally operable to delete forwarding flow table corresponding to the either port.
Optionally, the SDN controllers also include:Flow statistical module 44, for monitoring the packet loss of the forwarding port
Rate;When it is determined that the packet loss of the forwarding port is more than packet loss threshold value, then the link management module 41 is used to select again
Forwarding port is selected, the routing module control is additionally operable to delete forwarding flow table corresponding to the forwarding port.
In addition, message processing module (MPM) 42 is additionally operable to obtain the header information for being dropped message;The routing module control 43,
The header information progress Hash operation for being additionally operable to be dropped message according to obtaining the message processing module (MPM) obtains newly
The load balancing factor;The link management module 41, it is additionally operable to the new load obtained according to the routing module control
The weight of each port reselects forwarding port in balance factor and the load port group.
In such scheme, SDN controllers calculate SDN according to what interchanger reported comprising link capacity link information
Workable data link;Then port corresponding to the data link with identical destination address is added into load port group, and
According to the weight of corresponding ports in the link capacity configuration load port set of each data link, the weight of corresponding ports is port
Quantity;The first message for the data flow that interchanger is sent is obtained, obtains the header information of first message;Hash is carried out according to header information
Computing obtains the load balancing factor;According to the weight selection forwarding port of each port in the load balancing factor and load port group;
Finally according to forwarding port generation forwarding flow table, and forwarding flow table is sent to interchanger, such interchanger can be according to this turn
When hair flow table forwards to data stream;Due to considering the link capacity of data link simultaneously when it is determined that forwarding flow table, because
This can make full use of the link circuit resource of SDN, improve overall performance of network.
In addition, also providing a kind of calculating readable media (or medium), including carry out when executed in above-described embodiment
The computer-readable instruction of the operation of method.
In addition, a kind of computer program product is also provided, including above computer readable media (or medium).
It should be understood that in various embodiments of the present invention, the size of the sequence number of above-mentioned each process is not meant to perform suitable
The priority of sequence, the execution sequence of each process should be determined with its function and internal logic, without the implementation of the reply embodiment of the present invention
Process forms any restriction.
Those of ordinary skill in the art are it is to be appreciated that the list of each example described with reference to the embodiments described herein
Member and algorithm steps, it can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are actually
Performed with hardware or software mode, application-specific and design constraint depending on technical scheme.Professional and technical personnel
Described function can be realized using distinct methods to each specific application, but this realization is it is not considered that exceed
The scope of the present invention.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description,
The specific work process of device and unit, the corresponding process in preceding method embodiment is may be referred to, will not be repeated here.
In several embodiments provided herein, it should be understood that disclosed system, apparatus and method, can be with
Realize by another way.For example, apparatus embodiments described above are only schematical, for example, the unit
Division, only a kind of division of logic function, can there is other dividing mode, such as multiple units or component when actually realizing
Another system can be combined or be desirably integrated into, or some features can be ignored, or do not perform.It is another, it is shown or
The mutual coupling discussed or direct-coupling or communication connection can be the indirect couplings by some interfaces, equipment or unit
Close or communicate to connect, can be electrical, mechanical or other forms.
The unit illustrated as separating component can be or may not be physically separate, show as unit
The part shown can be or may not be physical location, you can with positioned at a place, or can also be distributed to multiple
On NE.Some or all of unit therein can be selected to realize the mesh of this embodiment scheme according to the actual needs
's.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, can also
That unit is individually physically present, can also two or more units it is integrated in a unit.
If the function is realized in the form of SFU software functional unit and is used as independent production marketing or in use, can be with
It is stored in a computer read/write memory medium.Based on such understanding, technical scheme is substantially in other words
The part to be contributed to prior art or the part of the technical scheme can be embodied in the form of software product, the meter
Calculation machine software product is stored in a storage medium, including some instructions are causing a computer equipment (can be
People's computer, server, or network equipment etc.) perform all or part of step of each embodiment methods described of the present invention.
And foregoing storage medium includes:USB flash disk, mobile hard disk, read-only storage (English full name:Read-only memory, English letter
Claim:ROM), random access memory (English full name:Random access memory, English abbreviation:RAM), magnetic disc or light
Disk etc. is various can be with the medium of store program codes.
The foregoing is only a specific embodiment of the invention, but protection scope of the present invention is not limited thereto, any
Those familiar with the art the invention discloses technical scope in, change or replacement can be readily occurred in, should all be contained
Cover within protection scope of the present invention.Therefore, protection scope of the present invention should be based on the protection scope of the described claims.