Summary of the invention
The invention provides a kind of message processing method and device thereof, message information is carried out the problem that value that HASH calculates can't effectively be utilized by follow-up equipment in order to solve balanced group.
Message processing method provided by the invention is applied to the balanced route exchange device of organizing of holding load, and this method comprises:
After the route switching of the balanced group of holding load receives message, calculate the HASH value of this message, and, obtain the VLAN ID corresponding with the HASH value of this message according to the mapping relations of message HASH value that presets and VLAN ID;
Said route exchange device adds the VLAN ID that gets access in the said message to, and said message is transmitted to two-layer switching equipment, so that this two-layer switching equipment is according to VLAN forwarding-table item and this message of the forwarding of the VLAN ID in this message of configuration on it.
The route exchange device of the balanced group of holding load provided by the invention comprises:
Configuration module is used to dispose and the mapping relations information of stored messages HASH value and VLAN ID;
Balanced pack module is used for after receiving message, calculates the HASH value of this message, and according to the message HASH value of configuration on it and the mapping relations of VLAN ID, obtains the VLAN ID corresponding with the HASH value of this message;
Message processing module (MPM); The VLAN ID that is used for getting access to adds said message to; And through designated port said message is transmitted to the two-layer switching equipment that is connected with this equipment, so that this two-layer switching equipment is transmitted this message according to the VLAN forwarding-table item of configuration on it with VLAN ID in this message.
The useful technique effect of technique scheme of the present invention comprises:
In supporting the route exchange device VLAN ID that HASH value is corresponding of balanced group to be carried on to E-Packet, so that the downstream route exchange device is transmitted to corresponding server with data from the outbound port of corresponding VLAN according to VLAN ID, thus the realization data distribution.Compared with prior art, for the route exchange device of supporting balanced group, reduced of the requirement of this equipment to port number.
Another kind of message processing method provided by the invention is applied to the balanced route exchange device of organizing of holding load, disposes the mapping relations of HASH value and Database Identification on the routing device of the balanced group of said support, and this method comprises:
After the route switching of the balanced group of holding load receives message, calculate the HASH value of this message, and, obtain the Database Identification corresponding with the HASH value of this message according to the message HASH value of configuration on it and the mapping relations of Database Identification;
Said route exchange device adds the Database Identification that gets access in the said message to; And transmit said message according to the HASH value of said message through corresponding port in the equilibrium group, so that upstream device utilizes corresponding this message of database processing according to the Database Identification in this message.
The route exchange device of the balanced group of holding load provided by the invention comprises:
Configuration module is used to dispose the mapping relations information with stored messages HASH value and Database Identification;
Balanced pack module is used for after receiving message, calculates the HASH value of this message, and according to the message HASH value of configuration on it and the mapping relations of Database Identification, obtains the Database Identification corresponding with the HASH value of this message;
Message processing module (MPM); The Database Identification that is used for getting access to adds said message to; And transmit said message according to HASH value corresponding port from the equilibrium group of said message, so that upstream device utilizes corresponding this message of database processing according to the Database Identification in this message.
The useful technique effect of technique scheme of the present invention comprises:
During the Database Identification that the route exchange device of supporting equilibrium to organize is corresponding with the HASH calculated value is carried on and E-Packets,, handles the server in downstream so that indexing corresponding database according to this Database Identification.Compared with prior art, for server, saved the message processing expenditure of this equipment.
Embodiment
Because in the existing load balancing group technology, support the route exchange device of balanced group to be applied to follow-up equipment, thereby can cause that efficient is short of to some extent under certain application scenarios being used for the HASH value that load balancing calculates.
As shown in Figure 2, on the one hand, when equilibrium group outbound port more for a long time, can go up at the route exchange device of supporting balanced group (the safe shunting device R1 of the balanced group of the support among the figure) and consume a large amount of access interface, the port density that equipment R1 is supported is had relatively high expectations.On the other hand, as shown in Figure 3, after flow was divided to each system, each system was bearing the analysis and the processing of several types of data.For example; In existing realization; Server will be according to information such as the source MAC of data message, target MAC (Media Access Control) address, source IP address, purpose IP address, source port number, destination slogans; Inquire about different databases respectively; Like this; Server is posed a big pressure, especially true for IPV6, be equivalent to repeat the HASH computing of being accomplished of equipment R1.
To the problems referred to above, the embodiment of the invention has proposed the message-handling processor system based on the equilibrium group, in order to solve balanced group message information is carried out the problem that value that HASH calculates can't effectively be utilized by follow-up equipment.Below in conjunction with accompanying drawing the embodiment of the invention is described in detail.
Referring to Fig. 4 and Fig. 5, the message handling process sketch map that provides for the embodiment of the invention one based on the equilibrium group.Through present embodiment, the port that can reduce the route exchange device of supporting balanced group takies.
The network architecture of present embodiment can be as shown in Figure 5; Wherein, Support the route exchange device of balanced group (to be expressed as the safe shunting device R1 that supports balanced group among the figure; Be designated hereinafter simply as equipment R1) be connected with two-layer switching equipment and (be expressed as Layer 2 switch S1 among the figure; Hereinafter to be referred as equipment S1), be connected with each server under the equipment S1.Dispose message HASH calculated value and VLAN (Virtual Local Area Network on the equipment R1; VLAN) mapping relations table; This table is embodied in the mapping relations of HASH key and VLAN-TAG (being VLAN ID), disposes the VLAN forwarding-table item on the equipment S1.
Based on this mapping relations table, the flow process of present embodiment mainly comprises step 401~403:
Step 401, the inbound port of equipment R1 receive message that upstream equipment sends and after the ACL coupling is passed through, and the customizing messages of this message is carried out HASH calculate.
In the practical implementation, equipment R1 can like source MAC, target MAC (Media Access Control) address, source IP address, purpose IP address or TCP/UDP port numbers etc., carry out HASH and calculate according to the customizing messages of heading, obtains the HASH value HASH key of message.
Step 402; Equipment R1 is according to the HASH calculated value of configuration on it and the mapping relations table of VLAN-TAG; Search the VLAN-TAG corresponding, this VLAN-TAG is made an addition to this message, and transmit this message to equipment S1 through the outbound port of setting with the HASH key of this message.
In the practical implementation, can different HASH key is corresponding with one or more appointment outbound ports, be about to different flow HASH to this designated port.The outbound port of this setting can be a port in this equilibrium group, also can be the port that a plurality of balanced groups are shared.
Step 403 after the inbound port of equipment S1 receives this message, is confirmed corresponding VLAN according to the VLAN-TAG in this message, determines corresponding output port according to corresponding VLAN forwarding-table item, and this message is transmitted to corresponding server from this outbound port.
In order to further specify above-mentioned flow process, dividing stream packet with the source IP address according to message below is that example specifically describes.Do not using under the situation of present embodiment; Source IP address is that the HASH key of IP1 is key1; The key1 corresponding output port is the PORT1 that is connected in server 1; By that analogy; Like this; The message that comes from IP1 is divided to server 1, and the message that comes from IP2 is diverted to server 2, and the message that comes from IP3 is diverted to server 3.In order to realize identical shunting effect, in the present embodiment, on equipment R1, dispose message HASH calculated value as shown in table 1 and the mapping relations table of VLAN, configuration VLAN forwarding-table item as shown in table 2 on equipment S1:
The mapping relations of table 1, HASH calculated value and VLAN-TAG
HASH?key |
Key1 |
Key2 |
Key3 |
VLAN-TAG |
TAG1 |
TAG2 |
TAG3 |
Outbound port |
PORT?5 |
PORT?5 |
PORT?5 |
The corresponding relation of table 2, VLAN and outbound port
VLAN-TAG |
VLAN1 |
VLAN?2 |
VLAN?3 |
PORT |
PORT?1 |
PORT?2 |
PORT?3 |
Wherein, Key1 is the HASH calculated value of IP1, and the outbound port of VLAN1 on equipment S1 that TAG1 is corresponding is PORT1, and PORT1 is the port between equipment S1 and the server 1, and the corresponding relation of other IP address and VLAN outbound port by that analogy.
Like this; Equipment R1 is after receiving that source IP address is the message of IP1; Calculate Key1 according to IP1; Find corresponding TAG1 according to table 1; Add TAG1 to this message; As the outer TAG of this message, so that equipment S1 can be according to the corresponding VLAN of this TAG coupling, equipment R1 is transmitted to equipment S1 with this message from the port PO RT5 of this equipment then.Equipment S1 is after receiving this message, and according to the TAG in this message, through inquiring about the outbound port PORT1 that VLAN forwarding-table item on it obtains corresponding VLAN, bullet falls this TAG in the message then, and message is transmitted to server 1 from PORT1 handles.In like manner, be the message of IP2 for source IP address, then can be transmitted to server 2 and handle through PORT2, be the message of IP3 for source IP address, then can be transmitted to server 3 and handle through PORT3.
Be that example is described with the source IP address of message as Divergence Accordance only below, for source IP address and the tcp port number with message, or target ip address, or source MAC, or destination-mac address etc. is the situation of Divergence Accordance, and its relevant configuration and handling process are similar.
Description according to above present embodiment can be found out; Support the route exchange device VLAN ID (being above-mentioned VLAN-TAG) that the HASH value is corresponding of balanced group to be written in the field that E-Packets; And data HASH is transmitted to two layers of route exchange device in downstream to same port; So that these two layers of route exchange devices are transmitted to corresponding server with data from the outbound port of corresponding VLAN according to VLAN ID, thereby realize data distribution.Compared with prior art, for the route exchange device of supporting balanced group, reduced of the requirement of this equipment to port number.
Referring to Fig. 6 and Fig. 7, the message handling process sketch map that provides for the embodiment of the invention two based on the equilibrium group.Through present embodiment, can reduce the message processing expenditure of upstream device.
The network architecture of present embodiment can wherein, support the route exchange device (be expressed as the safe shunting device R1 that supports balanced group among the figure, be designated hereinafter simply as equipment R1) of balanced group to be connected with each server as shown in Figure 7.Database adopts distributed deployment, as, the database of storing same categorical data can be distributed on each server, and the database of storing same type of data is assigned identical type identification.Dispose the mapping relations table of message HASH calculated value and MAC Address on the equipment R1, dispose the mapping relations table of MAC Address and Service Database on the server 3.
Based on above-mentioned mapping relations table, the flow process of present embodiment mainly comprises step 601~603:
Step 601, the inbound port of equipment R1 receive message that upstream equipment sends and after the ACL coupling is passed through, and the customizing messages of this message is carried out HASH calculate.
During practical implementation, equipment R1 can like source MAC, target MAC (Media Access Control) address, source IP address, purpose IP address or TCP/UDP port numbers etc., carry out HASH and calculate according to the customizing messages of heading, obtains the HASH value HASH key of message.
Step 602; Equipment R1 is according to the HASH calculated value of configuration on it and the mapping relations table of MAC Address; Search the MAC Address corresponding with the HASH value of this message; This MAC Address is made an addition to this message as target MAC (Media Access Control) address, and this message corresponding output port in the equilibrium group is forwarded according to the HASH value.
Step 603 after the inbound port of server receives this message, according to the target MAC (Media Access Control) address in this message, utilizes the corresponding service database that this message is handled.
Usually, but various flows HASH is different HASH key, like this, different HASH key is mapped as different MAC Address, and different MAC Address just can realize that corresponding to the different service database various flows is mapped to the different service database to be handled.Present embodiment is through setting up the mapping relations of HASH value and MAC Address on the route exchange device of supporting balanced group; And be carried on message according to the MAC Address that these mapping relations will be corresponding with the HASH value of message as target MAC (Media Access Control) address and be transmitted to server, server just can be handled to the corresponding service database according to the target MAC (Media Access Control) address fast mapping in the message.And the message that forwards through existing balanced group of technology is not owing to carry the target MAC (Media Access Control) address in the present embodiment; Therefore need server analytic message header again; Like information such as source MAC, target MAC (Media Access Control) address, source IP address, purpose IP address, source port, destination interface and calculate, thereby match corresponding database.
In order to further specify above-mentioned flow process, be the implementation procedure that example is described this flow process to dispose 3 Service Databases on the server 3 below.Do not using under the situation of present embodiment; Corresponding IP1, IP2 and IP3 dispose 3 Service Databases on the server 3; Certain port of server 3 can receive the message that source IP address is IP1, IP2 and IP3 (promptly carrying out after the HASH computing according to source IP address to message and be diverted to the port that is connected with server 3 transmitting); Server 3 receives analytic message head behind the message, according to the source IP address that parses message is mapped to corresponding database and handles.In order to realize identical shunting effect; In the present embodiment; Set up the corresponding relation of MAC Address and Service Database, be equivalent to, on equipment R1, dispose the message HASH calculated value as shown in table 3 and the mapping relations table of MAC Address with MAC Address identification service database:
The mapping relations table of table 3, HASH calculated value and target MAC (Media Access Control) address
HASH?key |
Key1 |
Key2 |
Key3 |
MAC |
MAC1 |
MAC?2 |
MAC?3 |
Outbound port |
PORT3 |
PORT3 |
PORT3 |
Wherein, Key1 is the HASH calculated value of IP1, and MAC1 is corresponding with database 1, and the corresponding relation of other HASHKey and MAC Address by that analogy.
Like this; Equipment R1 is after receiving that source IP address is the message of IP1; Calculate Key1 according to IP1; Find corresponding MAC1 according to table 3; Add this MAC Address to this message as target MAC (Media Access Control) address; So that server can be according to this purpose MAC coupling corresponding service database 1, equipment R1 is transmitted to server 3 (HASH key1, key2 and key3 equal corresponding outbound port PORT3) with message from the port PO RT3 of Connection Service device 3 according to the mapping relations of HASH value and outbound port.Server 3 indexes corresponding service database 1 according to the target MAC (Media Access Control) address MAC1 in this message and handles after receiving this message.In like manner, the message that for source IP address is IP2 is after being diverted to server 3, and server 3 indexes database 2 and handles, and the message that for source IP address is IP3 is after being diverted to server 3, and server 3 indexes database 3 and handles.
Be that example is described with the source IP address of message as Divergence Accordance only below, for source IP address and the tcp port number with message, or target ip address, or source MAC, or destination-mac address etc. is the situation of Divergence Accordance, and its relevant configuration and handling process are similar.
In addition; It is that example is described that present embodiment is mapped as target MAC (Media Access Control) address with message HASH value; In fact; Also can be directly with the HASH value of message; Perhaps the HASH value is mapped as other information and it is carried on as identification information that can identification database and send to upstream device (upstream device should be able to be resolved the Database Identification information of carrying in this message and can be carried out handled) in the message, also can realize the technique effect of present embodiment.
Description according to above present embodiment can be found out; Support the route exchange device MAC Address that the HASH calculated value is corresponding of balanced group to be written in the field that E-Packets, handle so that the server in downstream indexes corresponding database according to this MAC Address.Compared with prior art, for server, saved the message processing expenditure of this equipment.
Need to prove that the foregoing description one can be used in combination with embodiment two.
Based on identical technical conceive, the embodiment of the invention also provides a kind of route exchange device.
Referring to Fig. 8, the structural representation of the route exchange device that provides for the embodiment of the invention, the balanced group of this equipment holding load can be applicable to flow process shown in Figure 4.This equipment can comprise:
Configuration module 801, the mapping relations information that is used to dispose and store HASH value and VLAN ID;
Balanced pack module 802 is used for after receiving message, calculates the HASH value of this message, and according to the message HASH value of configuration on it and the mapping relations of VLAN ID, obtains the VLAN ID corresponding with the HASH value of this message;
Message processing module (MPM) 803; The VLAN ID that is used for getting access to adds said message to; And through designated port said message is transmitted to the two-layer switching equipment that is connected with this equipment, so that this two-layer switching equipment is transmitted this message according to the VLAN forwarding-table item of configuration on it with VLAN ID in this message.Wherein, said preassigned port can be the port in the load balancing group or be a plurality of balanced ports of being shared of organizing.
Referring to Fig. 9, the structural representation of the route exchange device that provides for the embodiment of the invention, the balanced group of this equipment holding load can be applicable to flow process shown in Figure 6.This equipment can comprise
Configuration module 901, the mapping relations information that is used to dispose and store HASH value and Database Identification;
Balanced pack module 902 is used for after receiving message, calculates the HASH value of this message, and according to the message HASH value of configuration on it and the mapping relations of Database Identification, obtains the Database Identification corresponding with the HASH value of this message;
Message processing module (MPM) 903; The Database Identification that is used for getting access to adds said message to; And transmit said message according to HASH value corresponding port from the equilibrium group of said message, so that upstream device utilizes corresponding this message of database processing according to the Database Identification in this message.
Wherein, Database Identification can be a MAC Address, is used for identification database, and message processing module (MPM) 903 can be carried on Database Identification the target MAC (Media Access Control) address field of message.
Through the description of above execution mode, those skilled in the art can be well understood to the present invention and can realize by the mode that software adds essential general hardware platform, can certainly pass through hardware, but the former is better execution mode under a lot of situation.Based on such understanding; The part that technical scheme of the present invention contributes to prior art in essence in other words can be come out with the embodied of software product; This computer software product is stored in the storage medium; Comprise that some instructions are with so that a station terminal equipment (can be mobile phone; Personal computer; Server, the perhaps network equipment etc.) carry out the described method of each embodiment of the present invention.
The above only is a preferred implementation of the present invention; Should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; Can also make some improvement and retouching, these improvement and retouching also should be looked protection scope of the present invention.