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?
Solved! Go to Solution.
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.
EDIT: Found this article on cisco.com that lists the difference between policing and shaping in terms of refreshing the token bucket:
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.