A token bucket permits burstiness, but bounds it. Thus, at any time, the largest burst a source can send into the network is roughly proportional to the size of the bucket. If the bucket fills to capacity, newly arriving tokens are discarded and are not available to future packets. The bucket itself has a specified capacity. If not enough tokens are in the bucket to send a packet, the packet either waits until the bucket has enough tokens (in the case of a shaper) or the packet is discarded or marked down (in the case of a policer). To send a packet, the traffic regulator must be able to remove from the bucket a number of tokens equal in representation to the packet size. Tokens are put into the bucket at a certain rate.Įach token is permission for the source to send a certain number of bits into the network. Let's look at how the token bucket metaphor works: A token bucket itself has no discard or priority policy. Simply stated, both shaping and policing use the token bucket metaphor. Token Refresh RateĪ key difference between shaping and policing is the rate at which tokens are replenished. * Although policing does not apply buffering, a configured queuing mechanism applies to "conformed" packets that may need to be queued while waiting to be serialized at the physical interface. Overly aggressive burst sizes may lead to excess packet drops and throttle the overall output rate, particularly with TCP-based flows. Avoids delays due to queuing.Ĭan introduce delay due to queuing, particularly deep queues.ĭrops excess packets (when configured), throttling TCP window sizes and reducing the overall output rate of affected traffic streams. Drops may occur if excess traffic is sustained at high rates.) Typically avoids retransmissions due to dropped packets.Ĭontrols the output rate through packet drops. (Buffers packets up to the length of the queue. Less likely to drop excess packets since excess packets are buffered. Uses a leaky bucket to delay traffic, which achieves a smoothing effect.
(Minimum number of intervals is required.)Ĭontinuous based on formula: 1 / committed information rate Incremented at the start of a time interval. The following table lists the differences between shaping and policing to help you choose the best solution.īuffer and queue excess packets above the committed rates.ĭrop (or remark) excess packets above the committed rates. Examples of scheduling functions are Class Based Weighted Fair Queuing (CBWFQ) and Low Latency Queuing (LLQ). This scheduling function allows you to organize the shaping queue into different queues. In addition, shaping requires a scheduling function for later transmission of any delayed packets. Ensure that you have sufficient memory when enabling shaping.
Only policing can be applied to inbound traffic on an interface. Queueing is an outbound concept packets going out an interface get queued and can be shaped. Shaping implies the existence of a queue and of sufficient memory to buffer delayed packets, while policing does not. The result of traffic shaping is a smoothed packet output rate. In contrast to policing, traffic shaping retains excess packets in a queue and then schedules the excess for later transmission over increments of time. The result is an output rate that appears as a saw-tooth with crests and troughs. When the traffic rate reaches the configured maximum rate, excess traffic is dropped (or remarked). The following diagram illustrates the key difference. If you are working in a live network, ensure that you understand the potential impact of any command before using it.
All of the devices used in this document started with a cleared (default) configuration. The information presented in this document was created from devices in a specific lab environment.
This document is not restricted to specific software and hardware versions. There are no specific prerequisites for this document. Refer to Cisco Technical Tips Conventions for more information on document conventions. (A token bucket is described in What Is a Token Bucket?). Though both mechanisms use a token bucket as a traffic meter to measure the packet rate, they have important functional differences. This document clarifies the functional differences between shaping and policing, both of which limit the output rate.