Summary of the invention
In view of the above-mentioned problems, embodiment of the present invention to be designed to provide a kind of Smallest connection load based on SDN equal
Weigh method and system, can unifiedly calculate to the server of whole network, and the biggish request of load difference is smoothly distributed to
Each server or chain road, and entire strategy is efficient and simple.
To achieve the above object, embodiment of the present invention provides a kind of Smallest connection load-balancing method based on SDN, institute
Method is stated applied on the controller in SDN, comprising: controller presets Smallest connection load balancing allocation list and session association
Table is discussed, the Smallest connection load balancing allocation list includes connection number threshold value, and the session protocol table includes the connection of server
Number;When the server protocol message that the interchanger received in SDN reports, according to server protocol message generation
Session protocol list item in session protocol table;When getting the service request of client transmission, looked into according to the service request
Session protocol table is looked for, if there is no matched session protocol list item in the session protocol table, if asked in the service request
The connection number for the server asked is less than the connection number threshold value, then the server of the request is selected to be attached;If described
The connection number for the server requested in service request has reached the connection number threshold value, then selects to service in the session protocol table
The smallest server of device connection number redirects connection.
Further, the configuration item of the Smallest connection load balancing allocation list include Smallest connection load-balancing function and
Connection number threshold value, wherein the Smallest connection load-balancing function opens and closes Smallest connection load balancing function for being arranged
Can, the connection number threshold value is for being arranged connection number threshold value.
Further, the session protocol table includes server IP field, connection digital section, protocol fields, client ip
Field and session field, wherein server IP field is for indicating server ip, and connection digital section is for indicating this server
Connection number, protocol fields are for indicating service agreement number, and client IP field is for indicating client ip, and session field is for referring to
Bright session id.
Further, when the server protocol message reported when the interchanger received in SDN, according to the service
Device protocol massages generate the session protocol list item in the session protocol table, comprising: interchanger passes through privately owned
MAC Address and port id of the Experimenter message to controller report interchanger oneself, interchanger and control in Lai Jianli SDN
The channel of device processed;The server protocol message for the server that interchanger is connected to controller report respectively, controller respectively from
The server protocol message extracts server ip, client ip, session id and service protocol number, and the connection of calculation server
Number, generates the session protocol list item in the session protocol table.
Further, described when getting the service request of client transmission, session is searched according to the service request
Agreement table, if not having matched session protocol list item in the session protocol table, if the clothes requested in the service request
The connection number of business device is less than the connection number threshold value, then the server of the request is selected to be attached;If the service is asked
It asks the connection number of the server of middle request to have reached the connection number threshold value, then server in the session protocol table is selected to connect
The smallest server of number redirects connection, comprising: when client sends service request to server by SDN network,
Controller intercepts and captures the service request, and by the server ip of client ip, request in the service request, session id kimonos
Business protocol number is matched with the session protocol list item in the session protocol table;If having in the session protocol table matched
Session protocol list item is then not processed the service request;If there is no matched session protocol in the session protocol table
List item then judges the connection number of the server of request;If the connection number for the server requested in the service request is less than institute
Connection number threshold value is stated, then the server of the request is selected to be attached, and the connection number of the server of the request is added one;
If the connection number for the server requested in the service request has reached the connection number threshold value, the session protocol is selected
The smallest server of server connections redirects connection in table, and the connection number of the server of selection is added one.
Further, the method also includes: when client by SDN network to server send service disruption request
When, controller intercepts and captures service disruption request, and by the server of client ip, request in service disruption request
IP, session id and service protocol number are matched with the session protocol list item in the session protocol table;If being assisted in the session
There is no matched session protocol list item in view table, then begs off from doing processing to the service disruption;If in the session protocol table
In have matched session protocol list item, then delete matched session protocol list item, and the connection number of the server of request is subtracted one.
To achieve the above object, embodiment of the present invention also provides a kind of Smallest connection SiteServer LBS based on SDN,
It include: interchanger, for establishing channel with controller, and to controller report server protocol message;Controller, for preparatory
Smallest connection load balancing allocation list is set and session protocol table, the Smallest connection load balancing allocation list include connection number threshold
Value, the session protocol table includes the connection number of server;When the server protocol message that the interchanger received in SDN reports
When, the session protocol list item in the session protocol table is generated according to the server protocol message;It is sent out when getting client
When the service request sent, session protocol table is searched according to the service request, if not matched in the session protocol table
Session protocol list item selects if the connection number for the server requested in the service request is less than the connection number threshold value
The server of the request is attached;If the connection number for the server requested in the service request has reached the connection
Number threshold value, then select the smallest server of server connections in the session protocol table to redirect connection.
Therefore a kind of Smallest connection load-balancing method that provides of embodiment of the present invention and system, pass through control
Device can the server to whole network carry out unified calculation connection number, thus when the server requested in the service request of client
When having reached connection number threshold value, service request can be redirected to the few server of connection number in time, and entire strategy is high
Effect and it is simple.
Specific embodiment
To keep the purposes, technical schemes and advantages of embodiment of the present invention clearer, implement below in conjunction with the present invention
The technical solution in embodiment of the present invention is clearly and completely described in attached drawing in mode, it is clear that described reality
The mode of applying is some embodiments of the invention, rather than whole embodiments.Based on the embodiment in the present invention, ability
Domain those of ordinary skill every other embodiment obtained without creative efforts, belongs to the present invention
The range of protection.
SDN is a kind of new network of Emulex network innovation framework, passes through open flows (OpenFlow) for network equipment control plane and number
It separates according to face, is shielded by the controller management concentrated without underlay network device (router, interchanger, firewall) is relied on
The difference from underlay network device has been covered, to realize the flexible control of network flow, has become network more as pipeline
Add intelligence.SDN is to separate the control on the network equipment, by the controller management concentrated, without dependence bottom-layer network
Equipment (router, interchanger, firewall), shields the difference from underlay network device.In addition, control is complete opening
, user can be routed with customized network and transmission rule strategy, thus more flexible and intelligent.
Embodiment of the present invention provides a kind of Smallest connection SiteServer LBS based on SDN, as shown in Figure 1, SDN network
In include controller and interchanger, wherein the interchanger in SDN network is by the controller management concentrated.In addition, client kimonos
Business device is connected with interchanger respectively, is communicated by SDN network.
Embodiment of the present invention provides a kind of Smallest connection load-balancing method based on SDN.Referring to Fig. 2, the side
Method is applied on the controller in SDN, comprising the following steps:
Step S21: controller presets Smallest connection load balancing allocation list and session protocol table based on SDN.
In the present embodiment, controller presets Smallest connection load balancing allocation list, and Smallest connection load is equal
Configuration item in weighing apparatus allocation list includes Smallest connection load-balancing function and connection number threshold value, wherein Smallest connection load balancing function
It can be used to be arranged and open and close Smallest connection load-balancing function, connection number threshold value is for being arranged connection number threshold value, default value
It can be 128 connection numbers, it is specific as shown in table 1.
Table 1
In the present embodiment, controller also presets session protocol table, which includes server ip word
Section, connection digital section, protocol fields, client IP field and session field, it is specific as shown in table 2.
Table 2
Field |
Meaning |
Server IP field (index) |
Indicate server ip address |
Connect digital section |
Indicate the connection number of this server |
Protocol fields |
Indicate service agreement number |
Client IP field |
Indicate client ip address |
Session field |
Indicate session id |
Step S22: controller and interchanger establish channel.
In the present embodiment, SDN switch needs to initialize open flows firstly the need of the channel established with controller
(OpenFlow) channel.Interchanger is by privately owned Experimenter message to the MAC of controller report interchanger oneself
Location and port id.
Compared to the prior art, present embodiment extends privately owned Experimenter message, extension
Experimenter message format is as shown in figure 3, Experimenter value needs to organize to apply to ONF for 255;
Experimenter type value is shown to be from interchanger to controller for 1, and Experimenter type value is shown to be for 2 from control
Device processed is to interchanger.In addition, further including MAC Address (the Own MAC of oneself in the Experimenter message of extension
Address) and port id (Port ID), wherein port id maximum supports 128.
Step S23: controller receives the server protocol message that the interchanger in SDN reports, and is assisted according to the server
View message generates the session protocol list item in pre-set session protocol table.
In the present embodiment, after the completion of the Path Setup of the interchanger in SDN and controller, interchanger is on controller
The server protocol message of connected server is reported, server protocol message enters controller, and controller extracts clothes respectively
Business device IP, client ip, session id and service protocol number, and the connection number of each server is calculated, to generate session protocol
Session protocol list item in table.
Step S24: when controller gets the service request of client transmission, session protocol is searched according to service request
Table ignores the service request if there is matched session protocol list item;If carried out without matched session protocol list item
Step S25.
In the present embodiment, when client sends service request to server by SDN network, controller is intercepted and captured should
Service request includes client ip, the server ip of request, session id and service protocol number in the service request.
Controller is by client ip, server ip, session id and the service protocol number and session protocol table in service request
It is matched.If there is matched session protocol list item, then the service request this time intercepted and captured is not new service request, therefore is neglected
Slightly service request, without being operated.
Step S25 judges the connection number of the server of request, if it is less than connection number threshold value, carries out step S26;If
Reach connection number threshold value, carries out step S27.
In the present embodiment, controller is by client ip, server ip, session id and the service agreement in service request
Number and session protocol table matched, if without matched session protocol list item, this time intercept and capture service request be new
Service request, needs to continue to judge whether the connection number for the server requested in the service request reaches preconfigured
Connection number threshold value in Smallest connection load balancing allocation list.
Step S26 selects the server of request to be attached, and the connection number of the server of request is added one.
In the present embodiment, if the connection number of the server of request is less than preconfigured Smallest connection load balancing
Connection number threshold value in allocation list then selects the server of request to be attached according to server ip, and by the service of request
The connection number of device adds one.
Step S27 selects the smallest server of connection number to redirect connection, and by the connection number of the server of selection
Add one.
In the present embodiment, if the connection number of the server of request reaches preconfigured Smallest connection load balancing
Connection number threshold value in allocation list, the then server requested have been saturated, and can not be attached with client.Controller searches meeting
The smallest server of connection number in agreement table is talked about, service request is redirected to the smallest server of the connection number and is attached,
And the connection number of the server of selection is added one.
Fig. 4 is the application example schematic diagram based on Fig. 2 method.As shown in figure 4, FTP (File Transfer
Protocol, File Transfer Protocol) client communicated by SDN network and ftp server, the wherein connection number of ftp server 1
It is 100, the connection number of ftp server 2 is 128.
Presetting connection number threshold value is 128.When the service request that the controller intercepting and capturing ftp client in SDN is sent, ask
When seeking connection ftp server 2, connection number threshold value, controller are had reached since the connection number of ftp server 2 is 128
FTP is redirected and ftp server 1 connects.
Another embodiment of the present invention also provides a kind of Smallest connection load-balancing method based on SDN.Please refer to figure
5, the method is applied on the controller in SDN, comprising the following steps:
Step S51~S53 is similar with step S21~S23, therefore details are not described herein.
Step S54: it if controller gets the service disruption request of client transmission, requests to search according to service disruption
Session protocol table, if ignoring the service disruption request without matched session protocol list item;If there is matched session is assisted
List item is discussed, step S55 is carried out.
In the present embodiment, when client, which sends service disruption to server by SDN network, requests, controller is cut
Service disruption request is obtained, includes client ip, the server ip of request, session id and service agreement in service disruption request
Number.
Controller by service disruption request in client ip, server ip, session id and service protocol number and session assist
View table is matched.If ignoring service disruption request without matched session protocol list item.
S55: matched session protocol list item is deleted, and the connection number of the server of request is subtracted one.
The Smallest connection load-balancing method based on SDN in through the foregoing embodiment, controller can be to whole network
Server is unifiedly calculated, and each server or chain road the biggish request of load difference can be smoothly distributed to, thus
Improve the load balance ability of whole network.
Please refer to Fig. 1.Embodiment of the present invention provides a kind of Smallest connection SiteServer LBS based on SDN, comprising:
Interchanger, for establishing channel with controller, and to controller report server protocol message;
Controller, for presetting Smallest connection load balancing allocation list and session protocol table, the Smallest connection is negative
Carrying equilibrium allocation table includes connection number threshold value, and the session protocol table includes the connection number of server;When receiving the friendship in SDN
Change planes the server protocol message reported when, according to the server protocol message generate the session in the session protocol table association
Discuss list item;When getting the service request of client transmission, session protocol table is searched according to the service request, if described
There is no matched session protocol list item in session protocol table, if the connection number for the server requested in the service request is less than
The connection number threshold value, then select the server of the request to be attached;If the server requested in the service request
Connection number have reached the connection number threshold value, then select in the session protocol table the smallest server of server connections into
Row redirects connection.
Specifically,
The interchanger, by privately owned Experimenter message to the MAC Address of controller report interchanger oneself
And port id, to establish the channel with controller;The server protocol message of the server connected respectively to controller report,
The server protocol message includes server ip, client ip, session id and service protocol number, so that described in controller generation
Session protocol list item in session protocol table.
The controller is intercepted and captured the service and is asked when client sends service request to server by SDN network
It asks, and the server ip of client ip, request in the service request, session id and service protocol number and the session is assisted
Session protocol list item in view table is matched;If having matched session protocol list item in the session protocol table, to institute
Service request is stated to be not processed;If there is no matched session protocol list item in the session protocol table, the clothes of request are judged
The connection number of business device;If the connection number for the server requested in the service request is less than the connection number threshold value, select
The server of the request is attached, and the connection number of the server of the request is added one;If in the service request
The connection number of the server of request has reached the connection number threshold value, then selects in the session protocol table server connections most
Small server redirects connection, and the connection number of the server of selection is added one.
The controller, is also used to: when client, which sends service disruption to server by SDN network, requests, intercepting and capturing
Service disruption request, and by server ip, session id and the service of client ip, request in service disruption request
Protocol number is matched with the session protocol list item in the session protocol table;If not matched in the session protocol table
Session protocol list item then begs off from doing processing to the service disruption;If there is matched session to assist in the session protocol table
List item is discussed, then deletes matched session protocol list item, and the connection number of the server of request is subtracted one.
The particular technique details of the above-mentioned Smallest connection SiteServer LBS based on SDN being related to and based on SDN's
It is similar in Smallest connection load-balancing method, therefore no longer specifically repeat.
Therefore a kind of Smallest connection load-balancing method and system based on SDN that embodiment of the present invention provides,
By controller can the server to whole network carry out unified calculation connection number, thus when client service request in request
Server when having reached connection number threshold value, service request can be redirected to the few server of connection number in time, and whole
A strategy is efficient and simple.
Each embodiment in this specification is described in a progressive manner, same and similar between each embodiment
Part may refer to each other, what each embodiment stressed is the difference with other embodiments.
Finally, it should be noted that being supplied to ability to the description of various embodiments of the invention above with the purpose described
Field technique personnel.It is that it is not intended to exhaustion or be not intended to and limit the invention to single disclosed embodiment.Institute as above
It states, various substitutions of the invention and variation will be apparent for above-mentioned technology one of ordinary skill in the art.Therefore,
Although having specifically discussed some alternative embodiments, other embodiment will be apparent or ability
Field technique personnel relatively easily obtain.The present invention is intended to include herein by discussion cross all substitutions of the invention, modification and
Variation, and fall in the other embodiment in the spirit and scope of above-mentioned application.