CN103026671A - Traffic shaping method and device - Google Patents

Traffic shaping method and device Download PDF

Info

Publication number
CN103026671A
CN103026671A CN2011800014901A CN201180001490A CN103026671A CN 103026671 A CN103026671 A CN 103026671A CN 2011800014901 A CN2011800014901 A CN 2011800014901A CN 201180001490 A CN201180001490 A CN 201180001490A CN 103026671 A CN103026671 A CN 103026671A
Authority
CN
China
Prior art keywords
transmit queue
time
token
bucket
flow
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN2011800014901A
Other languages
Chinese (zh)
Other versions
CN103026671B (en
Inventor
艾刚·豪帕纳斯
倪思慕·丹尼尔
伊学文
吴瑶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Changshu intellectual property operation center Co.,Ltd.
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Publication of CN103026671A publication Critical patent/CN103026671A/en
Application granted granted Critical
Publication of CN103026671B publication Critical patent/CN103026671B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/22Traffic shaping
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/21Flow control; Congestion control using leaky-bucket

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

Provided are a traffic shaping method and device, relating to the field of communications. The method includes: a first data packet dequeuing from a sending queue; refreshing the token bucket or leaky bucket corresponding to the sending queue according to a first time, a second time and the bandwidth preset for the sending queue, wherein the first time is the time when the first data packet dequeues from the sending queue, the second time is the time when a second data packet dequeues from the sending queue, and the second data packet is a data packet which has dequeued most recently before the first data packet dequeues from the sending queue. The device includes: a dequeuing module and a refreshing module. The present invention can reduce the refreshing frequency of the token bucket or leaky bucket corresponding to each sending queue and ensure the token bucket or leaky bucket corresponding to each sending queue can be refreshed.

Description

A kind of method and apparatus of traffic shaping
A kind of method and apparatus technical field of traffic shaping
The present invention relates to the communications field, more particularly to a kind of method and apparatus of traffic shaping.Background technology
Piece can be said by communication process core in the communications field to send packet, communication process chip generally includes scheduler, memory, queue management module and traffic shaping module.
Wherein, traffic shaping module can realize traffic shaping function, and traffic shaping function can make communication process chip send packet according to the bandwidth pre-set.
Book
There are one or more relatively independent memory spaces in memory, each memory space is properly termed as a transmit queue, transmit queue is used to cache the packet for needing to send, each transmit queue one token bucket of correspondence or leaky bucket, token bucket is used to store token, and leaky bucket is used for the flow for storing the packet sent;When a packet is transmitted, scheduler dispatches transmit queue from memory, queue management module is from the transmit queue data dequeued bag and sends out the packet of team, simultaneously traffic shaping module the token of certain flow is subtracted from the corresponding token bucket of the transmit queue or flow is added into the corresponding leaky bucket of the transmit queue, and traffic shaping module subtract token flow, addition flow it is equal from the flow of the transmit queue data dequeued bag with queue management module respectively.
In addition, traffic shaping module needs to refresh the token stored in the corresponding token bucket of the transmit queue or the flow stored in the corresponding leaky bucket of the transmit queue according to the bandwidth set for the transmit queue in advance.For example, traffic shaping module periodically refreshes the corresponding token bucket of each transmit queue in memory, when flushing to the corresponding token bucket of some transmit queue, according to being that the bandwidth and the length gauge of refresh cycle of transmit queue setting calculate the token amount for needing to add into the corresponding token bucket of the transmit queue in advance, token is added to the corresponding token bucket of the transmit queue according to the token amount calculated;Or, traffic shaping module periodically refreshes the corresponding leaky bucket of each transmit queue in memory, when flushing to the corresponding leaky bucket of some transmit queue, according to being that the bandwidth and the length gauge of refresh cycle of transmit queue setting calculate the flow for needing to be subtracted from the corresponding leaky bucket of the transmit queue in advance, the flow calculated is subtracted from the corresponding leaky bucket of the transmit queue.
But, in currently existing scheme, because the access bandwidth of memory is limited, if the transmit queue number in memory allows the number of times accessed more than memory within a refresh cycle, traffic shaping module can not just flush to the corresponding token bucket of each transmit queue or leaky bucket when doing traffic shaping function within a refresh cycle. The content of the invention
In order to reduce the refreshing frequency to the corresponding token bucket of each transmit queue or leaky bucket and ensure that the corresponding token bucket of each transmit queue or leaky bucket can be refreshed, the embodiments of the invention provide a kind of method and apparatus of traffic shaping.The technical scheme is as follows:
A kind of method of traffic shaping, methods described includes:
First packet goes out team from transmit queue;
According to the very first time, the second time and the bandwidth set in advance for the transmit queue, refresh the corresponding token bucket of the transmit queue or leaky bucket, wherein, the very first time is the time that first packet goes out team from the transmit queue, second time is the time that the second packet goes out team from the transmit queue, second packet is that first packet goes out before team from the transmit queue, and the last time goes out the packet of team.
A kind of equipment of traffic shaping, the equipment includes:
Go out group module, for the first packet to be gone out into team from transmit queue;
Refresh module, for refreshing the corresponding token bucket of the transmit queue or leaky bucket according to the very first time, the second time and in advance for the bandwidth that the transmit queue is set, wherein, the very first time is the time that first packet goes out team from the transmit queue, second time is the time that the second packet goes out team from the transmit queue, second packet is that first packet goes out before team from the transmit queue, and the last time goes out the packet of team.
In the present invention, first packet goes out team from transmit queue, and the corresponding token bucket of the transmit queue or leaky bucket are refreshed according to the very first time, the second time and the bandwidth set in advance for the transmit queue, the very first time is the time for going out team from the first packet transmit queue, second time was the time that the second packet goes out team from the transmit queue, second packet is that the first packet goes out before team from the transmit queue, and the last time goes out the packet of team.Due to packet go out team and send will be according to token bucket or leaky bucket, therefore, the refreshing of token bucket or leaky bucket is carried out according to equipment provided in an embodiment of the present invention, the number of times and frequency for refreshing the corresponding token bucket of each transmit queue or leaky bucket can be just reduced, realize traffic shaping.Brief description of the drawings
Fig. 1 ~ 10 are the several flow charts of the method for the traffic shaping that the embodiment of the present invention 1 is provided;
Figure 11 is a kind of method flow diagram for traffic shaping that the embodiment of the present invention 2 is provided;
Figure 12 is a kind of method flow diagram for traffic shaping that the embodiment of the present invention 3 is provided;
Figure 13 ~ 20 are the several schematic diagrames of the equipment for the traffic shaping that the embodiment of the present invention 4 is provided.Embodiment To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing, embodiment of the present invention is described further in detail.Embodiment 1
As shown in figure 1, the embodiments of the invention provide a kind of method of traffic shaping, including:
101:First packet goes out team from transmit queue;
102:According to the very first time, the second time and the bandwidth set in advance for the transmit queue, refresh the corresponding token bucket of the transmit queue or leaky bucket;Wherein, the very first time is the time that first packet goes out team from the transmit queue, second time was the time that the second packet goes out team from the transmit queue, and the second packet is that the first packet goes out before team from the transmit queue, and the last time goes out the packet of team.
Optionally, as shown in Fig. 2 102 can specifically include:
1021:Calculate the time difference of the very first time and the second time;
1022:The bandwidth set according to the time difference calculated and in advance for the transmit queue, calculating needs the token amount to the corresponding token bucket addition of the transmit queue;
1023:According to the token amount calculated, token is added to the corresponding token bucket of the transmit queue, to refresh the corresponding token bucket of the transmit queue.
Optionally, as shown in figure 3, after 102, this method also includes:
103:Using the numerical value of the very first time, updated for the second time.
Optionally, as shown in figure 4, after 102, this method also includes:
104:According to the first token amount, the second token amount and the 3rd token amount calculate the token amount after the corresponding token bucket of the transmit queue is refreshed.
Wherein, the first token amount refers to that the first packet goes out before team from the transmit queue, the token amount in the corresponding token bucket of the transmit queue;Second token amount refer to the first packet from the transmit queue go out group when, the token amount subtracted from the corresponding token bucket of the transmit queue, generally, the second token amount are equal with the first data packet flow;3rd token amount refers to that the first packet goes out after team from the transmit queue, when refreshing the corresponding token bucket of the transmit queue, to the token amount of the corresponding token bucket addition of the transmit queue.
Optionally, as shown in figure 5, after 104, this method also includes:
105:If the token amount after the corresponding token bucket of the transmit queue is refreshed is less than default first threshold, the dispatch state of the transmit queue is then set to the state of non-scheduling, and the dispatch state of the transmit queue is set to the state of schedulable after a preset amount of time. For example, if subtracting excessive token from token bucket when the first packet goes out group, the token amount of token bucket is still very little after refreshing, it is assumed that less than default first threshold, then needs to add more token amounts when refreshing the corresponding token bucket of the transmit queue next time.Therefore, by the way that the dispatch state of the transmit queue is set into non-scheduling state, and the dispatch state of the transmit queue is set to schedulable state after a preset amount of time, the time difference of the above-mentioned very first time and the second time can be increased, so that also can be more to the token amount of the corresponding token bucket addition of the transmit queue the need for calculating.
Optionally, as shown in fig. 6, after 104, this method also includes:
106:The numerical value of token amount after being refreshed using the corresponding token bucket of the transmit queue calculated, updates the first token optionally, as shown in fig. 7,102 can include:
1024:Calculate the time difference of the very first time and the second time;
1025:The bandwidth set according to the time difference of calculating and in advance for the transmit queue, calculates the flow for needing to be subtracted from the corresponding leaky bucket of the transmit queue;
1026:The flow calculated is subtracted from the corresponding leaky bucket of the transmit queue, to refresh the corresponding leaky bucket of the transmit queue.Optionally, as shown in figure 8, after 102, this method also includes:
107:According to first flow, second flow and the 3rd flow calculate the flow after the corresponding leaky bucket of the transmit queue is refreshed.
Wherein, first flow is that the first packet goes out before team from the transmit queue, the flow in the corresponding leaky bucket of the transmit queue;Second flow be the first packet from the transmit queue go out group when, the flow added into the corresponding leaky bucket of the transmit queue;3rd flow is the flow for needing to subtract from the corresponding leaky bucket of the transmit queue.
Optionally, as shown in figure 9, after 107, this method also includes:
108:If the flow after the corresponding leaky bucket of the transmit queue is refreshed is more than default Second Threshold, the dispatch state of the transmit queue is then set to the state of non-scheduling, and the dispatch state of the transmit queue is set to the state of schedulable after a preset amount of time.
For example, if the excessive flow of addition when the first packet goes out group into leaky bucket, the flow of leaky bucket or excessive after refreshing, it is assumed that more than default Second Threshold, then need to subtract more flows when refreshing the corresponding leaky bucket of the transmit queue next time.Therefore, by the way that the dispatch state of the transmit queue is set into non-scheduling state, and the dispatch state of the transmit queue is set to schedulable state after a preset amount of time, the time difference of the above-mentioned very first time and the second time can be increased, so that the flow subtracted the need for calculating from the corresponding leaky bucket of the transmit queue also can be more.
Optionally, as shown in Figure 10, after 107, in addition to:
109:The numerical value of flow after being refreshed using the corresponding leaky bucket of the transmit queue calculated, updates first flow. In embodiments of the present invention, the first packet goes out team from transmit queue, subtracts token from the corresponding token bucket of the transmit queue according to the flow of the first packet or adds flow to the corresponding leaky bucket of the transmit queue;And the corresponding token bucket of the transmit queue or leaky bucket are refreshed according to the very first time, the second time and the bandwidth set in advance for the transmit queue, the very first time is the time for going out team from the first packet transmit queue, second time was the time that the second packet goes out team from the transmit queue, second packet is that the first packet goes out before team from the transmit queue, and the last time goes out the packet of team.Due to packet go out team and send will be according to token bucket or leaky bucket, therefore, the refreshing of token bucket or leaky bucket is carried out according to method provided in an embodiment of the present invention, the number of times and frequency for refreshing the corresponding token bucket of each transmit queue or leaky bucket can be just reduced, realize traffic shaping.Embodiment 2
As shown in figure 11, the embodiments of the invention provide a kind of method of traffic shaping, including:
201:First packet goes out team from the transmit queue in communication process chip;
For example, when needing to send packet, the transmit queue in scheduler schedules memory in communication process chip, first data go out team from from the transmit queue, and be transmitted, while the traffic shaping module of communication process chip subtracts token according to the flow for the first packet for going out team from the transmit queue from the corresponding token bucket of the transmit queue, wherein, the token amount that traffic shaping module is subtracted is equal with the first data packet flow.
Optionally, a timer can be set in communication process chip in advance, when the first packet goes out group from the transmit queue, the current time during timer can be read, and regard the current time of reading as the very first time.
Wherein, in the present embodiment, communication process chip is after each reset restarting, and the token amount of the corresponding token bucket of each transmit queue can be equal to 0, more than 0 or less than 0 in the memory of communication process chip.
202:Calculate the time difference of the very first time and the second time, wherein, the very first time is the time that the first packet goes out team from the transmit queue, second time was the time that the second packet goes out team from the transmit queue, second packet is that the first packet goes out before team from the transmit queue, and the last time goes out the packet of team;
Optionally, above-mentioned second time can be cached, when each communication process chip reset restarts, the second time of caching 0 can be set to.
203:The bandwidth set according to the time difference of calculating and in advance for the transmit queue, refreshes the corresponding token bucket of the transmit queue;
Specifically, the bandwidth set according to the time difference of calculating and in advance for the transmit queue, calculate the token amount for needing that token is added into the corresponding token bucket of the transmit queue, token is added into the corresponding token bucket of the transmit queue according to the token amount calculated, so realizes and the corresponding token bucket of the transmit queue is refreshed.
Optionally, the bandwidth that can be set by the time difference of calculating and in advance for the transmit queue, which does product calculation, to be needed The token amount of token is added into the corresponding token bucket of the transmit queue.
204:The token amount after the corresponding token bucket of the transmit queue is refreshed is obtained, if fewer than default first threshold, then 205 are performed:
For example, the first packet is gone out before team from the transmit queue, the token amount in the corresponding token bucket of the transmit queue is labeled as old_tokenbucket;By the first packet from the transmit queue go out group when, the token amount subtracted from the corresponding token bucket of the transmit queue is labeled as plen;First packet is gone out after team from the transmit queue, when refreshing the corresponding token bucket of the transmit queue, the token amount added to the token bucket of the transmit queue is labeled as Atoken.Then according to formula below(1) token amount new-token bucket after the corresponding token bucket of the transmit queue is refreshed are calculated:
new—token bucket=old_tokent bucket+Atoken-plen ( 1 )
If the token amount after refreshingnew_tokenBucket is less than default first threshold, then performs 205.Wherein, default first threshold can be more than 0, less than 0 or equal to 0.
It is possible to further update old_token bucket with new_token bucket numerical value.
Wherein, if token amount new-token bucket are more than or equal to default first threshold after refreshing, when the transmit queue is scheduled again and from the transmit queue data dequeued bag, 201 is returned and restarts to carry out.
205:The dispatch state of the transmit queue is set to the state of non-scheduling, and the dispatch state of the transmit queue is set to the state of schedulable after a preset amount of time.
Specifically, the dispatch state of the transmit queue is set to the state of non-scheduling, and starts timing, when the time of timing reaching the default time, the dispatch state of the transmit queue is set to the state of schedulable.
Wherein, the dispatch state of the transmit queue is set to after the state of non-scheduling, scheduler can not dispatch the transmit queue, so that can not be from the transmit queue data dequeued bag, traffic shaping module also can not subtract token from the corresponding token bucket of the transmit queue.The dispatch state of the transmit queue is set to after schedulable state, if the transmit queue again be scheduled device scheduling and from the transmit queue data dequeued bag when, execution 201 can be returned.
Optionally, k bit can be reserved in the transmit queue to be used to identify dispatch state, and k is the integer more than or equal to 1.
Wherein, for each transmit queue in the memory of communication process chip, all by above-mentioned 201-205 flow, the corresponding token bucket of transmit queue is just refreshed when packet goes out group from transmit queue.
Wherein, the memory of communication process chip by access bandwidth due to being limited, allowing the number of the transmit queue of data dequeued bag to be less than or equal to memory in each second allows the number of times of access each second, and in the present invention, the corresponding token bucket of transmit queue of data dequeued bag is refreshed when from transmit queue data dequeued bag, therefore the number of times per second refreshed is identical with the number of times of data dequeued bag per second so that the number of times of refreshing token bucket per second is per second less than or equal to memory to be allowed to visit The number of times asked, and the number of times of refreshing token bucket not by the access bandwidth of memory limited and memory in the number of transmit queue limit, so as to significantly reduce the refreshing frequency of token bucket, therefore, as long as from each transmit queue data dequeued bag in memory, with regard to each transmit queue in memory can be flushed to.
In embodiments of the present invention, the first packet goes out team from transmit queue, and token is subtracted from the corresponding token bucket of the transmit queue according to the flow of the first packet;Calculate the time difference of the very first time and the second time, the very first time is the time that the first packet goes out team from the transmit queue, second time was the time that the second packet goes out team from the transmit queue, second packet is the packet for the last time that the first packet goes out before team from the transmit queue going out team, the token amount that needs are added is calculated according to the time difference calculated and in advance for the bandwidth meter of transmit queue setting, token is added to the corresponding token bucket of the transmit queue according to the token amount calculated.Going out team and sending and therefore, the refreshing of token bucket will being carried out according to method provided in an embodiment of the present invention according to token bucket, can just reduce the number of times and frequency for refreshing the corresponding token bucket of each transmit queue, realize traffic shaping due to packet.Embodiment 3
As shown in figure 12, the embodiments of the invention provide a kind of method of traffic shaping, including:
301:First packet goes out team from the transmit queue in communication process chip;
Wherein, when needing to send packet, the transmit queue in scheduler schedules memory in communication process chip, first packet goes out team and is transmitted from the transmit queue, the traffic shaping module of communication process chip goes out the flow of the first packet of team according to the transmit queue simultaneously, flow is added into the corresponding leaky bucket of the transmit queue, wherein, the flow of traffic shaping module addition is equal with the flow of the first packet.
Optionally, a timer can be set in communication process chip in advance, when the first packet goes out group from the transmit queue, the current time during timer can be read, and regard the current time of reading as the very first time.
302:Calculate the time difference of the very first time and the second time, wherein, the very first time is the time for going out the packet of team first from the transmit queue, second time was the time that the second packet goes out team from the transmit queue, second packet is that the first packet goes out before team from the transmit queue, and the last time goes out the packet of team from the transmit queue;
Optionally, above-mentioned second time can be cached, when each communication process chip reset restarts, the second time of caching 0 can be set to.
303:The bandwidth set according to the time difference of calculating and in advance for the transmit queue, refreshes the corresponding leaky bucket of the transmit queue;
Specifically, the bandwidth set according to the time difference of calculating and in advance for the transmit queue, calculates the flow for needing to be subtracted from the corresponding leaky bucket of the transmit queue, the flow calculated is subtracted from the corresponding leaky bucket of the transmit queue, so realizes The corresponding leaky bucket of the transmit queue refreshed.
Optionally, the bandwidth that can be set by the time difference of calculating and in advance for the transmit queue does product calculation, obtains the flow for needing to subtract from the corresponding leaky bucket of the transmit queue.
304:The flow stored after the corresponding leaky bucket of the transmit queue is refreshed is obtained, if it exceeds default Second Threshold, then perform 305:
For example, the first packet is gone out before team from the transmit queue, the flow stored in the corresponding leaky bucket of the transmit queue is labeled as old_leaky bucket;By the first packet from the transmit queue go out group when, the flow added into the corresponding leaky bucket of the transmit queue is labeled as add flow;First packet is gone out after team from the transmit queue, when refreshing the corresponding leaky bucket of the transmit queue, the flow subtracted from the leaky bucket of the transmit queue is labeled as decrease flow.Then according to formula below(2) the flow new_leaky bucket stored after the corresponding leaky bucket of the transmit queue is refreshed are calculated:
new—leaky bucket=old_leaky bucket+add flow-decrease flow (2)
If the flow newjeaky bucket after refreshing are more than default Second Threshold, 305 are performed.Wherein, default Second Threshold can be more than 0.
It is possible to further update old_leaky bucket with new_leaky bucket numerical value
Wherein, if token amount newjeaky bucket are less than or equal to default Second Threshold after refreshing, when the transmit queue is scheduled again and from the transmit queue data dequeued bag, 301 is returned and restarts to carry out.
305:The dispatch state of the transmit queue is set to the state of non-scheduling, and the dispatch state of the transmit queue is set to the state of schedulable after a preset amount of time.
Specifically, the dispatch state of the transmit queue is set to the state of non-scheduling, and starts timing, when the time of timing reaching the default time, the dispatch state of the transmit queue is set to the state of schedulable.
Wherein, the dispatch state of the transmit queue is set to after the state of non-scheduling, scheduler can not dispatch the transmit queue, so that can not be from the transmit queue data dequeued bag, traffic shaping module in the corresponding leaky bucket of the normal direction transmit queue also without adding flow.The dispatch state of the transmit queue is set to after schedulable state, if the transmit queue again be scheduled device scheduling and from the transmit queue data dequeued bag when, execution 301 can be returned.
Optionally, k bit can be reserved in the transmit queue to be used to identify dispatch state, and k is the integer more than or equal to 1.
Wherein, for each transmit queue in the memory of communication process chip, all by above-mentioned 301-305 flow, the corresponding leaky bucket of transmit queue is just refreshed when packet goes out group from transmit queue.
Wherein, the memory of communication process chip is by access bandwidth due to being limited, and allows the number of the transmit queue of data dequeued bag to be less than or equal to the number of times that memory allows to access each second in each second, and in the present invention, when from transmit queue The corresponding leaky bucket of transmit queue of data dequeued bag is refreshed during data dequeued bag, therefore the number of times per second refreshed is identical with the number of times of data dequeued bag per second, so that the number of times per second for refreshing leaky bucket is less than or equal to the memory number of times per second for allowing to access, and refresh the number of times of leaky bucket not by the access bandwidth of memory limited and memory in the number of transmit queue limit, so as to significantly reduce the refreshing frequency of leaky bucket, therefore, as long as each transmit queue in memory, which carries out packet, goes out team, with regard to each transmit queue in memory can be flushed to.
In embodiments of the present invention, the first packet goes out team from transmit queue, and flow is added to the corresponding leaky bucket of the transmit queue according to the flow of the first packet;Calculate the time difference of the very first time and the second time, the very first time is the time for going out the packet of team first from the transmit queue, second time was the time that the second packet goes out team from the transmit queue, second packet is the packet for the last time that the first packet goes out before team from the transmit queue going out team, the flow that needs are subtracted is calculated according to the time difference calculated and in advance for the bandwidth meter of transmit queue setting, the flow of calculating is subtracted from the corresponding leaky bucket of the transmit queue.Going out team and sending and therefore, the refreshing of leaky bucket will being carried out according to method provided in an embodiment of the present invention according to leaky bucket, can just reduce the number of times and frequency for refreshing the corresponding leaky bucket of each transmit queue, realize traffic shaping due to packet.Embodiment 4
As shown in figure 13, the embodiments of the invention provide a kind of equipment of traffic shaping, including:
Go out group module 401, for the first packet to be gone out into team from transmit queue;
Refresh module 402, for refreshing the corresponding token bucket of the transmit queue according to the very first time, the second time and the bandwidth set in advance for the transmit queue, the very first time is the time that first packet goes out team from the transmit queue, second time was the time that the second packet goes out team from the transmit queue, second packet is that the first packet goes out before team from the transmit queue, and the last time goes out the packet of team.
Optionally, as shown in figure 14, refresh module 402 includes:
First computing unit 4021, the time difference for calculating the very first time and the second time;
Second computing unit 4022, for calculating the token amount for needing to add to the corresponding token bucket of the transmit queue according to the time difference calculated and in advance for the bandwidth meter of transmit queue setting;
First refresh unit 4023, for adding token to the corresponding token bucket of the transmit queue according to the token amount calculated, to refresh the corresponding token bucket of the transmit queue.
Optionally, as shown in figure 15, the equipment also includes:
First computing module 503, for according to the first token amount, the second token amount and the 3rd token amount, calculating the token amount after the corresponding token bucket of the transmit queue is refreshed;Wherein, the first token amount is that the first packet goes out before team from the transmit queue, the token amount in the corresponding token bucket of the transmit queue;Second token amount be the first packet from the transmit queue go out group when, The token amount subtracted from the corresponding token bucket of the transmit queue;3rd token amount is the token amount for needing to add to the corresponding token bucket of the transmit queue.
Still optionally further, as shown in figure 16(For simplicity, the simultaneous situation of following two module is illustrate only in figure), the equipment also includes:
First sets 504 pieces of mould, if the token amount stored after being refreshed for the corresponding token bucket of the transmit queue is less than default first threshold, the dispatch state of the transmit queue is then set to the state of non-scheduling, and the dispatch state of the transmit queue is set to the state of schedulable after a preset amount of time.And/or
First update module 505, for being refreshed using the corresponding token bucket of the transmit queue that calculates after token amount numerical value, update the first token amount.
Optionally, as shown in figure 17, refresh module 402 includes:
3rd computing unit 4024, the time difference for calculating the very first time and the second time;
4th computing unit 4025, the bandwidth set for the time difference according to calculating and in advance for the transmit queue calculates the flow for needing to be subtracted from the corresponding leaky bucket of the transmit queue;
Second refresh unit 4026, for subtracting the flow calculated from the corresponding leaky bucket of the transmit queue, to refresh the corresponding leaky bucket of the transmit queue.
Optionally, as shown in figure 18, the equipment also includes:
Second computing module 603, for according to first flow, second flow and the 3rd flow, calculating the flow after the corresponding leaky bucket of the transmit queue is refreshed;Wherein, first flow be the packet of team first before the transmit queue goes out, the flow in the corresponding leaky bucket of the transmit queue;Second flow be the first packet from the transmit queue go out group when, the flow added into the corresponding leaky bucket of the transmit queue;3rd flow is the flow for needing to subtract from the corresponding leaky bucket of the transmit queue.
Still optionally further, as shown in figure 19(For simplicity, the simultaneous situation of following two module is illustrate only in figure), the equipment also includes:
Second setup module 604, if the flow after being refreshed for the corresponding leaky bucket of the transmit queue is more than default Second Threshold, the dispatch state of the transmit queue is then set to the state of non-scheduling, and the dispatch state of the transmit queue is set to the state of schedulable after a preset amount of time.And/or
Second update module 605, for being refreshed using the corresponding leaky bucket of the transmit queue that calculates after flow numerical value, update first flow.
Optionally, as shown in figure 20, the equipment also includes:
3rd update module 403, for the numerical value using the very first time, updated for the second time.
In embodiments of the present invention, the first packet goes out team from transmit queue, and according to the very first time, the second time and in advance The bandwidth set for the transmit queue refreshes the corresponding token bucket of the transmit queue or leaky bucket, the very first time is the time for going out team from the first packet transmit queue, second time was the time that the second packet goes out team from the transmit queue, second packet is that the first packet goes out before team from the transmit queue, and the last time goes out the packet of team.Due to packet go out team and send will be according to token bucket or leaky bucket, therefore, the refreshing of token bucket or leaky bucket is carried out according to equipment provided in an embodiment of the present invention, the number of times and frequency for refreshing the corresponding token bucket of each transmit queue or leaky bucket can be just reduced, realize traffic shaping.
It should be noted that:A kind of equipment for traffic shaping that above-described embodiment is provided is when refreshing the corresponding token bucket of transmit queue or leaky bucket, only it is illustrated with the division of above-mentioned each functional module, in practical application, it can as needed and by above-mentioned functions distribute and be completed by different functional modules, the internal structure of equipment is divided into different functional modules, to complete all or part of function described above.In addition, above-described embodiment provides the equipment of traffic shaping and the embodiment of the method for traffic shaping belongs to same design, it implements process and refers to embodiment of the method, repeats no more here.
One of ordinary skill in the art will appreciate that realizing all or part of step of above-described embodiment can be completed by hardware, the hardware of correlation can also be instructed to complete by program, described program can be stored in a kind of computer-readable recording medium, storage medium mentioned above can be read-only storage, disk or CD etc..
Presently preferred embodiments of the present invention is the foregoing is only, is not intended to limit the invention, within the spirit and principles of the invention, any modification, equivalent substitution and improvements made etc. should be included in the scope of the protection.

Claims (1)

  1. Claims
    1st, a kind of method of traffic shaping, it is characterised in that methods described includes:
    First packet goes out team from transmit queue;
    According to the very first time, the second time and the bandwidth set in advance for the transmit queue, refresh the corresponding token bucket of the transmit queue or leaky bucket, wherein, the very first time is the time that first packet goes out team from the transmit queue, second time is the time that the second packet goes out team from the transmit queue, second packet is that first packet goes out before team from the transmit queue, and the last time goes out the packet of team.2nd, the method as described in claim 1, it is characterised in that refresh the corresponding token bucket of the transmit queue according to the very first time, the second time and in advance for the bandwidth that the transmit queue is set, including:
    Calculate the time difference of the very first time and the second time;
    The bandwidth set according to the time difference and in advance for the transmit queue, calculating needs the token amount to the corresponding token bucket addition of the transmit queue;
    According to the token amount added to the corresponding token bucket of the transmit queue the need for described calculate, token is added to the corresponding token bucket of the transmit queue, to refresh the corresponding token bucket of the transmit queue.
    3rd, method as claimed in claim 2, it is characterised in that refresh according to the very first time, the second time and in advance for the bandwidth that the transmit queue is set after the corresponding token bucket of the transmit queue, in addition to:
    According to the first token amount, the second token amount and the 3rd token amount calculate the token amount after the corresponding token bucket of the transmit queue is refreshed;
    Wherein, the first token amount is that the first packet goes out before team from the transmit queue, the token amount in the corresponding token bucket of the transmit queue;The second token amount be the first packet from the transmit queue go out group when, the token amount subtracted from the corresponding token bucket of the transmit queue;The 3rd token amount is the token amount for needing to add to the corresponding token bucket of the transmit queue.
    4th, method as claimed in claim 3, it is characterised in that it is described calculate the token amount after the corresponding token bucket of the transmit queue is refreshed after, in addition to:
    If the token amount after the corresponding token bucket of the transmit queue is refreshed is less than default first threshold, the dispatch state of the transmit queue is set to the state of non-scheduling, and the dispatch state of the transmit queue is set after a preset amount of time For the state of schedulable.
    5th, the method as described in claim 3 or 4, it is characterised in that it is described calculate the token amount stored after the corresponding token bucket of the transmit queue is refreshed after, in addition to:
    The numerical value of token amount after being refreshed using the corresponding token bucket of the transmit queue calculated, updates first token
    6th, the method as described in claim 1, it is characterised in that refresh the corresponding leaky bucket of the transmit queue according to the very first time, the second time and in advance for the bandwidth that the transmit queue is set, including:
    Calculate the time difference of the very first time and the second time;
    The bandwidth set according to the time difference and in advance for the transmit queue, calculates the flow for needing to be subtracted from the corresponding leaky bucket of the transmit queue;
    The flow calculated is subtracted from the corresponding leaky bucket of the transmit queue, to refresh the corresponding leaky bucket of the transmit queue.7th, method as claimed in claim 6, it is characterised in that refresh according to the very first time, the second time and in advance for the bandwidth that the transmit queue is set after the corresponding leaky bucket of the transmit queue, in addition to:
    According to first flow, second flow and the 3rd flow, calculate the stream after the corresponding leaky bucket of the transmit queue is refreshed wherein, the first flow is that the first packet goes out before team from the transmit queue, the flow in the corresponding leaky bucket of the transmit queue;The second flow be the first packet from the transmit queue go out group when, the flow added into the corresponding leaky bucket of the transmit queue;3rd flow is the flow for needing to subtract from the corresponding leaky bucket of the transmit queue.
    8th, method as claimed in claim 7, it is characterised in that it is described calculate the flow after the corresponding leaky bucket of the transmit queue is refreshed after, in addition to:
    If the flow after the corresponding leaky bucket of the transmit queue is refreshed is more than default Second Threshold, the dispatch state of the transmit queue is then set to the state of non-scheduling, and the dispatch state of the transmit queue is set to the state of schedulable after a preset amount of time.
    9th, method as claimed in claim 7 or 8, it is characterised in that it is described calculate the flow stored after the corresponding leaky bucket of the transmit queue is refreshed after, in addition to: The numerical value of flow after being refreshed using the corresponding leaky bucket of the transmit queue calculated, updates the first flow.
    10th, the method as described in claim 1, it is characterised in that refresh according to the very first time, the second time and in advance for the bandwidth that the transmit queue is set after the corresponding token bucket of the transmit queue or leaky bucket, in addition to:
    Using the numerical value of the very first time, second time is updated.
    11st, a kind of equipment of traffic shaping, it is characterised in that the equipment include-goes out group module, for the first packet to be gone out into team from transmit queue;
    Refresh module, for refreshing the corresponding token bucket of the transmit queue or leaky bucket according to the very first time, the second time and in advance for the bandwidth that the transmit queue is set, wherein, the very first time is the time that first packet goes out team from the transmit queue, second time is the time that the second packet goes out team from the transmit queue, second packet is that first packet goes out before team from the transmit queue, and the last time goes out the packet of team.
    12nd, equipment as claimed in claim 11, it is characterised in that the refresh module includes:
    First computing unit, the time difference for calculating the very first time and the second time;
    Second computing unit, for calculating the token amount for needing to add to the corresponding token bucket of the transmit queue according to the time difference and in advance for the bandwidth meter of transmit queue setting;
    First refresh unit, for according to the token amount calculated to the corresponding token bucket addition token of the transmit queue, to refresh the corresponding token bucket of the transmit queue.
    13rd, equipment as claimed in claim 12, it is characterised in that the equipment also includes:
    First computing module, for according to the first token amount, the second token amount and the 3rd token amount, calculating the token amount after the corresponding token bucket of the transmit queue is refreshed;Wherein, the first token amount is that the first packet goes out before team from the transmit queue, the token amount in the corresponding token bucket of the transmit queue;The second token amount be the first packet from the transmit queue go out group when, the token amount subtracted from the corresponding token bucket of the transmit queue;The 3rd token amount is the token amount for needing to add to the corresponding token bucket of the transmit queue.
    14th, equipment as claimed in claim 13, it is characterised in that the equipment also includes:
    First setup module, if the token amount after being refreshed for the corresponding token bucket of the transmit queue is less than default first threshold, the dispatch state of the transmit queue is set to the state of non-scheduling, and sent after a preset amount of time by described The dispatch state of queue is set to the state of schedulable;And/or
    First update module, for being refreshed using the corresponding token bucket of the transmit queue that calculates after token amount numerical value, update the first token amount.15th, equipment as claimed in claim 11, it is characterised in that the refresh module includes:
    3rd computing unit, the time difference for calculating the very first time and the second time;
    4th computing unit, for the bandwidth set according to the time difference and in advance for the transmit queue, calculates the flow for needing to be subtracted from the corresponding leaky bucket of the transmit queue;
    Second refresh unit, for subtracting the flow calculated from the corresponding leaky bucket of the transmit queue, to refresh the corresponding leaky bucket of the transmit queue.
    16th, equipment as claimed in claim 15, it is characterised in that the equipment also includes:
    Second computing module, for according to first flow, second flow and the 3rd flow, calculating the flow after the corresponding leaky bucket of the transmit queue is refreshed;Wherein, the first flow is that the first packet goes out before team from the transmit queue, the flow in the corresponding leaky bucket of the transmit queue;The second flow be the first packet from the transmit queue go out group when, the flow added into the corresponding leaky bucket of the transmit queue;3rd flow is the flow for needing to subtract from the corresponding leaky bucket of the transmit queue.
    17th, equipment as claimed in claim 16, it is characterised in that the equipment also includes:
    Second setup module, if the flow after being refreshed for the corresponding leaky bucket of the transmit queue is more than default Second Threshold, the dispatch state of the transmit queue is then set to the state of non-scheduling, and the dispatch state of the transmit queue is set to the state of schedulable after a preset amount of time;And/or
    Second update module, for being refreshed using the corresponding leaky bucket of the transmit queue that calculates after flow numerical value, update the first flow.
    18th, equipment as claimed in claim 11, it is characterised in that the equipment also includes:
    3rd update module, for the numerical value using the very first time, updates second time.
CN201180001490.1A 2011-08-01 2011-08-01 A kind of method and apparatus of traffic shaping Active CN103026671B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2011/077884 WO2012159362A1 (en) 2011-08-01 2011-08-01 Traffic shaping method and device

Publications (2)

Publication Number Publication Date
CN103026671A true CN103026671A (en) 2013-04-03
CN103026671B CN103026671B (en) 2016-01-20

Family

ID=47216586

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201180001490.1A Active CN103026671B (en) 2011-08-01 2011-08-01 A kind of method and apparatus of traffic shaping

Country Status (2)

Country Link
CN (1) CN103026671B (en)
WO (1) WO2012159362A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110086728A (en) * 2018-01-26 2019-08-02 华为技术有限公司 Send method, first network equipment and the computer readable storage medium of message
CN113067778A (en) * 2021-06-04 2021-07-02 新华三半导体技术有限公司 Flow management method and flow management chip

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104753809B (en) * 2013-12-25 2019-04-02 深圳市中兴微电子技术有限公司 The method and device of token is added in a kind of traffic shaping
CN111045810B (en) * 2019-12-17 2023-08-29 浙江大华技术股份有限公司 Task scheduling processing method and device
CN113645147B (en) * 2021-07-01 2024-08-23 裕太微电子股份有限公司 Token updating system and method of traffic shaper

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1525717A (en) * 2003-02-25 2004-09-01 ������������ʽ���� Flow quantity truing method and apparatus
CN1751481A (en) * 2003-02-14 2006-03-22 西门子公司 Method for allocating transmission bandwidth in a packet-oriented communications facility
CN101005453A (en) * 2006-12-26 2007-07-25 华为技术有限公司 Method and device for refreshing token bucket in flow limiting technology
US20090086634A1 (en) * 2007-10-02 2009-04-02 Bruce Kwan Method and system for packet rate shaping

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101217495A (en) * 2008-01-11 2008-07-09 北京邮电大学 Traffic monitoring method and device applied under T-MPLS network environment
CN101841461B (en) * 2010-02-11 2012-05-30 北京星网锐捷网络技术有限公司 Method and device for controlling updating of token bucket

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1751481A (en) * 2003-02-14 2006-03-22 西门子公司 Method for allocating transmission bandwidth in a packet-oriented communications facility
CN1525717A (en) * 2003-02-25 2004-09-01 ������������ʽ���� Flow quantity truing method and apparatus
CN101005453A (en) * 2006-12-26 2007-07-25 华为技术有限公司 Method and device for refreshing token bucket in flow limiting technology
US20090086634A1 (en) * 2007-10-02 2009-04-02 Bruce Kwan Method and system for packet rate shaping

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110086728A (en) * 2018-01-26 2019-08-02 华为技术有限公司 Send method, first network equipment and the computer readable storage medium of message
CN110086728B (en) * 2018-01-26 2021-01-29 华为技术有限公司 Method for sending message, first network equipment and computer readable storage medium
CN113067778A (en) * 2021-06-04 2021-07-02 新华三半导体技术有限公司 Flow management method and flow management chip

Also Published As

Publication number Publication date
CN103026671B (en) 2016-01-20
WO2012159362A1 (en) 2012-11-29

Similar Documents

Publication Publication Date Title
CN103026671A (en) Traffic shaping method and device
US8225026B2 (en) Data packet access control apparatus and method thereof
EP2913963B1 (en) Data caching system and method for an ethernet device
JP6077125B2 (en) Data processing method and apparatus
CN107360591A (en) A kind of method and apparatus of reporting buffer status report
CN103581055B (en) The order-preserving method of message, flow scheduling chip and distributed memory system
WO2016086406A1 (en) Network resource deployment method and device
CN105573711A (en) Data caching methods and apparatuses
WO2011015055A1 (en) Method and system for storage management
CN104268113B (en) The lcd controller of DPI interfaces and the method for its adaptive bandwidth
CN107783727A (en) A kind of access method of memory device, device and system
CN102571561B (en) PWE3 device and method for reading and writing data in jitter buffer of device
CN102377678B (en) Data transmission and processing method and device
CN102882809B (en) Network speed-limiting method and device based on message buffering
WO2011014998A1 (en) Method and apparatus for calculating the message arrival time interval
CN110058816A (en) DDR-based high-speed multi-user queue manager and method
WO2012079423A1 (en) Method and apparatus for data packet buffer management
CN102857333A (en) Device and method for synchronizing data packet from sensor network
CN106060583B (en) Cloud game delay process method and device
WO2013091368A1 (en) Method and apparatus for allocating sounding reference signal resource
CN102932265B (en) Data caching management device and method
CN109274697A (en) Data frame escape method, data frame solution escape method, system and relevant apparatus
JP7506038B2 (en) Method for data collection in a wireless mesh network and device for its implementation - Patents.com
CN108933768A (en) The acquisition methods and device of the transmission frame per second of video frame
CN101883046A (en) Data cache architecture applied to EPON terminal system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201119

Address after: Unit 2414-2416, main building, no.371, Wushan Road, Tianhe District, Guangzhou City, Guangdong Province

Patentee after: GUANGDONG GAOHANG INTELLECTUAL PROPERTY OPERATION Co.,Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee before: HUAWEI TECHNOLOGIES Co.,Ltd.

Effective date of registration: 20201119

Address after: 215500 No.13, Caotang Road, Changshu, Suzhou, Jiangsu Province

Patentee after: Changshu intellectual property operation center Co.,Ltd.

Address before: Unit 2414-2416, main building, no.371, Wushan Road, Tianhe District, Guangzhou City, Guangdong Province

Patentee before: GUANGDONG GAOHANG INTELLECTUAL PROPERTY OPERATION Co.,Ltd.

CP02 Change in the address of a patent holder
CP02 Change in the address of a patent holder

Address after: 215500 5th floor, building 4, 68 Lianfeng Road, Changfu street, Changshu City, Suzhou City, Jiangsu Province

Patentee after: Changshu intellectual property operation center Co.,Ltd.

Address before: No.13 caodang Road, Changshu City, Suzhou City, Jiangsu Province

Patentee before: Changshu intellectual property operation center Co.,Ltd.