Content of the invention
For the problems referred to above, the purpose of embodiment of the present invention is to provide a kind of Smallest connection load based on SDN all
Weighing apparatus method and system, can unifiedly calculate to the server of whole network, be distributed to smooth for request larger for load difference
On each server or link, and whole strategy is efficient and simple.
For achieving the above object, embodiment of the present invention provides a kind of Smallest connection load-balancing method based on SDN, institute
The method of stating is applied on the controller in SDN, including:Controller pre-sets Smallest connection load balancing allocation list and session association
View table, the Smallest connection load balancing allocation list includes to connect number threshold value, and the session protocol table includes the connection of server
Number;When the server protocol message that the switch for receiving in SDN is reported, according to the server protocol message is generated
Session protocol list item in session protocol table;When the service request of client transmission is got, looked into according to the service request
Session protocol table is looked for, if there is no the session protocol list item for mating in the session protocol table, if please in the service request
The connection number of the server that asks then selects the server of the request to be attached less than the connection number threshold value;If described
The connection number of the server that asks in service request has reached the connection number threshold value, then select to service in the session protocol table
The server of device connection number minimum 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 are used for arranging opening and closing Smallest connection load balancing work(
Can, the connection number threshold value is used for arranging 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 are used for indicating server ip, connection digital section to be used for indicating this server
Connection number, protocol fields are used for indicating service agreement number, and client IP field is used for indicating client ip, and session field is used for referring to
Bright session id.
Further, described when the server protocol message that the switch for receiving in SDN is reported, according to the service
Device protocol massages generate the session protocol list item in the session protocol table, including:Switch is by privately owned
Experimenter message sets up switch and control in SDN to MAC Address and the port id of controller report switch oneself
The passage of device processed;The server protocol message of the server connected to controller report respectively by switch, 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 the service request of client transmission is got, session is searched according to the service request
Agreement table, if not having the session protocol list item for mating in the session protocol table, if the clothes that asks in the service request
The connection number of business device then selects the server of the request to be attached less than the connection number threshold value;If the service please
Ask the connection number of the server of middle request that the connection number threshold value has been reached, then select server connection in the session protocol table
The minimum server of number redirects connection, including:When client sends service request by SDN to server,
The service request intercepted and captured by controller, and by the client ip in the service request, the server ip of request, session id kimonos
Business protocol number is mated with the session protocol list item in the session protocol table;If having coupling in the session protocol table
Session protocol list item, then do not process to the service request;If there is no the session protocol for mating in the session protocol table
List item, then judge the connection number of the server of request;If the connection number of the server that asks in the service request is less than institute
Connection number threshold value is stated, is then selected the server of the request to be attached, and the connection number of the server of the request is added one;
If the connection number of the server that asks in the service request has reached the connection number threshold value, the session protocol is selected
In table, the server of server connections minimum redirects connection, and the connection number of the server of selection is added one.
Further, methods described also includes:When client sends service disruption request by SDN to server
When, controller intercepts and captures the service disruption request, and the server of the client ip during the service disruption is asked, request
IP, session id and service protocol number are mated with the session protocol list item in the session protocol table;If assisting in the session
There is no the session protocol list item for mating in view table, then beg off from doing process to the service disruption;If in the session protocol table
In have the session protocol list item of coupling, then delete the session protocol list item of coupling, and the connection number of the server of request subtracted one.
For achieving the above object, embodiment of the present invention also provides a kind of Smallest connection SiteServer LBS based on SDN,
Including:Switch, for setting up passage with controller, and to controller report server protocol message;Controller, for advance
Smallest connection load balancing allocation list and session protocol table are set, and the Smallest connection load balancing allocation list includes to connect number threshold
Value, the session protocol table includes the connection number of server;When the server protocol message that the switch for receiving in SDN is reported
When, the session protocol list item in the session protocol table is generated according to the server protocol message;Send out when client is got
During the service request that send, session protocol table is searched according to the service request, if do not mate in the session protocol table
Session protocol list item, if the connection number of the server that asks in the service request is selected less than the connection number threshold value
The server of the request is attached;If the connection number of the server that asks in the service request has reached the connection
Number threshold value, then select the server of server connections minimum in the session protocol table to redirect connection.
Therefore, a kind of Smallest connection load-balancing method and system that embodiment of the present invention is provided, by control
Device can carry out unified calculation connection number to the server of whole network, so as to when the server that asks in the service request of client
When connection number threshold value is reached, in time service request can be redirected to the few server of connection number, and whole strategy is high
Effect and simple.
Specific embodiment
Purpose, technical scheme and advantage for making embodiment of the present invention is clearer, implements below in conjunction with the present invention
Accompanying drawing in mode, is clearly and completely described to the technical scheme in embodiment of the present invention, it is clear that described reality
The mode of applying is a part of embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, ability
The every other embodiment obtained under the premise of creative work is not made by domain those of ordinary skill, belongs to the present invention
The scope of protection.
SDN is a kind of new network of Emulex network innovation framework, and which passes through open flows (OpenFlow) by network equipment chain of command and number
Separate according to face, by the controller management that concentrates, underlay network device (router, switch, fire wall), screen need not be relied on
The difference from underlay network device is covered, it is achieved thereby that the flexible control of network traffics, makes network become more as pipeline
Plus intelligence.SDN is to separate the control on the network equipment, by the controller management that concentrates, need not rely on bottom-layer network
Equipment (router, switch, fire wall), shields the difference from underlay network device.Additionally, control is to open completely
, user can be with self-defined network route and transmission rule strategy, so as to more flexibly and intelligent.
Embodiment of the present invention provides a kind of Smallest connection SiteServer LBS based on SDN, as shown in figure 1, SDN
Include controller and switch, wherein the switch in SDN is by the controller management that concentrates.Additionally, client kimonos
Business device connects with switch respectively, is communicated by SDN.
Embodiment of the present invention provides a kind of Smallest connection load-balancing method based on SDN.Fig. 2 is referred to, the side
Method is applied on the controller in SDN, is comprised the following steps:
Step S21:Controller pre-sets the Smallest connection load balancing allocation list based on SDN and session protocol table.
In the present embodiment, controller pre-sets Smallest connection load balancing allocation list, and the 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 work(
Can be used for arranging and Smallest connection load-balancing function is opened and closed, connection number threshold value is used for arranging connection number threshold value, default value
Can be 128 connection numbers, concrete as shown in table 1.
Table 1
In the present embodiment, controller also pre-sets session protocol table, and the session protocol table includes server ip word
Section, connection digital section, protocol fields, client IP field and session field, concrete as shown in table 2.
Table 2
Field |
Implication |
Server IP field (is indexed) |
Indicate server ip address |
Connection 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 switch set up passage.
In the present embodiment, SDN switch needs to initialize open flows firstly the need of the passage that sets up with controller
(OpenFlow) passage.Switch passes through MAC ground of the privately owned Experimenter message to controller report switch oneself
Location and port id.
Compared to the prior art, present embodiment is extended to privately owned Experimenter message, extension
Experimenter message format is as shown in figure 3, Experimenter value is needed to ONF tissue application for 255;
Experimenter type value is shown to be from switch to controller for 1, and Experimenter type value is shown to be from control for 2
Device processed is to switch.Additionally, in the Experimenter message of extension, also including MAC Address (the Own MAC of oneself
Address) and port id (Port ID), wherein port id is maximum supports 128.
Step S23:Controller receives the server protocol message that the switch in SDN is reported, and is assisted according to the server
View message generates the session protocol list item in the session protocol table for pre-setting.
In the present embodiment, in SDN, after the completion of switch and the Path Setup of controller, switch is on controller
The server protocol message of the connected server of report, server protocol message enters into 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, so as 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, if there are the session protocol list item of coupling, ignores the service request;If the session protocol list item not mated, is carried out
Step S25.
In the present embodiment, when client sends service request by SDN to server, controller is intercepted and captured should
Service request, the service request includes client ip, the server ip of request, session id and service protocol number.
Controller by the client ip in service request, server ip, session id and services protocol number and session protocol table
Mated.If there are the session protocol list item of coupling, then the service request that this time intercepts and captures is not new service request, therefore neglects
Slightly the service request, need not be operated.
Step S25, judges the connection number of the server of request, if less than connection number threshold value, carries out step S26;If
Connection number threshold value is reached, carries out step S27.
In the present embodiment, controller is by the client ip in service request, server ip, session id and service agreement
Number and session protocol table mated, if the session protocol list item not mated, the service request that this time intercepts and captures is new
Whether service request, need the connection number that continues to judge the server that asks in the service request to reach and be pre-configured with
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 the Smallest connection load balancing being pre-configured with
Connection number threshold value in allocation list, then select the server that asks to be attached according to server ip, and the service by request
The connection number of device adds one.
Step S27, selects the server of connection number minimum to redirect connection, and the connection number by the server for selecting
Plus one.
In the present embodiment, if the connection number of the server of request reaches the Smallest connection load balancing being pre-configured with
Connection number threshold value in allocation list, then the server that asks saturation, it is impossible to be attached with client.Meeting searched by controller
Connect the server of number minimum in words agreement table, the server that service request is redirected to the connection number minimum 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 (FTP)) client communicated by SDN and ftp server, the wherein connection number of ftp server 1
For 100, the connection number of ftp server 2 is 128.
It is 128 to pre-set connection number threshold value.When the service request of ftp client transmission intercepted and captured by the controller in SDN, please
When seeking connection ftp server 2, the connection number due to ftp server 2 has reached connection number threshold value for 128, therefore controller
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.Refer to figure
5, methods described is applied on the controller in SDN, is comprised the following steps:
Step S51~S53 is similar with step S21~S23, therefore will not be described here.
Step S54:If controller gets the service disruption request of client transmission, searched according to service disruption request
Session protocol table, if the session protocol list item not mated, ignores service disruption request;Session association if there are coupling
View list item, carries out step S55.
In the present embodiment, when client sends service disruption request by SDN to server, controller cuts
The service disruption request is obtained, the service disruption request includes client ip, the server ip of request, session id and service agreement
Number.
Controller service disruption is asked in client ip, server ip, session id and service protocol number and session association
View table is mated.If the session protocol list item not mated, ignore the service disruption request.
S55:The session protocol list item of coupling is deleted, and the connection number of the server of request is subtracted one.
By the Smallest connection load-balancing method based on SDN in above-described embodiment, controller can be to whole network
Server is unifiedly calculated, and can be distributed on each server or link smooth for request larger for load difference, so as to
Improve the load balance ability of whole network.
Refer to Fig. 1.Embodiment of the present invention provides a kind of Smallest connection SiteServer LBS based on SDN, including:
Switch, for setting up passage with controller, and to controller report server protocol message;
Controller, for pre-setting Smallest connection load balancing allocation list and session protocol table, the Smallest connection is born
Carrying equilibrium allocation table includes to connect 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 for reporting when, generate the session association in the session protocol table according to the server protocol message
View list item;When the service request of client transmission is got, session protocol table is searched according to the service request, if described
There is no the session protocol list item for mating in session protocol table, if the connection number of the server that asks 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 that asks in the service request
Connection number reached the connection number threshold value, then select the server of the minimum of server connections in the session protocol table to enter
Row redirects connection.
Specifically,
The switch, by privately owned Experimenter message to the controller report switch MAC Address of oneself
And port id, set up the passage with controller;The server protocol message of the server for being connected to controller report respectively,
The server protocol message includes server ip, client ip, session id and service protocol number, so that controller generation is described
Session protocol list item in session protocol table.
The controller, when client sends service request by SDN to server, intercepting and capturing the service please
Ask, and the client ip in the service request, the server ip of request, session id and service protocol number are assisted with the session
Session protocol list item in view table is mated;If having the session protocol list item of coupling in the session protocol table, to institute
State service request not process;If there is no the session protocol list item for mating in the session protocol table, the clothes that asks are judged
The connection number of business device;If the connection number of the server that asks in the service request is selected less than the connection number threshold value
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 select in the session protocol table server connections most
Little server redirects connection, and the connection number of the server of selection is added one.
The controller, is additionally operable to:When client sends service disruption request by SDN to server, intercept and capture
The service disruption request, and the client ip during the service disruption is asked, the server ip of request, session id and service
Protocol number is mated with the session protocol list item in the session protocol table;If not mating in the session protocol table
Session protocol list item, then beg off from doing process to the service disruption;If there is the session association of coupling in the session protocol table
View list item, then delete the session protocol list item of coupling, and the connection number of the server of request 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
Similar in Smallest connection load-balancing method, therefore no longer specifically repeat.
Therefore, a kind of Smallest connection load-balancing method based on SDN and system that embodiment of the present invention is provided,
Unified calculation connection number can be carried out by controller to the server of whole network, so as to when request in the service request of client
Server when reaching connection number threshold value, in time service request can be redirected to and connect the few server of number, and whole
Individual strategy is efficient and simple.
Each embodiment in this specification is all described by the way of going forward one by one, identical similar between each embodiment
Part mutually referring to what each embodiment was stressed is the difference with other embodiment.
Finally it should be noted that:Above with the purpose for describing, ability is supplied to the description of the various embodiments of the present invention
Field technique personnel.It is not intended to exhaustion or be not intended to limit the invention to single disclosed embodiment.As above institute
State, the various replacements of the present invention and change are will be apparent for above-mentioned technology one of ordinary skill in the art.Therefore,
Although specifically discuss the embodiment of some alternatives, other embodiment will be apparent, or ability
Field technique personnel relatively easily draw.It is contemplated that all replacements of the present invention for having discussed including here, modification and
Change, and the other embodiment in the spirit and scope of above-mentioned application that falls.