Summary of the invention
The objective of the invention is preferentially to guarantee the transmission of significant data under the condition of or data volume overload big in data volume.
Main thought of the present invention is to set up two transmit queues on communication link: high-priority queue and Low Priority Queuing.When sending message, low priority message is put into the formation of low priority, waits the message of high priority to put into high-priority queue, when data send, send the data in the high-priority queue earlier, after high-priority queue sends sky, just send the data in the Low Priority Queuing.
According to the present invention, a kind of method of graded data transmission is provided, may further comprise the steps: step S102, set up a plurality of transmit queues on communication link; Step S104 judges the priority of data to be sent, and determines data to be sent are put into one of a plurality of transmit queues according to judged result; And step S106, when sending data, send the data in a plurality of transmit queues successively.
A plurality of transmit queues have different transmission priority respectively.
Step S104 may further comprise the steps: the priority of judging data to be sent according to the priority tag in the data to be sent; And, data to be sent are put into one of a plurality of transmit queues according to the priority of data to be sent.
Step S106 may further comprise the steps: when sending data, send data in each transmit queue in a plurality of transmit queues successively according to sending priority order from high to low, the data in a plurality of transmit queues all send and finish.
To send the step of the data in each transmit queue in a plurality of transmit queues successively further comprising the steps of according to sending priority order from high to low: after the data transmission in last a priority transmit queue finishes, just send the data in next priority transmit queue.
Under the full situation of any one transmit queue in a plurality of transmit queues, abandon the data of waiting to put into transmit queue subsequently.
After data in a plurality of transmit queues all sent and finish, communication link entered idle condition.
Priority tag is included in the message header of data.
The data that data in a last priority transmit queue just send in next priority transmit queue after sending and finishing may further comprise the steps: step 1, whether the transmit queue of judging a plurality of priority according to priority order from high to low successively is empty, be not empty transmit queue if having, then to not being empty transmit queue execution in step two, if the transmit queue of all priority is sky, then directly withdraw from; Step 2 judges that send window is whether full, if, the timing of transmission timer then is set, with when arriving the timing of timer, resend and be not the data in the empty formation, otherwise execution in step three; Step 3 sends not putting into send window for data in the empty formation, send data after, repeating step two to send next data, is not the total data in the empty formation up to sending; And step 4, repeating step one is to step 3, the data in sending all transmit queues.
When communication link is in idle condition, directly send business datum.
The present invention can guarantee the transmission of important system message when the surge message traffic, reduce the influence to system index.
Other features and advantages of the present invention will be set forth in the following description, and, partly from specification, become apparent, perhaps understand by implementing the present invention.Purpose of the present invention and other advantages can realize and obtain by specifically noted structure in the specification of being write, claims and accompanying drawing.
Embodiment
Describe embodiments of the invention in detail below in conjunction with accompanying drawing.
Fig. 1 shows the flow chart according to the method for graded data transmission of the present invention.With reference to Fig. 1, may further comprise the steps according to the method for graded data transmission of the present invention: step S102, set up a plurality of transmit queues on communication link; Step S104 judges the priority of data to be sent, and determines data to be sent are put into one of a plurality of transmit queues according to judged result; And step S106, when sending data, send the data in a plurality of transmit queues successively.
A plurality of transmit queues have different transmission priority respectively.
Step S104 may further comprise the steps: the priority of judging data to be sent according to the priority tag in the data to be sent; And, data to be sent are put into one of a plurality of transmit queues according to the priority of data to be sent.
Step S106 may further comprise the steps: when sending data, send data in each transmit queue in a plurality of transmit queues successively according to sending priority order from high to low, the data in a plurality of transmit queues all send and finish.
To send the step of the data in each transmit queue in a plurality of transmit queues successively further comprising the steps of according to sending priority order from high to low: after the data transmission in last a priority transmit queue finishes, just send the data in next priority transmit queue.
Under the full situation of any one transmit queue in a plurality of transmit queues, abandon the data of waiting to put into transmit queue subsequently.
After data in a plurality of transmit queues all sent and finish, communication link entered idle condition.
In this embodiment, priority tag is included in the message header of data.
Wherein, the data that data in a last priority transmit queue just send in next priority transmit queue after sending and finishing may further comprise the steps: step 1, whether the transmit queue of judging a plurality of priority according to priority order from high to low successively is empty, be not empty transmit queue if having, then to not being empty transmit queue execution in step two, if the transmit queue of all priority is sky, then directly withdraw from; Step 2 judges that send window is whether full, if, the timing of transmission timer then is set, with when arriving the timing of timer, resend and be not the data in the empty formation, otherwise execution in step three; Step 3 sends not putting into send window for data in the empty formation, send data after, repeating step two to send next data, is not the total data in the empty formation up to sending; And step 4, repeating step one is to step 3, the data in sending all transmit queues.
When communication link is in idle condition, directly send business datum.
Fig. 2 shows the flow chart of the method for graded data transmission according to an embodiment of the invention.This embodiment may further comprise the steps:
Step S202 judges the height that sends data priority, puts into height respectively, Low Priority Queuing;
Step S204 sends the data in the high-priority queue, and data all send and finish in this formation;
Step S206, message is under the situation of sky in high-priority queue, sends the data in the Low Priority Queuing;
Step S208, if data all send and finish in two formations, link enters idle condition; And
Step S210 if the data of piling up in the formation surpass the length of formation, then abandons the data that last requirement sends.
Fig. 3 shows the transmission schematic diagram of high lower-priority data bag under the communication link according to the embodiment of the invention.Business datum is divided into high prioritized data and low prioritized data, when data send, the difference of data based priority, enter high-priority queue and Low Priority Queuing respectively, data in the high-priority queue, preferentially enter send window, under agreement control, finish the transmission of data on link then.
Data format is message header+message body, comprises priority tag in the message header, the priority of expression data, and system is according to sign, the transmission priority of specified data.
Fig. 4 shows the process chart that divides high low priority to send according to the business datum of the embodiment of the invention.In this embodiment, for a upper layer application, send the flow process of a business datum, as shown in Figure 4, at first need to judge the priority of outgoing data, if high-priority data then enters high-priority queue and sends, if lower-priority data then enters Low Priority Queuing and sends.If link is in idle condition, then directly business datum is entered send window and send.This embodiment specifically may further comprise the steps:
Step S402~S404, business datum sends a request message, and judges whether this message is the message of low priority, if, execution in step S406, otherwise execution in step S414;
Step S406 judges whether this Low Priority Queuing is full, if, withdraw from, otherwise execution in step S408;
Step S408 judges whether this Low Priority Queuing is empty, if, execution in step S410, otherwise execution in step S412;
Step S410 judges whether high-priority queue is empty, if, execution in step S422, otherwise execution in step S412;
Step S412 adds Low Priority Queuing with these data;
Step S414 judges whether this high-priority queue is full, if, withdraw from, otherwise execution in step S416;
Step S416 judges whether this high-priority queue is empty, if, execution in step S418, otherwise execution in step S420;
Step S418 judges whether Low Priority Queuing is empty, if, execution in step S422, otherwise execution in step S420;
Step S420 adds high-priority queue with these data; And
Step S422, if all there are not data etc. to be sent in the high Low Priority Queuing, then business datum directly enters send window, carries out data and sends.
Fig. 5 shows the data transmission flow figure of business datum on data link according to the embodiment of the invention, and this illustrates the treating method when high top grade elder generation's data and lower-priority data clash.The preferential earlier data that send in the high-priority queue of link are empty until high-priority queue, just can send the data in the Low Priority Queuing, specifically may further comprise the steps:
Step S502, when the data router receives data notification message, the log-on data transmission flow;
Step S504 judges whether high-priority queue is empty, if, execution in step S510, otherwise execution in step S506;
Step S506 judges that send window is whether full, if, then temporarily can't send data at present, carry out S512 retransmission timer be set, wait timing to arrive after, attempt the data transmission flow again; Otherwise carry out S508, data are put into send window send;
Step S508 finishes data and sends, and continues then to judge whether queuing data is empty, sends next data, all is sent completely up to data;
Step S510 judges that whether Low Priority Queuing is empty, if, illustrating that then all not have data etc. in the high Low Priority Queuing to be sent, flow process directly withdraws from, otherwise carries out S506; And
Step S512, current send window is full, can't send data, and transmission timer is set, wait be timed to after, reattempt the data transmission flow.
The data transmission flow that the present invention is directed on the communication link has carried out the control of branch priority, under the burst heavy traffic condition, system's real-time response when the bursty data amount has surpassed the valid data bandwidth has very big benefit, and it has guaranteed the transmission of critical data, has improved the impact resistance of system.
The link that the present invention is not only applicable to two priority sends, and is applicable to that also the link of multipriority sends.
The present invention can guarantee the transmission of important system message when the surge message traffic, lower the influence to system index.
The above is the preferred embodiments of the present invention only, is not limited to the present invention, and for a person skilled in the art, the present invention can have various changes and variation.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.