Policers and shapers are based on token bucket algorithms in Cisco IOS.
Definitions
Committed Information Rate
The policed traffic rate, in bits per second.
Committed Time Interval
The time interval in seconds that a committed burst is sent. It can be calculated with the formula Committed Time Interval = (Burst Size / Committed Information Rate) x 1000
Committed Burst Size
The maximum size of a committed information rate token bucket measured in bytes, and the maximum amount of traffic that can be sent within a committed time interval. Committed burst size can be calculated with the formula Committed Burst Size = Committed Information Rate x (Committed Time Interval / 1000)
Token
A token represents 1 byte (8 bits)
Token Bucket
A token bucket collects tokens until a maximum predefined number of tokens is reached, an example being the committed burst size with a single token bucket. The tokens are added into the token bucket at a fixed rate, or the committed information rate.
The packets are checked for conformance to the defined rate and takes tokens from the bucket equal to its packet size. If a packet size is 1500 bytes, it takes 12,000 bits from the bucket.
If there are not enough tokens in the token bucket to send the packet, the traffic conditioning can take one of the following actions:
- Buffer the packets whilst waiting for enough tokens to accumulate in the token bucket, known as traffic shaping
- Drop the packets, known as traffic policing
- Mark down the packets, also traffic policing.
Token Bucket Setup
It is recommended for the committed burst value to be larger or equal to the size of the largest possible IP packet in a traffic stream. If the committed burst value is not bigger than the largest possible IP traffic, then there will never be enough tokens accumulated in the token bucket for those larger packets. Those larger packets will always be subject to traffic policing or shaping.
If the token bucket fills up to its maximum capacity, newly added tokens are discarded.
Algorithms that utilise token buckets may have more than one token bucket. Single token bucket algorithms may have a measured traffic rate that can conform or exceed the defined traffic rate. A measured traffic rate is conforming if there are enough tokens in the token bucket to transmit the traffic. Otherwise the traffic is exceeded if there are not enough tokens in the token bucket to transmit traffic.
Leave a Reply