Summary of the invention
The problem to be solved in the present invention is how the retransmission unit in equipment to be carried out global traffic control.
For reaching above-mentioned purpose, the invention provides a kind of flow control methods, be applied to include at least one
In the equipment of individual retransmission unit, each retransmission unit is provided with for controlling this retransmission unit flow speed
The local token set of rate, a retransmission unit in described equipment is additionally provided with master control token set,
Described method includes:
The retransmission unit being provided with master control token set receives token application message;
When the token quantity in described master control token set is not zero, described in be provided with master control token set
Retransmission unit according to the token quantity in described token application message and described master control token set, for phase
Answer retransmission unit to distribute token, and reduce the token of respective numbers in described master control token set;
The token of distribution is sent out by the described retransmission unit being provided with master control token set by token grant message
Give described corresponding retransmission unit, to increase the token in the local token set arranged in this retransmission unit
Quantity.
Preferably, described when the token quantity in master control token set is not zero, described in be provided with master control
The retransmission unit of token set is according to the token number in described token application message and described master control token set
Amount, distributes token for corresponding retransmission unit, specifically includes:
The described retransmission unit being provided with master control token set judges the token number in described master control token set
Whether amount is more than or equal to described token application message apllied token quantity;
If the determination result is YES, the retransmission unit being provided with master control token set described in is described corresponding forwarding
Unit distributes the token number that described token application message is asked;
If judged result is no, described in be provided with the retransmission unit of master control token set by described master control token
All tokens in set distribute to described corresponding retransmission unit.
Preferably, also include:
When the token quantity in described master control token set is zero, described in be provided with master control token set
Retransmission unit be described corresponding retransmission unit distribution token quantity be zero.
Preferably, be provided with described on the retransmission unit of master control token set record promising described at least one
The token quantity that retransmission unit distributed, and according to the described token quantity distributed from more to less for described
At least one retransmission unit arranges priority from low to high;
Described when the token quantity in master control token set is not zero, described in be provided with master control token set
Retransmission unit according to the token quantity in described token application message and described master control token set, for phase
Answer retransmission unit to distribute token, specifically include:
The described retransmission unit being provided with master control token set judges whether described corresponding retransmission unit is preferential
The retransmission unit that level is minimum;
If the determination result is YES, described in be provided with master control token set retransmission unit start timer, when
When described timer periods arrives, distribute token for described corresponding retransmission unit;
If judged result is no, described in be provided with the retransmission unit of master control token set be described corresponding forwarding
Unit distribution token.
Preferably, the retransmission unit being provided with master control token set described in receives token application message, specifically
Including:
The described retransmission unit being provided with master control token set receives this retransmission unit according to own token application
The token application message that cycle generates;And/or
The described retransmission unit being provided with master control token set receives other retransmission units according to own token Shen
The token application message that please send in the cycle.
Preferably, the retransmission unit being provided with master control token set described in receives this retransmission unit according to self
The token application message of token generation requisition cycle, specifically includes:
The described retransmission unit being provided with master control token set receives the local token when this retransmission unit self
When set is discontented, this retransmission unit is according to the token application message of own token generation requisition cycle;
The described retransmission unit being provided with master control token set receives other retransmission units according to own token Shen
The token application message that please send in the cycle, specifically includes:
The described retransmission unit being provided with master control token set receives the local order when other retransmission units described
When board set is discontented with, other retransmission units described are according to the token application report of own token transmission requisition cycle
Literary composition.
Preferably,
When the token quantity of the local token set disappearance of the retransmission unit sending described token application message is little
In or during equal to self token application thresholding, the token quantity of described token application message application is described
The token quantity of disappearance;
When the token quantity of the local token set disappearance of the retransmission unit sending described token application message is big
When self token application thresholding described, the token quantity of described token application message application be described from
The token application thresholding of body.
Preferably, be provided with described on the retransmission unit of master control token set be provided with token increase the cycle and
Token increases thresholding, and described method also includes:
When described token increase the cycle arrive time, described in be provided with master control token set retransmission unit judge
In described master control token set, whether the token quantity of disappearance increases thresholding more than described token;
If the determination result is YES, the retransmission unit of master control token set it is provided with described at described master control token
The token quantity increased in set is that described token increases thresholding;
Otherwise, the retransmission unit being provided with master control token set described in increases in described master control token set
The token quantity that token quantity is described disappearance.
Present invention also offers a kind of retransmission unit, be applied to include in the equipment of at least one retransmission unit,
The local token set for controlling this retransmission unit flow rate, institute it is provided with on each retransmission unit
Stating and be additionally provided with master control token set in equipment retransmission unit, described retransmission unit includes:
Sending module, for sending token application message to the retransmission unit being provided with master control token set;
Receiver module, after sending token application message at described sending module, is provided with described in reception
The token grant message that the retransmission unit of master control token set returns according to described token application message, to increase
Add the token in the local token set self arranged;
Wherein, described receiver module, in the case of described retransmission unit is provided with master control token set,
It is additionally operable to receive the token application message that described sending module sends;
Judge module, enables in the case of being provided with master control token set, be used on described retransmission unit
After described receiver module receives token application message, it is judged that the token number in described master control token set
Whether amount is zero;
Token distribution module, enables in the case of being provided with master control token set on described retransmission unit,
When token quantity in judging described master control token set when described judge module is not zero, according to institute
State the token quantity in the token application message and described master control token set that receiver module receives, for phase
Answer retransmission unit to distribute token, and reduce the token of respective numbers in described master control token set;
Described sending module, in the case of being provided with master control token set, also uses on described retransmission unit
After being described corresponding retransmission unit distribution token in described token distribution module, by token grant message
The token of distribution is sent to described corresponding retransmission unit, to increase the local order arranged in this retransmission unit
Token quantity in board set.
Preferably,
Described judge module, specifically for judging whether the token quantity in described master control token set is more than
Or equal to described token application message apllied token quantity;
Described token distribution module, in judging described master control token set when described judge module
Token quantity more than or equal to described token application message apllied token quantity time, for described accordingly
Retransmission unit distributes the token number that described token application message is asked;When described judge module judges described
When token quantity in master control token set is less than described token application message apllied token quantity, will
All tokens in described master control token set distribute to described corresponding retransmission unit.
Preferably, described token distribution module, specifically for when the token number in described master control token set
When amount is zero, the token quantity for the distribution of described corresponding retransmission unit is zero.
Preferably, also include:
Logging modle, enables in the case of being provided with master control token set, be used on described retransmission unit
It is recorded as the token quantity that at least one retransmission unit described distributed, and according to the described token distributed
Quantity is the priority that described at least two retransmission unit arranges from low to high from more to less;
Described judge module, specifically for the priority according to described logging modle record, it is judged that described phase
Answer whether retransmission unit is the retransmission unit that priority is minimum;
Timing module, enables in the case of being provided with master control token set, be used on described retransmission unit
If the judged result of described judge module is yes, start timer;
Described token distribution module, is used for when the described timer periods in described timing module arrives,
Token is distributed for described corresponding retransmission unit;And if the judged result of described judge module is no, for institute
State corresponding retransmission unit distribution token.
Preferably, be provided with described on the retransmission unit of master control token set be provided with token increase the cycle and
Token increases thresholding, and described retransmission unit also includes:
Described judge module, specifically for when described token increases cycle arrival, it is judged that described master control makes
In board set, whether the token quantity of disappearance increases thresholding more than described token;
Token increases module, enables in the case of being provided with master control token set on described retransmission unit,
If for the judged result of described judge module for being time, the token increased in described master control token set
Quantity is that described token increases thresholding;Otherwise, the token quantity increased in described master control token set is
The token quantity of described disappearance.
In the present invention, the veneer being provided with master control token set receives token application message, when master control token
When token quantity in set is not zero, it is provided with the veneer of master control token set according to token application message
With the token quantity in described master control token set, distribute token for corresponding veneer, and reduce master control token
The token of respective numbers in set, the veneer being provided with master control token set will be divided by token grant message
The token joined is sent to corresponding veneer, to increase the token number in the local token set arranged in this veneer
Amount.By using the present invention, it is possible to achieve multiple veneers or chip are carried out global traffic supervision, it is to avoid
Veneer or the chip actual flow passed through exceed the flow allowing to pass through.
Detailed description of the invention
Below in conjunction with the accompanying drawing in the present invention, the technical scheme in the present invention is carried out clearly and completely
Describe, it is clear that described embodiment is only a part of embodiment of the present invention rather than whole
Embodiment.Based on the embodiment in the present invention, those of ordinary skill in the art are not making creative labor
The every other embodiment obtained under dynamic premise, broadly falls into the scope of protection of the invention.
Embodiments providing a kind of flow control methods, the method can apply to distributed apparatus
Or in centralized device, for distributed apparatus, retransmission unit is the veneer in distributed apparatus, such as Fig. 1
Shown in, the structural representation of a kind of distributed apparatus provided for the embodiment of the present invention, in distributed apparatus
Each veneer on be both provided with one or more local token set, one of them veneer sets simultaneously
Being equipped with master control token set, for centralized device, retransmission unit is to arrange on the veneer of centralized device
Chip, the veneer in centralized device is provided with one or more chip, each chip is provided with
One or more local token set, one of them chip is provided with master control token set simultaneously,
In embodiments of the invention, the token that all local token set are obtained is distributed by master control token set.
Below, in conjunction with specific embodiment, method proposed by the invention is described further,
In the present embodiment, equipment is distributed apparatus, it is contemplated that the place of the usual not responsible service message of master control borad
Reason, is therefore arranged on master control token set on master control borad, and certainly, master control token set can be arranged at
On any veneer, or being arranged on third party device, the present embodiment is only to be arranged on master control token set
Illustrate as a example by master control borad.
As in figure 2 it is shown, the schematic flow sheet of a kind of flow control methods provided for the embodiment of the present invention, bag
Include following steps:
Step 201, business board sends token application message to master control borad.
Concrete, be provided with token requisition cycle in business board, business board when token arrives requisition cycle,
Send token application message to master control borad, token application message carries veneer numbering, adds token week
Phase, the information such as token number of application, for different veneers, token requisition cycle can be identical or different.
It should be noted that master control borad self can also have local token set, master control borad is according to the order of self
Board requisition cycle, generate token application message, and be this locality token set application from master control token set
Token.
Wherein, token application thresholding, token application thresholding=maximum allowable through-rate it are provided with in business board
* (token requisition cycle+propagation delay time), lack when the local token set of the veneer sending token application message
When the token quantity lost is less than or equal to the token application thresholding of self, the token of token application message application
Quantity be disappearance token quantity, when send token application message veneer local token set disappearance
When token quantity is more than the token application thresholding of self, the token quantity of token application message application is self
Token application thresholding.
Preferably, for master control borad and business board, when the token of himself arrives requisition cycle, permissible
Judge that the local token set of self is the fullest, when local token set is expired, master control borad and business
Plate does not generates or does not send token application message at this token requisition cycle, when local token set is discontented with
Time, master control borad and business board generate or send token application message.
Preferably, business board can also locally record non-response identification after sending token application message,
If when next token arrives requisition cycle, this non-response identification still exists, then business board is in this order
Board does not send token application message requisition cycle.
Preferably, this non-response identification can be configured so that and only exists a token requisition cycle, such as,
When this token arrives requisition cycle, there is non-response identification in this locality, then business board does not sends to master control borad
Token application message, and non-response identification is deleted.
Step 202, master control borad receives token application message.
Step 203, master control borad judges whether the token quantity in master control token set is zero, if result is yes,
Perform step 204, otherwise perform step 205.
Concrete, master control borad is provided with token increases cycle and token increase thresholding, whenever token increases
When cycle arrives, master control borad judges in master control token set, whether the token quantity of disappearance increases more than token
Thresholding, time if the determination result is YES, the token quantity that master control borad increases in master control token set is token
Increasing thresholding, otherwise, the token quantity that master control borad increases in master control token set is the token number of disappearance
Amount.The token exceeded in master control token set when frequency and the quantity of each business board application token is accelerated
Time, the token quantity in master control token set may be depleted.
Step 204, master control borad is numbered according to the veneer in token application message, sends order to corresponding service plate
Board entitlement message, the token quantity that this token grant message is distributed is zero, and performs step 207.
Step 205, master control borad is numbered and the order in master control token set according to the veneer in token application message
Board quantity, distributes token for corresponding service plate, and reduces the token of respective numbers in master control token set.
Concrete, master control borad may determine that whether the token quantity in master control token set is more than or equal to order
Board application message apllied token quantity;If the determination result is YES, master control borad is according to the numbered phase of veneer
Answer the token number that veneer distribution token application message is asked;If judged result is no, master control borad is according to list
All tokens that plate is numbered in just master control token set distribute to corresponding veneer.
Preferably, master control borad can record the token quantity that promising all veneers distributed, and according to dividing
The token quantity joined arranges priority from low to high for all veneers from more to less.When master control borad receives
During the token application message that business board sends, search priority according to veneer numbering, and judge this business board
Whether it is the veneer that priority is minimum, if the determination result is YES, master control board starting timer, work as timer
When time arrives, distributing token for this business board, otherwise directly this business board distributes token.
Step 206, the token of distribution is sent to business board by token grant message by master control borad, to increase
Token quantity in the local token set arranged in this veneer.
Step 207, business board receives the token grant message that master control borad sends, according in token grant message
The token quantity carried, increases the token quantity in local token set.
Preferably, if business board is locally recording non-response identification after sending token application message,
After receiving token grant message, business board deletes this non-response identification.
It should be noted that for centralized device, it is achieved flow process and the realization stream of above-mentioned distributed apparatus
Journey is similar to, and differs only in due to centralized device only one of which veneer, and therefore the set of master control token is with many
Individual local token set is safeguarded by each chip on veneer, for centralized device, there is not plate due to it
Between communicate, need not consider propagation delay time, therefore application this method can obtain compared to distributed apparatus more
Good speed limit effect.
For local token set, each veneer can be provided with multiple local token set, if veneer
Need for multiple local token aggregate requests tokens, its can a time unification that set will be for each
The token of ground token set application is sent to be provided with the list of master control token set by a combination message
Plate, sends token application message to avoid veneer to be individually for each local token set, and the plate caused leads to
Letter is frequent, and then the hydraulic performance decline produced.
The present invention passes through to arrange master control token set and local token set on veneer, and by being provided with master
The token quantity that the veneer of control token set is uniformly controlled in equipment in the local token set of all veneers,
Can realize multiple veneers or chip are carried out global traffic supervision, it is to avoid veneer or chip is actual passes through
Flow exceed and allow the flow that passes through.
Below in conjunction with specific embodiment, describe the present invention, in embodiments of the present invention, with
Master control token collection is combined into master control token bucket, local token collection is described as a example by being combined into local token bucket, right
In master control token bucket, its CBS(Committed Burst Size, maximum information frame sign can be promised to undertake) can
To be configured according to actual flow control strategy, its token increases the CIR that the cycle can be user's permission
(Committed Information Rate, can commitment information transfer rate), for local token bucket, examines
Considering to problems such as propagation delay times, the size of its CBS can be local token bucket CBS=this locality token bucket
CIR*(token requisition cycle+propagation delay time), with ensure veneer can before getting request token, with
The CIR allowed normally sends message, and herein, the CIR of local token bucket and master control token bucket can be different.
As it is shown on figure 3, in the present embodiment, veneer 1 is provided with master control token bucket and local order simultaneously
Being provided with local token bucket on board bucket, veneer 2 and veneer 3, in master control token bucket, residue token quantity is
90, the token of veneer 2 be requisition cycle 5s, local token bucket CBS be 500, real surplus token number
Amount is 300, and local token bucket CIR is 20.
As shown in Figure 4, a kind of flow control methods provided for the embodiment of the present invention, comprise the following steps:
Step 401, when the token of self arrives requisition cycle, and veneer 2 judges whether this locality has recorded and do not rings
Should indicate, if the determination result is YES, perform step 402, otherwise perform step 403.
Step 402, veneer 2 waits when next token arrives requisition cycle, returns and perform step 401.
Step 403, according to token requisition cycle and local token bucket CIR, veneer 2 determines that token application thresholding is
100, less than disappearance token number 200, therefore send token application message to veneer 1, ask 100 tokens,
And locally recording non-response identification.
Step 404, after veneer 1 receives the token application message that veneer 2 sends, it is judged that veneer 2 preferential
Whether level is minimum, if the determination result is YES, performs step 405, otherwise performs step 406.
Concrete, veneer 1 records the token quantity that promising veneer 1, veneer 2 and veneer 3 distributed.
Wherein, if the token quantity that veneer 1 distributed is 200, the token quantity distributed for veneer 2 is
400, the token quantity distributed for veneer 3 is 300, and veneer 1 is according to this record, by veneer 1, veneer 2
It is set to 1,3,2 with the priority of veneer 3, now performs step 405.
If the token quantity that veneer 1 distributed is 400, the token quantity distributed for veneer 2 is 100,
The token quantity distributed for veneer 3 is 300, and veneer 1 is according to this record, by veneer 1, veneer 2 and veneer
The priority of 3 is set to 3,1,2, now performs step 406.
Step 405, veneer 1 starts timer, wouldn't distribute token for veneer 2, and timer then after,
Perform step 406.
Wherein, if veneer 1 is before timer is not timed out, receive the token application message that veneer 3 sends, institute
The token quantity of request is 220, and veneer 1 determines that veneer 3 is not the veneer that priority is minimum, therefore to veneer
3 send token grant message, distribute 220 tokens for veneer 3, and are adjusted by the token number in master control token bucket
Whole is 80.
Step 406, the token application message that veneer 1 sends according to veneer 2, according to remaining in master control token bucket
Token quantity, return token grant message.
Concrete, if veneer 1 is before distributing token for veneer 2, it is assigned with 220 tokens for veneer 3, this
Time this locality token bucket in remaining token lazy weight 100, therefore distribute 80 tokens for veneer 2, and
Token number in master control token bucket is adjusted to 0.
If veneer 1 is when distributing token for veneer 2, the token quantity in local token bucket is more than or equal to 100
Individual, veneer 1 distributes 100 tokens for veneer 2, and by token grant message notifying veneer 2.
Step 407, after veneer 2 receives token grant message, according to the order carried in token grant message
Board quantity, increases the token in local token bucket, and deletes non-response identification.
In the present embodiment, arrange for its token Number dynamics distributed according to the priority of each veneer,
Such as, in the present embodiment, before this sub-distribution token, if the token quantity that veneer 1 distributed is 200,
The token quantity distributed for veneer 2 is 400, and the token quantity distributed for veneer 3 is 300, at this
After being assigned with 80 tokens for veneer 2, be assigned with 220 tokens for veneer 3, now, veneer 1 is veneer 2
The token sum distributed is 480, and the token sum distributed for veneer 3 is 520, and therefore, veneer 1 will
The priority of veneer 1, veneer 2 and veneer 3 is adjusted to 1,2,3.
Based on same as mentioned above or similar thought, present invention also offers a kind of retransmission unit, should
In the equipment including at least one retransmission unit, each retransmission unit is provided with for controlling this
The local token set of retransmission unit flow rate, a retransmission unit in described equipment is additionally provided with
Master control token set, as it is shown in figure 5, the structural representation of the retransmission unit provided for the embodiment of the present invention,
Described retransmission unit includes:
Sending module 501, for sending token application report to the retransmission unit being provided with master control token set
Literary composition;
Receiver module 502, for after described sending module 501 sends token application message, receives described
It is provided with the token grant report that the retransmission unit of master control token set returns according to described token application message
Literary composition, to increase the token in the local token set self arranged;
Wherein, described receiver module 502, described retransmission unit is provided with the situation of master control token set
Under, it is additionally operable to receive the token application message that described sending module sends;
Judge module 503, enables in the case of being provided with master control token set on described retransmission unit, uses
After receiving token application message at described receiver module 502, it is judged that the order in described master control token set
Whether board quantity is zero;
Token distribution module 504, opens in the case of being provided with master control token set on described retransmission unit
With, it is used for when the token quantity in described judge module 503 judges described master control token set is not zero,
Token in the token application message received according to described receiver module 502 and described master control token set
Quantity, distributes token for corresponding retransmission unit, and reduces the order of respective numbers in described master control token set
Board;
Described sending module 501, in the case of described retransmission unit is provided with master control token set, also
After being described corresponding retransmission unit distribution token in described token distribution module 504, pass through token grant
The token of distribution is sent to described corresponding retransmission unit by message, to increase the basis arranged in this retransmission unit
Token quantity in ground token set.
Preferably,
Described judge module, specifically for judging whether the token quantity in described master control token set is more than
Or equal to described token application message apllied token quantity;
Described token distribution module, in judging described master control token set when described judge module
Token quantity more than or equal to described token application message apllied token quantity time, for described accordingly
Retransmission unit distributes the token number that described token application message is asked;When described judge module judges described
When token quantity in master control token set is less than described token application message apllied token quantity, will
All tokens in described master control token set distribute to described corresponding retransmission unit.
Preferably, described token distribution module, specifically for when the token number in described master control token set
When amount is zero, the token quantity for the distribution of described corresponding retransmission unit is zero.
Preferably, also include:
Logging modle, enables in the case of being provided with master control token set, be used on described retransmission unit
It is recorded as the token quantity that at least one retransmission unit described distributed, and according to the described token distributed
Quantity is the priority that described at least two retransmission unit arranges from low to high from more to less;
Described judge module, specifically for the priority according to described logging modle record, it is judged that described phase
Answer whether retransmission unit is the retransmission unit that priority is minimum;
Timing module, enables in the case of being provided with master control token set, be used on described retransmission unit
If the judged result of described judge module is yes, start timer;
Described token distribution module, is used for when the described timer periods in described timing module arrives,
Token is distributed for described corresponding retransmission unit;And if the judged result of described judge module is no, for institute
State corresponding retransmission unit distribution token.
Preferably, be provided with described on the retransmission unit of master control token set be provided with token increase the cycle and
Token increases thresholding, and described retransmission unit also includes:
Described judge module, specifically for when described token increases cycle arrival, it is judged that described master control makes
In board set, whether the token quantity of disappearance increases thresholding more than described token;
Token increases module, enables in the case of being provided with master control token set on described retransmission unit,
If for the judged result of described judge module for being time, the token increased in described master control token set
Quantity is that described token increases thresholding;Otherwise, the token quantity increased 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 is it can be understood that arrive this
Bright can add the mode of required general hardware platform by software and realize, naturally it is also possible to by hardware,
But the former is more preferably embodiment in the case of a lot.Based on such understanding, technical scheme
The part contributed prior art the most in other words can embody with the form of software product,
This computer software product is stored in a storage medium, including some instructions with so that a calculating
Machine equipment (can be personal computer, server, or the network equipment etc.) performs the present invention, and each is real
Execute the method described in example.
It will be appreciated by those skilled in the art that accompanying drawing is the schematic diagram of a preferred embodiment, in accompanying drawing
Module or flow process are not necessarily implemented necessary to the present invention.
It will be appreciated by those skilled in the art that the module in the device in embodiment can describe according to embodiment
Carry out being distributed in the device of embodiment, it is also possible to carry out respective change and be disposed other than the one of the present embodiment
In individual or multiple device.The module of above-described embodiment can merge into a module, it is also possible to tears open further
It is divided into multiple submodule.
The invention described above embodiment sequence number, just to describing, does not represent the quality of embodiment.
The several specific embodiments being only the present invention disclosed above, but, the present invention is not limited to this,
The changes that any person skilled in the art can think of all should fall into protection scope of the present invention.