A kind of method for allocating network flow based on external policy server interaction
Technical field
The present invention relates to a kind of method for allocating network flow, particularly about a kind of method for allocating network flow based on external policy server interaction.
Background technology
Method for allocating network flow is also referred to as the load balancing strategy, is a kind ofly in traffic management client's data traffic average mark to be flow to method on a plurality of background servers, and the method helps to make full use of the function of all background servers.But along with rapid development of Internet, traditional load-balancing device can not satisfy the load balancing demand of current a lot of application services, and this mainly is owing to following reasons:
1, the application of L 1 customer (referring to buy the client of working load balancing equipment, is large enterprise units such as operator and website mostly) has certain complexity and particularity.Often exist effectively a kind of and algorithm targetedly, but this algorithm does not have versatility, so load-balancing device manufacturer is difficult in the general algorithm of realization on the load-balancing device for a concrete application.Contain different variable data in the request such as some terminal client (client of L 1 customer), but the content of being asked may be the same, if can rewrite original request this time, making and rewriting later request is the same resource of visit, just can from high-speed cache, read, thereby improve access speed.
2, the request faced of L 1 customer is very dynamic, and its rule also often changes, and this variation L 1 customer self is very clear, knows also how this upgrades processing.But traditional load balancing strategy is pre-set, can not be at once according to the variation of L 1 customer and own custom strategies satisfies the specific demand of L 1 customer.
In sum, current load-balancing device should provide a kind of effective and efficient manner that the special decision scheme of L 1 customer is fused in the algorithm of load balancing strategy.
Summary of the invention
At the problems referred to above, the purpose of this invention is to provide and a kind ofly can be fused to method for allocating network flow in the load balancing policing algorithm to the special decision scheme of L 1 customer based on external policy server interaction.
For achieving the above object, the present invention takes following technical scheme: a kind of method for allocating network flow based on external policy server interaction, and it may further comprise the steps: 1) a Web api interface that is connected by communication protocol with external policy server is set on load-balancing device; 2) terminal client transmit a request to load-balancing device; 3) load-balancing device is encapsulated in the request of the terminal client mode according to the communication protocol that sets in advance in the packet by the Web api interface, then packet is forwarded to external policy server; 4) external policy server is resolved packet according to the mode of the communications protocol that sets in advance, and the raw requests of terminal client need be rewritten based on oneself, then revised packet is sent to load-balancing device, realizes communicating by letter between load-balancing device and the external policy server; 5) load-balancing device is selected suitable background server in conjunction with the information of the external policy server received, and the request of the terminal client that will revise through external policy server is passed on the described background server; 6) background server is made response; 7) load-balancing device is transmitted to terminal client with background server to the response of described request.
The communication mode of described external policy server and load-balancing device comprises the communication mode that all are programmed and realize by Socket.
The communication mode of described Socket programming is one of HTTP, SNMP, SUN-RPC, CORBA and Web service protocol mode.
Described Web service agreement is one of SOAP and XML-RPC.
The present invention is owing to take above technical scheme, have the following advantages: 1, owing to the load balancing strategy of the inventive method with L 1 customer oneself taken into account, so this load balancing strategy has satisfied the specific demand of these L 1 customers self, can realize load balancing targetedly.2, owing to the load balancing strategy of the inventive method with operator or website or the like L 1 customer oneself taken into account, in case variation has taken place in the application service of operator or website or the like L 1 customer oneself, the strategic server that they can change oneself very easily adapts to variation, thereby finds the load balancing strategy of fast adaptation.
Description of drawings
Fig. 1 is an implementation procedure schematic diagram of the present invention
Embodiment
Below in conjunction with drawings and Examples the present invention is described in detail.
As shown in Figure 1, the present invention is in the application scenarios by traditional load-balancing device, background server and terminal client, increased by one group of external policy server, a Web api interface that is connected by communication protocol with external policy server has been set on load-balancing device simultaneously.
May further comprise the steps during the inventive method operation:
1, terminal client transmit a request on the load-balancing device;
2, Web api interface (the Application Program Interface of load-balancing device by defining, application programming interfaces), the request of the terminal client mode according to the communication protocol that sets in advance is encapsulated in the packet, then packet is forwarded to external policy server.
3, external policy server is resolved packet according to the mode of above-mentioned communication protocol, and the raw requests of terminal client need be rewritten based on self, then revised packet is sent to load-balancing device, realizes communicating by letter between load-balancing device and the external policy server.Externally in the packet that strategic server returns, also comprise the information that the assistant load balancing equipment carries out load balancing, give the load balancing strategy that external policy server is carried out the decision-making power of a part of load balancing with regard to having realized like this.
The mode of the communication protocol of carrying out between load-balancing device and the external policy server, support to use all communication modes of programming and realizing by Socket, include but not limited to the mode of HTTP (HTML (Hypertext Markup Language)), SNMP (Simple Network Management Protocol), SUN-RPC (SUN remote procedure call protocol), CORBA (common object request broker architecture) and Web service agreement, Web service agreement comprises SOAP (Simple Object Access Protocol), XML-RPC (XML remote procedure call protocol) etc. again.
4, load-balancing device goes out suitable background server in conjunction with the Information Selection of external policy server, and the request of the terminal client that will revise through external policy server is passed on this background server.
5, background server is made response.
6, load-balancing device is transmitted to terminal client with background server to this request responding.
By above-mentioned steps as can be seen, the inventive method can be fused to the special decision scheme of L 1 customer self in the load balancing strategy by external policy server, makes the distribution of network traffics can fully adapt to the particular application of L 1 customer.