Summary of the invention
The problem to be solved in the present invention is how the retransmission unit in the equipment to be carried out global traffic control.
For achieving the above object, the invention provides a kind of flow control methods, be applied to comprise in the equipment of at least one retransmission unit, be provided with the local token set for this retransmission unit of control flow rate on each retransmission unit, also be provided with the set of master control token on the retransmission unit in the described equipment, described method comprises:
The retransmission unit that is provided with the set of master control token receives token application message;
When the token quantity in the described master control token set is non-vanishing, the described retransmission unit of master control token set that is provided with is according to the token quantity in described token application message and the set of described master control token, be corresponding retransmission unit distribution token, and reduce the token of respective numbers in the described master control token set;
The described retransmission unit that is provided with the set of master control token sends to described corresponding retransmission unit by the token grant message with the token that distributes, to increase the token quantity in the local token set that arranges in this retransmission unit.
Preferably, when described token quantity in the set of master control token is non-vanishing, the described retransmission unit that is provided with the set of master control token, specifically comprises for corresponding retransmission unit distributes token according to the token quantity in described token application message and the set of described master control token:
The described retransmission unit that is provided with master control token set is judged the token quantity whether the token quantity in the described master control token set apply for more than or equal to described token application message;
If judged result is for being, described to be provided with the retransmission unit that the master control token gathers be the token number that described corresponding retransmission unit distributes described token application message to ask;
If judged result is not, the described retransmission unit that is provided with the set of master control token is distributed to described corresponding retransmission unit with all tokens in the described master control token set.
Preferably, also comprise:
When the token quantity in the described master control token set was zero, the described retransmission unit that is provided with the set of master control token was that the token quantity that described corresponding retransmission unit distributes is zero.
Preferably, the token quantity that promising described at least one retransmission unit of record distributed on the described retransmission unit that is provided with master control token set, and be described at least one retransmission unit setting priority from low to high from more to less according to the token quantity of described distribution;
When described token quantity in the set of master control token was non-vanishing, the described retransmission unit that is provided with the set of master control token, specifically comprised for corresponding retransmission unit distributes token according to the token quantity in described token application message and the set of described master control token:
The described retransmission unit that is provided with the set of master control token judges whether described corresponding retransmission unit is the minimum retransmission unit of priority;
If judged result is for being, the described retransmission unit that is provided with the set of master control token starts timer, when the described timer time arrives, is described corresponding retransmission unit distribution token;
If judged result is not, the described retransmission unit that is provided with the set of master control token is that described corresponding retransmission unit distributes token.
Preferably, the described retransmission unit that is provided with the set of master control token receives token application message, specifically comprises:
The described retransmission unit that is provided with master control token set receives the token application message that this retransmission unit generates according to self token requisition cycle; And/or
The described retransmission unit that is provided with master control token set receives the token application message that other retransmission units send according to self token requisition cycle.
Preferably, the described retransmission unit that is provided with master control token set receives this retransmission unit according to the token application message that self token generates requisition cycle, specifically comprises:
The described retransmission unit that is provided with master control token set receives when the local token set of this retransmission unit self is discontented, and this retransmission unit is according to the token application message of self token generation requisition cycle;
The described retransmission unit that is provided with master control token set receives other retransmission units according to the token application message that self token sends requisition cycle, specifically comprises:
The described retransmission unit that is provided with master control token set receives when the local token set of described other retransmission units is discontented, and described other retransmission units are according to the token application message of self token transmission requisition cycle.
Preferably,
When the token quantity of the local token set disappearance that sends described token application message forwarding unit was less than or equal to the token application thresholding of self, the token quantity of described token application message application was the token quantity of described disappearance;
When the token quantity of the local token set disappearance that sends described token application message forwarding unit during greater than described self token application thresholding, the token quantity of described token application message application is described self token application thresholding.
Preferably, the described retransmission unit that is provided with the set of master control token is provided with token increases cycle and token increase thresholding, and described method also comprises:
When the described token increase cycle arrived, the described retransmission unit that is provided with the set of master control token judged whether the token quantity of disappearance in the described master control token set increases thresholding greater than described token;
If judged result is for being, the token quantity that the described retransmission unit that is provided with the set of master control token increases in described master control token set is described token increase thresholding;
Otherwise the token quantity that the described retransmission unit that is provided with the set of master control token increases in described master control token set is the token quantity of described disappearance.
The present invention also provides a kind of retransmission unit, be applied to comprise in the equipment of at least one retransmission unit, be provided with the local token set for this retransmission unit of control flow rate on each retransmission unit, also be provided with the set of master control token on the retransmission unit in the described equipment, described retransmission unit comprises:
Sending module is used for sending token application message to the retransmission unit that is provided with the set of master control token;
Receiver module is used for after described sending module sends token application message, receives the token grant message that the described retransmission unit that is provided with the set of master control token returns according to described token application message, to increase the token in the local token set that self arranges;
Wherein, described receiver module, described retransmission unit are provided with under the situation of master control token set, also are used for receiving the token application message that described sending module sends;
Judge module, described retransmission unit are provided with under the situation of master control token set and enable, and are used for after described receiver module receives token application message, judge whether the token quantity in the described master control token set is zero;
The token distribution module, described retransmission unit is provided with under the situation of master control token set and enables, be used for when described judge module judges that token quantity in described master control token is gathered is non-vanishing, gather interior token quantity according to token application message and described master control token that described receiver module receives, be corresponding retransmission unit distribution token, and reduce the token of respective numbers in the described master control token set;
Described sending module, described retransmission unit is provided with under the situation of master control token set, also being used in described token distribution module is after described corresponding retransmission unit distributes token, by the token grant message token that distributes is sent to described corresponding retransmission unit, to increase the token quantity in the local token set that arranges in this retransmission unit.
Preferably,
Described judge module, the concrete token quantity that is used for judging that whether the interior token quantity of described master control token set apply for more than or equal to described token application message;
Described token distribution module, concrete being used for when described judge module is judged the token quantity that the token quantity in described master control token is gathered applies for more than or equal to described token application message, the token number that distributes described token application message to ask for described corresponding retransmission unit; During token quantity that the token quantity in described judge module is judged the set of described master control token is applied for less than described token application message, all interior tokens of described master control token set are distributed to described corresponding retransmission unit.
Preferably, described token distribution module, concrete being used for when the token quantity in the described master control token set is zero, the token quantity of distributing for described corresponding retransmission unit is zero.
Preferably, also comprise:
Logging modle, described retransmission unit is provided with under the situation of master control token set and enables, be used for being recorded as the token quantity that described at least one retransmission unit distributed, and be described at least two retransmission unit settings priority from low to high from more to less according to the token quantity of described distribution;
Described judge module, the concrete priority that is used for according to described logging modle record judges whether described corresponding retransmission unit is the minimum retransmission unit of priority;
Timing module, described retransmission unit are provided with under the situation of master control token set and enable, and are used for if the judged result of described judge module is for being the startup timer;
Described token distribution module is used for when the described timer time of described timing module arrives, for described corresponding retransmission unit distributes token; And if the judged result of described judge module for not, is described corresponding retransmission unit distribution token.
Preferably, the described retransmission unit that is provided with the set of master control token is provided with token increases cycle and token increase thresholding, and described retransmission unit also comprises:
Described judge module, judges whether the token quantity of disappearance in the described master control token set increases thresholding greater than described token at concrete being used for when the described token increase cycle arrives;
Token increases module, and described retransmission unit is provided with under the situation of master control token set and enables, and is used for if the judged result of described judge module is when being, the token quantity that increases in described master control token set is described token increase thresholding; Otherwise the token quantity that increases in described master control token set is the token quantity of described disappearance.
Among the present invention, the veneer that is provided with the set of master control token receives token application message, when the token quantity in the set of master control token is non-vanishing, be provided with the veneer of master control token set according to the token quantity in token application message and the set of described master control token, for corresponding veneer distributes token, and reduce the token of respective numbers in the set of master control token, the veneer that is provided with the set of master control token sends to corresponding veneer by the token grant message with the token that distributes, to increase the token quantity in the local token set that arranges in this veneer.By adopting the present invention, can realize a plurality of veneers or chip are carried out the global traffic supervision, avoided the actual flow that passes through of veneer or chip above the flow that allows to pass through.
Embodiment
Below in conjunction with the accompanying drawing among the present invention, the technical scheme among the present invention is clearly and completely described, obviously, described embodiment only is a part of embodiment of the present invention, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that obtains under the creative work prerequisite.
The embodiment of the invention provides a kind of flow control methods, this method can be applied in distributed apparatus or the centralized device, for distributed apparatus, retransmission unit is the veneer in the distributed apparatus, as shown in Figure 1, the structural representation of a kind of distributed apparatus that provides for the embodiment of the invention, be provided with one or more local token set on each veneer in the distributed apparatus, be provided with the set of master control token on one of them veneer simultaneously, for centralized device, retransmission unit is the chip that arranges on the veneer of centralized device, veneer in the centralized device is provided with one or more chips, each chip is provided with one or more local token set, be provided with the set of master control token on one of them chip simultaneously, in an embodiment of the present invention, all local tokens are gathered the token that obtains and are gathered distribution by the master control token.
Below, in conjunction with concrete execution mode, method proposed by the invention is described further, and in the present embodiment, equipment is distributed apparatus, consider the processing of the common not responsible service message of master control borad, therefore the set of master control token is arranged on the master control borad, certainly, the set of master control token can be arranged on any veneer, or be arranged on the third party device, present embodiment is that example describes so that the set of master control token is arranged on the master control borad only.
As shown in Figure 2, the schematic flow sheet of a kind of flow control methods that provides for the embodiment of the invention may further comprise the steps:
Step 201, business board sends token application message to master control borad.
Concrete, be provided with token requisition cycle in the business board, business board is when token arrives requisition cycle, send token application message to master control borad, the information such as token number of carry the veneer numbering in the token application message, adding token cycle, application, for different veneers, token requisition cycle can be identical or different.Need to prove that master control borad self also can have local token set, master control borad generates token application message according to the token requisition cycle of self, and is local token set application token from the set of master control token.
Wherein, be provided with token application thresholding in the business board, token application thresholding=maximum allows through-rate * (token requisition cycle+propagation delay time), when the token quantity of the local token set disappearance of the veneer that sends token application message is less than or equal to the token application thresholding of self, the token quantity of token application message application is the token quantity of disappearance, when the token quantity of the local token set disappearance of the veneer that sends token application message during greater than self token application thresholding, the token quantity of token application message application is the token application thresholding of self.
Preferably, for master control borad and business board, when the token of himself arrives requisition cycle, whether the local token set that can judge self is full, when local token set has been expired, master control borad and business board do not generate or do not send token application message at this token requisition cycle, and when local token set was discontented, master control borad and business board generated or send token application message.
Preferably, business board can also be after sending token application message, at local record response identification not, if when next token arrives requisition cycle, this not response identification still exist, then business board does not send token application message requisition cycle at this token.
Preferably, this not response identification can be set to only exist a token requisition cycle, for example, when this token arrived requisition cycle, there was not response identification in this locality, then business board does not send token application message to master control borad, and response identification deletion.
Step 202, master control borad receive token application message.
Step 203, master control borad judge whether the token quantity in the set of master control token is zero, if the result is for being execution in step 204, otherwise execution in step 205.
Concrete, master control borad is provided with token increases cycle and token increase thresholding, when the token increase cycle arrives, master control borad judges whether the token quantity of disappearance in the set of master control token increases thresholding greater than token, if judged result is when being, the token quantity that master control borad increases in the set of master control token is that token increases thresholding, otherwise the token quantity that master control borad increases in the set of master control token is the token quantity of disappearance.When the frequency of each business board application token and quantity surpassed token in the set of master control token and accelerates, the token quantity possibility in the set of master control token was depleted.
Step 204, master control borad sends the token grant message according to the numbering of the veneer in the token application message to the corresponding service plate, and the token quantity that this token entitlement message is distributed is zero, and execution in step 207.
Step 205, master control borad are corresponding service plate distribution token according to the token quantity in the numbering of the veneer in the token application message and the set of master control token, and reduce the token of respective numbers in the set of master control token.
Concrete, master control borad can be judged the token quantity whether the token quantity in the set of master control token apply for more than or equal to token application message; If judged result is for being, master control borad is numbered the token number that corresponding veneer distribution token application message is asked according to veneer; If judged result is not, all tokens that master control borad is numbered in the just master control token set according to veneer are distributed to corresponding veneer.
Preferably, can record the token quantity that promising all veneers distributed on the master control borad, and be all veneer settings priority from low to high from more to less according to the token quantity of distributing.When master control borad is received the token application message of business board transmission, search priority according to the veneer numbering, and judge whether this business board is the minimum veneer of priority, if judged result is for being, the master control board starting timer, when the timer time arrived, for this business board distributes token, otherwise directly this business board distributed token.
Step 206, master control borad sends to business board by the token grant message with the token that distributes, to increase the token quantity in the local token set that arranges in this veneer.
Step 207, business board receives the token grant message that master control borad sends, and according to the token quantity of carrying in the token grant message, increases the token quantity in the local token set.
Preferably, if business board after sending token application message at local record response identification not, after receiving the token grant message, business board is deleted this not response identification.
Need to prove, for centralized device, the realization flow of realization flow and above-mentioned distributed apparatus is similar, difference only is because centralized device has only a veneer, therefore the set of master control token and a plurality of local token set are safeguarded by each chip on the veneer, for centralized device, because there is not communication between plates in it, need not consider propagation delay time, therefore use this method and can obtain compared to the better speed limit effect of distributed apparatus.
For local token set, can be provided with a plurality of local token set on each veneer, if veneer need be a plurality of local token set request tokens, its can a setting time unification will send to the veneer that is provided with the set of master control token by a combination message for the token of each local token set application, to avoid veneer to send token application message for each local token set separately, the plate communication that causes is frequent, and then the performance that produces descends.
The present invention is by arranging the set of master control token and the set of local token at veneer, and unified token quantity in the local token set of all veneers in the control appliance by the veneer that is provided with master control token set, can realize a plurality of veneers or chip are carried out the global traffic supervision, avoid the actual flow that passes through of veneer or chip above the flow that allows to pass through.
Below in conjunction with specific embodiment, describe the present invention, in embodiments of the present invention, gathering with the master control token is the master control token bucket, local token set is that example is described for local token bucket, for the master control token bucket, its CBS(Committed Burst Size, can promise to undertake the maximum information frame sign) can arrange according to the actual flow control strategy, its token increase cycle can be the CIR(Committed Information Rate that the user allows, but the commitment information transmission rate), for local token bucket, consider problems such as propagation delay time, the size of its CBS can be the local token bucket CIR*(of local token bucket CBS=token requisition cycle+propagation delay time), to guarantee that veneer can be before getting access to the request token, normally send message with the CIR that allows, herein, the CIR of local token bucket and master control token bucket can be different.
As shown in Figure 3, in the present embodiment, be provided with master control token bucket and local token bucket on the veneer 1 simultaneously, veneer 2 and veneer 3 are provided with local token bucket, residue token quantity is 90 in the master control token bucket, be that 5s, local token bucket CBS are 500 the token requisition cycle of veneer 2, and real surplus token quantity is 300, and local token bucket CIR is 20.
As shown in Figure 4, a kind of flow control methods for the embodiment of the invention provides may further comprise the steps:
Step 401, when token arrival requisition cycle of self, veneer 2 judges whether this locality records not response sign, if judged result is for being execution in step 402, otherwise execution in step 403.
Step 402, veneer 2 are waited for when next token arrives requisition cycle, are returned execution in step 401.
Step 403, veneer 2 less than disappearance token number 200, therefore send token application message to veneer 1 according to token requisition cycle and local token bucket CIR determining that token application thresholding is 100, ask 100 tokens, and at local record response identification not.
Step 404, veneer 1 judge whether the priority of veneer 2 is minimum after receiving the token application message of veneer 2 transmissions, if judged result is for being execution in step 405, otherwise execution in step 406.
Concrete, the token quantity that the promising veneer 1 of record, veneer 2 and veneer 3 distributed on the veneer 1.
Wherein, if the token quantity that veneer 1 distributed is 200, the token quantity of distributing for veneer 2 is 400, the token quantity of distributing for veneer 3 is 300, veneer 1 is according to this record, and the priority of veneer 1, veneer 2 and veneer 3 is set to 1,3,2, at this moment execution in step 405.
If the token quantity that veneer 1 distributed is 400, the token quantity of distributing for veneer 2 is 100, and the token quantity of distributing for veneer 3 is 300, and veneer 1 is according to this record, the priority of veneer 1, veneer 2 and veneer 3 is set to 3,1,2, at this moment execution in step 406.
Step 405, veneer 1 starts timer, wouldn't be that veneer 2 distributes tokens, and timer then after, execution in step 406.
Wherein, if veneer 1 timer not then before, receive the token application message that veneer 3 sends, the token quantity of asking is 220, veneer 1 determines that veneer 3 is not the minimum veneer of priority, therefore send the token grant message to veneer 3, for veneer 3 distributes 220 tokens, and the token number in the master control token bucket is adjusted into 80.
Step 406, veneer 1 according to token quantity last in the master control token bucket, returns the token grant message according to the token application message that veneer 2 sends.
Concrete, if veneer 1 is be before veneer 2 distributes tokens, for veneer 3 has distributed 220 tokens, last token number quantity not sufficient is 100 in this moment local token bucket, therefore is 80 tokens of veneer 2 distribution, and the token number in the master control token bucket is adjusted into 0.
If veneer 1 is when being veneer 2 distribution tokens, the token quantity in the local token bucket is more than or equal to 100, and veneer 1 is that veneer 2 distributes 100 tokens, and by token grant message notifying veneer 2.
Step 407, after veneer 2 received the token grant message, the token quantity according to carrying in the token grant message increased the token in the local token bucket, and deleted not response identification.
In the present embodiment, the priority of each veneer is according to dynamically arranging for the token quantity of its distribution, for example, in the present embodiment, before this sub-distribution token, if the token quantity that veneer 1 distributed is 200, the token quantity of distributing for veneer 2 is 400, the token quantity of distributing for veneer 3 is 300, has distributed 80 tokens at this for veneer 2, for after veneer 3 distributed 220 tokens, at this moment, the token that veneer 1 distributed for veneer 2 adds up to 480, the token that distributed for veneer 3 adds up to 520, and therefore, veneer 1 is with veneer 1, the priority of veneer 2 and veneer 3 is adjusted into 1,2,3.
Based on the same or analogous thought of said method, the present invention also provides a kind of retransmission unit, be applied to comprise in the equipment of at least one retransmission unit, be provided with the local token set for this retransmission unit of control flow rate on each retransmission unit, also be provided with the set of master control token on the retransmission unit in the described equipment, as shown in Figure 5, the structural representation of the retransmission unit that provides for the embodiment of the invention, described retransmission unit comprises:
Sending module 501 is used for sending token application message to the retransmission unit that is provided with the set of master control token;
Receiver module 502, be used for after described sending module 501 sends token application message, receive the token grant message that the described retransmission unit that is provided with the set of master control token returns according to described token application message, to increase the token in the local token set that self arranges;
Wherein, described receiver module 502, described retransmission unit are provided with under the situation of master control token set, also are used for receiving the token application message that described sending module sends;
Judge module 503, described retransmission unit are provided with under the situation of master control token set and enable, and are used for after described receiver module 502 receives token application message, judge whether the token quantity in the described master control token set is zero;
Token distribution module 504, described retransmission unit is provided with under the situation of master control token set and enables, be used for when the token quantity in the described master control token set of described judge module 503 judgements is non-vanishing, gather interior token quantity according to token application message and described master control token that described receiver module 502 receives, be corresponding retransmission unit distribution token, and reduce the token of respective numbers in the described master control token set;
Described sending module 501, described retransmission unit is provided with under the situation of master control token set, also being used in described token distribution module 504 is after described corresponding retransmission unit distributes token, by the token grant message token that distributes is sent to described corresponding retransmission unit, to increase the token quantity in the local token set that arranges in this retransmission unit.
Preferably,
Described judge module, the concrete token quantity that is used for judging that whether the interior token quantity of described master control token set apply for more than or equal to described token application message;
Described token distribution module, concrete being used for when described judge module is judged the token quantity that the token quantity in described master control token is gathered applies for more than or equal to described token application message, the token number that distributes described token application message to ask for described corresponding retransmission unit; During token quantity that the token quantity in described judge module is judged the set of described master control token is applied for less than described token application message, all interior tokens of described master control token set are distributed to described corresponding retransmission unit.
Preferably, described token distribution module, concrete being used for when the token quantity in the described master control token set is zero, the token quantity of distributing for described corresponding retransmission unit is zero.
Preferably, also comprise:
Logging modle, described retransmission unit is provided with under the situation of master control token set and enables, be used for being recorded as the token quantity that described at least one retransmission unit distributed, and be described at least two retransmission unit settings priority from low to high from more to less according to the token quantity of described distribution;
Described judge module, the concrete priority that is used for according to described logging modle record judges whether described corresponding retransmission unit is the minimum retransmission unit of priority;
Timing module, described retransmission unit are provided with under the situation of master control token set and enable, and are used for if the judged result of described judge module is for being the startup timer;
Described token distribution module is used for when the described timer time of described timing module arrives, for described corresponding retransmission unit distributes token; And if the judged result of described judge module for not, is described corresponding retransmission unit distribution token.
Preferably, the described retransmission unit that is provided with the set of master control token is provided with token increases cycle and token increase thresholding, and described retransmission unit also comprises:
Described judge module, judges whether the token quantity of disappearance in the described master control token set increases thresholding greater than described token at concrete being used for when the described token increase cycle arrives;
Token increases module, and described retransmission unit is provided with under the situation of master control token set and enables, and is used for if the judged result of described judge module is when being, the token quantity that increases in described master control token set is described token increase thresholding; Otherwise the token quantity that increases in described master control token set is the token quantity of described disappearance.
Through the above description of the embodiments, 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 embody with the form of software product, this computer software product is stored in the storage medium, comprise that some instructions are with so that a computer equipment (can be personal computer, server, the perhaps network equipment etc.) carry out the described method of each embodiment of the present invention.
It will be appreciated by those skilled in the art that accompanying drawing is the schematic diagram of a preferred embodiment, the module in the accompanying drawing or flow process might not be that enforcement the present invention is necessary.
It will be appreciated by those skilled in the art that the module in the device among the embodiment can be distributed in the device of embodiment according to the embodiment description, also can carry out respective change and be arranged in the one or more devices that are different from present embodiment.The module of above-described embodiment can be merged into a module, also can further split into a plurality of submodules.
The invention described above embodiment sequence number does not represent the quality of embodiment just to description.
More than disclosed only be several specific embodiment of the present invention, still, the present invention is not limited thereto, any those skilled in the art can think variation all should fall into protection scope of the present invention.