Disclosure of Invention
In view of the foregoing problems, embodiments of the present invention provide a load balancing method, apparatus, and system based on an SDN, which can calculate a PageRank sum of all links of a forwarding path based on an SDN architecture, and select a path with the smallest PageRank sum to forward a packet.
In order to achieve the above object, an embodiment of the present invention provides a load balancing method based on an SDN, including: the method comprises the steps that a controller presets a minimum webpage level Pagerank load balancing configuration table, the configuration table comprises a Pagerank default value, and the Pagerank value of a forwarding node with the minimum switch ID in the SDN is taken as the Pagerank default value; the controller acquires a network topological structure and calculates a forwarding node Pagerank value according to the network topological structure; the controller receives the link load reported by the switch and calculates a link Pagerank value according to the link load; the controller receives a message which is reported by the switch and is not matched with the flow table, calculates a forwarding path according to the feature code of the message, and calculates the sum of the link Pagerank values of all the forwarding paths; and the controller adds the forwarding path with the minimum sum of the Pagerank values of the links into the flow table and sends the forwarding path to the switch, so that the switch forwards the message according to the forwarding path.
Further, the minimum Pagerank load balancing configuration table further comprises a minimum Pagerank load balancing function for turning on and off the minimum Pagerank load balancing function.
Further, the controller obtains a network topology structure and calculates the forwarding nodes of all forwarding nodes according to the network topology structure
Pagerank, comprising: the controller acquires a network topology structure according to a link layer discovery protocol; the calculation formula of the forwarding node Pagerank value is as follows:
wherein, R (i) represents the PageRank value of the forwarding node i; b (i) represents all forwarding nodes connected to node i; r (j) represents the PageRank value for forwarding node j; n (j) represents the number of external connections of node j.
Further, the controller receives the link load reported by the switch, and calculates a link Pagerank value according to the link load, including: the controller receives the MAC address, the port ID and the link load of the switch through the private Experimenter message; the calculation formula of the Pagerank value of the link is as follows:
R(L)=(R(s)/N(s))*C
wherein R (L) represents the PageRank value of link L; r(s) represents the PageRank value of the source forwarding node s; n(s) represents the number of external connections of the source node s; c is the load balancing of this link.
Further, the controller receives a message of an unmatched flow table reported by the switch, calculates forwarding paths according to feature codes of the message, and calculates the sum of link pageank values of the forwarding paths, including: the controller receives a message which is reported by the switch and does not match the flow table, acquires a source IP and a destination IP from the message, calculates a forwarding path according to the source IP and the destination IP, and respectively adds link Pagerank values on the forwarding paths to obtain the sum of the link Pagerank values of all the forwarding paths.
In order to achieve the above object, an embodiment of the present invention further provides a load balancing system based on an SDN, including: the switch is used for reporting the link load and the message which is not matched with the flow table to the controller; the controller is used for presetting a minimum Pagerank load balancing configuration table, the configuration table comprises a Pagerank default value, and the Pagerank value of the forwarding node with the minimum switch ID in the SDN is taken as the Pagerank default value; acquiring a network topological structure, and calculating a forwarding node Pagerank value according to the network topological structure; when receiving the link load reported by the switch, calculating a link Pagerank value according to the link load; when a message which is not matched with a flow table is received, calculating forwarding paths according to the feature codes of the message, and calculating the sum of the Pagerank values of the links of the forwarding paths; adding the forwarding path with the minimum sum of the Pagerank values of the links into the flow table and issuing the forwarding path to the switch; the switch is further configured to forward the packet according to the forwarding path.
In order to achieve the above object, an embodiment of the present invention further provides an apparatus for controlling load balancing based on an SDN, including: the system comprises a first processing module, a second processing module and a forwarding module, wherein the first processing module is used for presetting a minimum Pagerank load balancing configuration table, the configuration table comprises a Pagerank default value, and the Pagerank value of the forwarding node with the minimum switch ID in the SDN is taken as the Pagerank default value; the second processing module is used for acquiring a network topological structure and calculating a forwarding node Pagerank value according to the network topological structure; the third processing module is used for receiving the link load reported by the switch and calculating a link Pagerank value according to the link load; the fourth processing module is used for receiving the messages which are reported by the switch and are not matched with the flow table, calculating forwarding paths according to the feature codes of the messages, and calculating the sum of the link Pagerank values of the forwarding paths; and the fifth processing module is used for adding the forwarding path with the minimum sum of the Pagerank values of the links into the flow table and issuing the forwarding path to the switch so that the switch forwards the message according to the forwarding path.
As can be seen from the above, according to the load balancing method, device and system based on the SDN provided by the present invention, the controller presets the minimum webpage level Pagerank load balancing configuration table, calculates the Pagerank of the forwarding node according to the network topology, calculates the link Pagerank value according to the link load reported by the switch, calculates the forwarding path according to the message not matching the flow table, and calculates the sum of the link Pagerank values of each forwarding path, so that the forwarding path with the minimum sum of the link Pagerank values can be selected to forward the message based on the SDN architecture.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be described clearly and completely with reference to the accompanying drawings of the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
SDN is a novel network architecture, and can separate a control plane and a data plane of a network device through an OpenFlow (open flow) technology, so as to implement flexible control of network traffic. In an SDN, a controller implementing control plane functions and several switches implementing data plane functions are included.
An embodiment of the present invention provides a load balancing system based on an SDN, as shown in fig. 1, an SDN network includes a controller and a switch, where the switch in the SDN network is managed by a centralized controller. In addition, the client and the server are respectively connected with the switch and communicate through the SDN network.
The embodiment of the invention provides a load balancing method based on an SDN. Referring to fig. 2, the method is applied to a controller in an SDN, and includes the following steps:
step S21: the controller presets a minimum Pagerank load balancing configuration table.
In this embodiment, the controller sets a minimum pageank load balancing configuration table in advance, where configuration items of the configuration table include a minimum pageank load balancing function and a pageank default value, where the minimum pageank load balancing function is to turn on and off the minimum pageank load balancing function, and the pageank default value is that the ID of the entire network switch is minimum, and the pageank default value is to be taken, for example, the default value is 10. Specifically, the results are shown in Table 1.
TABLE 1
Step S22: the controller compares the switch IDs in the SDN network, and takes the Pagerank of the forwarding node with the minimum switch ID as a Pagerank default value.
Step S23: the controller acquires a network topological structure and calculates the Pagerank values of all forwarding nodes according to the network topological structure.
In the present embodiment, the controller generates a network topology from LLDP (Link Layer Discovery Protocol).
The calculation of the values is as follows:
wherein the content of the first and second substances,
r (i) represents the PageRank value of forwarding node i;
b (i) represents all forwarding nodes connected to node i;
r (j) represents the PageRank value for forwarding node j;
n (j) represents the number of external connections of node j.
Step S24: and the controller receives the MAC address, the port ID and the link load of the controller, which are reported by the switch, and calculates the Pagerank value of the link according to the link load.
In this embodiment, the controller further receives its own MAC address, port ID, and link load reported by the switch via the private Experimenter message.
Compared with the prior art, the embodiment expands the Experimenter message, the format of the expanded Experimenter message is shown in fig. 3, and the Experimenter with the value of 255 needs to apply to the ONF organization; an Experimenter type value of 1 indicates that it is from the switch to the controller. In addition, the MAC address, the port ID and the link load of the self are expanded in the expanded Experimenter message, wherein the maximum port is 128 ports, and the value range of the link load is from 0% to 100%.
In this embodiment, the link Pagerank value calculation formula is as follows:
R(L)=(R(s)/N(s))*C
wherein the content of the first and second substances,
r (L) represents the PageRank value of link L;
r(s) represents the PageRank value of the source forwarding node s;
n(s) represents the number of external connections of the source node s;
c is the load balancing of this link.
Step S25: the controller receives messages which are reported by the switch and are not matched with the flow table, calculates forwarding paths according to the feature codes of the messages, and calculates the sum of the link Pagerank values of the forwarding paths.
In this embodiment, after a packet enters an SDN network, an ingress switch queries a flow table, and if the packet matches the flow table, forwards the packet according to a forwarding path in the flow table; and if the message does not match the flow table, reporting the message to a controller.
When a message which is reported by a switch and does not match a flow table is received, a source IP and a destination IP are obtained from the message, forwarding paths are calculated according to the source IP and the destination IP, and link Pagerank values on the forwarding paths are added to obtain the sum of the link Pagerank values of the forwarding paths.
Step S26: and the controller adds the forwarding path with the minimum sum of the Pagerank values of the links into the flow table and sends the forwarding path to the switch, so that the switch forwards the message according to the forwarding path.
With continued reference to fig. 1, in an application example of the present invention, the client communicates with the server through an SDN network, and the controller is based on an equivalent routing hash algorithm function of the SDN and based on a traffic hash algorithm table.
The controller generates a network topology from the link layer discovery protocol, calculates pagerank (Pr) of all forwarding nodes from the network topology, e.g., Pr 10 for S1 and S3, Pr 5 for S0 and S2.
The switch sends the own MAC address, the port ID and the link load reported by the private owner identifier message to the controller, and the controller calculates the link Pagerank value according to the link load, for example, the link Pr of S1-S0 is 1, the link Pr of S0-S2 is 1, the link Pr of S2-S3 is 1, and the link Pr of S1-S3 is 4.
When the switch S1 receives a message sent by a client to a server, if the message does not match a flow table, the message is sent to the controller, and the controller parses a source IP and a destination IP from the message, and calculates a forwarding path according to the source IP and the destination IP, for example: the forwarding path 1 is S1-S3, and the forwarding path 2 is S1-S0-S2-S3. Adding the link Pagerank values on the forwarding paths to obtain a link Pagerank value sum of each forwarding path, wherein the link Pagerank value sum Pr of the forwarding path 1 is 4; and the sum Pr of the Pagerank values of the links of the forwarding path 2 is 3. Therefore, the forwarding path S1-S0-S2-S3 with the minimum sum of the links Pagerank is added into the flow table and issued to the switch, and the switch forwards the message according to S1-S0-S2-S3.
When the link load changes, the load balance of S1-S3 is reduced to 0.2, the sum of the link Pagerank values of S1-S3 is smaller than the sum of the link Pagerank values of S1-S0-S2-S3, the controller adds S1-S3 to the flow table and sends the flow table to the switch, and the switch forwards the message according to S1-S3.
Please continue to refer to fig. 1. An embodiment of the present invention provides a load balancing system based on an SDN, including:
the switch is used for reporting the link load and the message which is not matched with the flow table to the controller;
the controller is used for presetting a minimum Pagerank load balancing configuration table, the configuration table comprises a Pagerank default value, and the Pagerank value of the forwarding node with the minimum switch ID in the SDN is taken as the Pagerank default value; acquiring a network topological structure, and calculating a forwarding node Pagerank value according to the network topological structure; when receiving the link load reported by the switch, calculating a link Pagerank value according to the link load; when a message which is not matched with a flow table is received, calculating forwarding paths according to the feature codes of the message, and calculating the sum of the Pagerank values of the links of the forwarding paths; adding the forwarding path with the minimum sum of the Pagerank values of the links into the flow table and issuing the forwarding path to the switch;
the switch is further configured to forward the packet according to the forwarding path.
Please refer to fig. 4. An embodiment of the present invention provides an apparatus for controlling load balancing based on an SDN, including:
the system comprises a first processing module, a second processing module and a forwarding module, wherein the first processing module is used for presetting a minimum Pagerank load balancing configuration table, the configuration table comprises a Pagerank default value, and the Pagerank default value is used for taking the Pagerank value of the forwarding node with the minimum switch ID in the SDN as the Pagerank default value;
the second processing module is used for acquiring a network topological structure and calculating a forwarding node Pagerank value according to the network topological structure;
the third processing module is used for receiving the link load reported by the switch and calculating a link Pagerank value according to the link load;
the fourth processing module is used for receiving the messages which are reported by the switch and are not matched with the flow table, calculating forwarding paths according to the feature codes of the messages, and calculating the sum of the link Pagerank values of the forwarding paths;
and the fifth processing module is used for adding the forwarding path with the minimum sum of the Pagerank values of the links into the flow table and issuing the forwarding path to the switch so that the switch forwards the message according to the forwarding path.
The specific technical details of the SDN-based load balancing apparatus and system are similar to those of the SDN-based load balancing method, and therefore are not described herein again in detail.
As can be seen from the above, according to the load balancing method, device and system based on the SDN provided by the present invention, the controller presets the minimum webpage level Pagerank load balancing configuration table, calculates the Pagerank of the forwarding node according to the network topology, calculates the link Pagerank value according to the link load reported by the switch, calculates the forwarding path according to the message not matching the flow table, and calculates the sum of the link Pagerank values of each forwarding path, so that the forwarding path with the minimum sum of the link Pagerank values can be selected to forward the message based on the SDN architecture.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments can be referred to each other, and each embodiment focuses on the differences from the other embodiments.
Finally, it should be noted that: the foregoing description of various embodiments of the invention is provided to those skilled in the art for the purpose of illustration. It is not intended to be exhaustive or to limit the invention to a single disclosed embodiment. Various alternatives and modifications of the invention, as described above, will be apparent to those skilled in the art. Thus, while some alternative embodiments have been discussed in detail, other embodiments will be apparent or relatively easy to derive by those of ordinary skill in the art. The present invention is intended to embrace all such alternatives, modifications, and variances which have been discussed herein, and other embodiments which fall within the spirit and scope of the above application.