Summary of the invention
The objective of the invention is to have proposed a kind of load-balancing method of express network in order to solve the not high problem of existing load-balancing method equilibrium degree.
To achieve these goals, technical scheme of the present invention is: a kind of load-balancing method of express network specifically comprises the steps:
S1. IP data packet header information extraction comprises and extracts source IP address, purpose IP address, source port number, destination slogan;
S2. Hash operation is carried out Hash operation to the IP header message of extracting, and asks mould to get remainder to 4 the result of Hash operation, and the indication information that comes the distributing IP packet according to the value of asking mould to draw is in corresponding storage queue;
S3. formation distribution and storage administration comprises the write operation management and the read operation management of formation;
S4. polymorphic parallel sorting and scheduling, this process is according to the sky of each formation feedback, full state information and port flow indication information, by controlling the time interval between the polling operation twice, adopt preferential and preferential each formation of tactful poll of full queue of minimum discharge, poll is read the indication information of corresponding IP grouping from each formation, from data buffer, read corresponding packet according to indication information, be forwarded on the corresponding target port.Specifically comprise the steps:
When S41. having transmitted a data grouping at every turn, preserve port flow information and inquire each formation;
S42. at first judge whether to exist full queue, if exist, judge whether to exist a plurality of full queues again, if have only a full queue, just calculate its corresponding poll stand-by period, start the stand-by period timer, arrive poll during the stand-by period, the packet of transmitting this full queue is to the corresponding target port; If there are a plurality of full queues, the value of transmission data flow according to these several full queue statistics, choose the formation of full queue middle port flow value minimum, calculate its poll stand-by period, start the stand-by period timer, arrive poll and transmit the packet of this formation during the stand-by period to the corresponding target port, in addition, if there is the data flow value of plural formation to equate in a plurality of full queues, and their flow value minimum, the packet of full queue of then transmitting the port numbers minimum is to the corresponding target port; If there is no full queue is chosen the non-empty queue in all formations;
S43. compare the data flow value that each non-empty queue has sent, judge the flow value minimum of whether having only a formation in the non-empty queue, if, just calculate the poll stand-by period of this formation, start the stand-by period timer, arrive poll during the stand-by period, just directly transmit the packet of this formation correspondence to the corresponding target port; Otherwise, choose the formation of port numbers minimum, calculate its poll stand-by period, start the stand-by period timer, reach poll during the stand-by period, the packet of transmitting this formation correspondence is to the corresponding target port.
Among the step S2, described Hash operation is the IPSX hash algorithm.
Beneficial effect of the present invention: utilization of the present invention combines static equilibrium with the dynamic self-adapting equilibrium dynamic self-adapting Hash balance policy, the express network load-balancing method that static Hash equalization algorithm of a kind of front end utilization and rear end utilize polymorphic parallel sorting and dispatching algorithm has been proposed, this method has been utilized the present flow rate loading condition, make high-speed data-flow equilibrium to be assigned on a plurality of slow network interfaces, improve the mutual equilibrium degree of each subchannel.
Embodiment
Below in conjunction with accompanying drawing, provide specific embodiments of the invention.Need to prove: the parameter among the embodiment does not influence generality of the present invention.
With two-channel 2-4 .5G(OC-48 interface, VC-4-16C concatenation technology) high speed data network, two-channel 2-4 .5G data flow is balanced to 8 gigabit Ethernet (GBE, GigaBit Ethernet) is example on the interface, supposes that the system that realizes this method is called equalizer.
Specific design thought of the present invention is: adopt the dynamic self-adapting Hash (HBDC that static equilibrium is combined with the dynamic self-adapting equilibrium, Hash Balancing and Dynamic Compensation) balance policy, promptly be that the equalizer front end adopts the Hash equalization algorithm that high-speed data-flow is mapped in each formation, each queue stores be Internet protocol (IP, Internet Protocol) indication information of data, the IP data division is buffered in the data buffer, realizes long-term statistic flow equilibrium; Polymorphic parallel sorting and dispatching algorithm are adopted in the equalizer rear end, according to minimum preferential and each formation of full queue principle of priority poll of flow, from formation, read the indication information of IP data, from data buffer, take out corresponding IP data again, according to the port indication information IP traffic is assigned on the corresponding GBE port, realizes the instantaneous flow equalization of express network.
Specifically as shown in Figure 1: the header message that at first extracts the IP packet, its header message is carried out Hash operation, simultaneously with in IP storage to the data buffer, according to the Hash operation result length of two-channel 2-4 .5G High Speed IP data and the indication informations such as storage first address in buffer thereof are assigned in 8 formations, guaranteed the correlation of the sequencing and the stream of message, realized long-term static equilibrium two-channel 2-4 .5G data flow; Polymorphic parallel sorting and dispatching algorithm are adopted in the rear end, according to the polling dispatching of the minimum principle of priority realization of flow to 8 formations, poll is read the indication information of the IP data in each formation, according to corresponding IP data in the indication information sense data buffer, and send on the corresponding GBE port, on the GBE port,, realize the transient behavior equilibrium of flow to the reorganization of classifying of IP data and indication information thereof.Corresponding GBE port of each formation wherein.The pointer information that returns according to polymorphic parallel sorting and scheduling and the full state information control of sky of 8 formations are to the write operation of 8 formations.
Below in conjunction with Fig. 2, Fig. 3 express network load balancing process is described further, specifically comprises the steps:
S1. IP data packet header information extraction at each 2.5G high-speed data channel, is extracted source IP address, purpose IP address, source port number, destination slogan;
S2. Hash operation.The header message that extracts the IP packet is carried out Hash operation, ask mould to get remainder to 4 the result of Hash operation, the indication information that comes the distributing IP packet according to the value of asking mould to draw is in corresponding storage queue.
When above-mentioned Hash operation is the IPSX hash algorithm, the best performance that is reached.Because the IPSX hash algorithm is the existing known technology of this area, therefore here no longer be described in detail.
S3. formation distribution and storage administration.This process comprises two aspects: the write operation management of formation and read operation management.As shown in Figure 2, the implementation process of write operation is: produce writing of respective queue according to the state information of each formation feedback and Hash operation result and enable, as: when the Hash operation result is that 0 and 0 formation is not also write and just produced writing of formation 0 when full and enable, write the indication information of corresponding IP data to formation 0; In like manner, produce writing of other 7 formations and enable, write the indication information of corresponding IP data to each formation.The implementation process of read operation is mainly finished according to the polymorphic parallel sorting and the scheduling of back.
S4. polymorphic parallel sorting and scheduling.This process is according to the full state information of sky of each formation feedback, by controlling the time interval between the polling operation twice, adopt preferential each formation of tactful poll of minimum discharge, poll is read the indication information of corresponding IP grouping from each formation, from data buffer, read corresponding packet according to indication information, be forwarded on the corresponding GBE port.As shown in Figure 3, specifically comprise the steps:
When S41. having transmitted a data grouping, the storage port flow information is also inquired 8 formations at every turn;
S42. at first judge whether to exist full queue, if exist, judge whether to exist a plurality of full queues again, if have only a full queue, just calculate its corresponding poll stand-by period, start the stand-by period timer, arrive poll during the stand-by period, carry out corresponding read operation, the packet of transmitting this full queue is to corresponding GBE port; If there are a plurality of full queues, the value of transmission data flow according to these several full queue statistics, choose the formation of full queue middle port flow value minimum, calculate its poll stand-by period, start the stand-by period timer, arrive poll during the stand-by period, carry out corresponding read operation, the packet of transmitting this formation is to corresponding GBE port; In addition, if there is the data flow value of plural formation to equate in a plurality of full queue, and their flow value minimum, carry out corresponding read operation, the packet of the full queue of forwarding port numbers minimum is to corresponding GBE port; As there not being full queue, in non-empty queue, select the formation of port flow minimum, carry out corresponding read operation, the packet of transmitting this formation is to corresponding GBE port;
S43. compare the data flow value that each non-empty queue has sent, judge the flow value minimum of whether having only a formation in the non-empty queue, if, just calculate the poll stand-by period of this formation, start the stand-by period timer, arrive poll during the stand-by period, just directly transmit the packet of this formation correspondence to corresponding GBE port; Otherwise, choose the formation of port numbers minimum, calculate its poll stand-by period, start the stand-by period timer, reach poll during the stand-by period, the packet of transmitting this formation correspondence is to corresponding GBE port.
Need to prove: 8 shared traffic statistics time timers of formation in the present embodiment, as shown in Figure 3, when the packet that begins to send in a certain formation, just judge whether its traffic statistics time has surpassed the predefined unit interval of system, if the traffic statistics time has surpassed the unit interval, then note the data flow value in the flow summer of each formation, empty each flow summer then, the zero clearing of the time timer of traffic statistics simultaneously restarts timing; If the traffic statistics time does not surpass the unit interval, then accumulate the flow value of respective queue.Flow value in 8 unit timing statisticses of statistics is asked average flow value as each outbound port in the unit timing statistics continuously
Port[i] _ flow, then each port speed value is:
Wherein i=0,1,2,3,4,5,6,7 is represented port 0, port one, port 2, port 3, port 4, port 5, port 6, port 7 respectively.
TIMEBe the timing statistics counter that is provided with.
Then computing formula is as follows the poll stand-by period:
Wherein,
tBe polymorphic parallel sorting and scheduling startup stand-by period,
DeltaBe outbound port speed,
uBe smoothing factor,
Len_sBe the data packet length that has sent,
Len_nBe next data packet length that sends.
After adopting method of the present invention, a load equalizer can be assigned to the equilibrium of two-channel 2-4 .5G data flow on 8 GBE ports, and making long-time statistical equilibrium degree between each GBE port and temporal equilibrium degree all be better than 12%(12% is the equilibrium degree index), make load flow more balanced.
Those of ordinary skill in the art will appreciate that embodiment described here is in order to help reader understanding's principle of the present invention, should to be understood that the protection range of inventing is not limited to such special statement and embodiment.Everyly make various possible being equal to according to foregoing description and replace or change, all be considered to belong to the protection range of claim of the present invention.