cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2294
Views
0
Helpful
3
Replies

Token Bucket - Method of Replenishment

vv0bbLeS
Level 1
Level 1

Hello all,

 

I thought I was clear on how the Token Bucket gets replenished, i.e. at a constant rate per time interval.

 

However, I was reading the Token Bucket Algorithm section of the IOS 16.6.x QoS configuration guide, and it says:

 

Policing uses a token-bucket algorithm. As each frame is received by the device, a token is added to the bucket. 
The rate at which tokens are replenished depends on the packet arrival. Assume that a packet comes in at time T1 and the next one comes in at time T2. The time interval between T1 and T2 determines the number of tokens that need to be added to the token bucket. This is calculated as:

Time interval between packets (T2-T1) * CIR)/8 bytes

 

So now I am confused, as in reading other Cisco.com sites like this one it reinforces the fact that the Bucket is replenished at a constant rate:

 

In the token bucket metaphor, tokens are put into the bucket at a certain rate.

 

Are we dealing with 2 different versions of the Token Bucket Algorithm here? Or exactly how are tokens added to the Token Bucket in modern IOS versions?

0xD2A6762E
1 Accepted Solution

Accepted Solutions

Dan Frey
Cisco Employee
Cisco Employee

Policing and Shaping have completely different methods for replenishing the token bucket.

View solution in original post

3 Replies 3

Dan Frey
Cisco Employee
Cisco Employee

Policing and Shaping have completely different methods for replenishing the token bucket.

Ah ok awesome! I will research with that in mind! Thank you!

 

Also, if you have some links or documentation handy I'll take them, but if not I will try to find some docs out on the internets.

 

Thanks again!

0xD2A6762E

EDIT: Found this article on cisco.com that lists the difference between policing and shaping in terms of refreshing the token bucket:

 

https://www.cisco.com/c/en/us/support/docs/quality-of-service-qos/qos-policing/19645-policevsshape.html#tokenrefreshrate

 

Specifically:

Shaping increments the token bucket at timed intervals using a bits per second (bps) value. A shaper uses the following formula:

Tc = Bc/CIR (in seconds)

 

In contrast, class-based policing and rate-limiting adds tokens continuously to the bucket. Specifically, the token arrival rate is calculated as follows:

(time between packets<which is equal to t-t1>* policer rate)/8 bits per byte
In other words, if the previous arrival of the packet was at t1 and the current time is t, the bucket is updated with t-t1 worth of bytes based on the token arrival rate. Note that a traffic policer uses burst values specified in bytes, and the above formula converts from bits to bytes.

 

 

0xD2A6762E
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: