An example of how a single token bucket algorithm works:
There is an interface of 1Gbps, with a policer defined with a committed information rate of 120Mbps and committed burst size of 12Mbps. A committed time interval can not be configured in Cisco IOS but can be calculated.
Committed time interval = ( Committed Burst Size in bits / Committed Information Rate in bits per second) x 1000
Committed Time Interval = ( 12,000,000 / 120,000,000) * 1000 = 100ms
Once the committed time interval has been calculated, the number of committed time intervals in a second can be calculated:
Committed Time Intervals per Second = 1000 / Committed Time Interval
Committed Time Intervals per Second = 1000 / 100 = 10
If there are a continuous stream of 1500-byte (12,000 bit) packets, and it is processed by the token algorithm. Only a committed burst size of 12 Mb can be taken by the packets within each committed time interval.
Number of packets that can conform with each committed time interval = Committed Burst Size / packet size in bits (rounded down)
Number of packets that can conform with each committed time interval = 12,000,000 / 12,000 = 1000 packets
Any additional packets beyond a total of 1000 will be dropped or marked down.
To figure out how many packets that would be sent in one second:
Packets per second = Number of packets that conform within each committed time interval * committed time intervals per second
Packets per second = 1000 * 10 = 10,000 packets
To calculate the committed information rate for the 10,000, use the following formula:
CIR = Packets per second * Packet size in bits
CIR = 10,000 packets per second * 12,000 bits = 120,000,000 bps = 120Mbps
To calculate the time interval it would take for 1000 packets to be sent at interface line rate:
Time interval line rate = Committed Burst Size / Interface Speed) * 1000
Time Interval Line Rate = (12 Mb / 1 Gbps) * 1000
Time Interval Line Rate = (12,000,000 bits / 1000,000,000 bps) * 1000 = 12 milliseconds
The recommended values for Committed Time Interval range between 8ms to 125ms. Shorter time intervals are recommended to reduce delays for sensitive traffic such as voice or video. Times longer than 125ms are not recommended as the delay will be too large.