Showing results for 
Search instead for 
Did you mean: 

MQC: Using 'shape' with 'bandwidth'


Hi all,

I'm trying to get an understanding of how the 'shape' command works when used together with a 'bandwidth' command.

I don't have any problems with the intent of such a configuration. The bandwidth will determine the minimum rate at which the prec3 queue will be serviced under congestion whereas the shaping rate will be the maximum rate at which the queue will be serviced. Based on my testing, all of this works quite well.

My confusion is with the order of operations and the queue sizes. The output of 'show policy-map' indicates a max buffers of 1000 (for the shaping queue) and a threshold of 64 packets for the CBWFQ queue. However, the output of 'show policy-map' interface does not show the max buffers for shaping. Are there two separate queues used when using such a configuration ? If so, what is the order of operations here ?

Here is what I consider to be the three options:

1. There are 2 queues where the shaping queue follows the CBWFQ queue.

The output of the CBWFQ queue enters the shaping queue from which packets are leaked out based on the shaping parameters. This would satisfy the shaping requirement of the class. At each scheduling interval, the router would schedule packets out of the CBWFQ and into the shaping queue. At the same time it would de-queue packets from the head of the shaping queue at a rate that does not exceed the shaping rate. Therefore, for classes for which shaping is configured, packets destined for the TxQ would only be de-queued from the shaping queue (because packets de-queued from the CBWFQ queue would enter the shaping queue). For classes for which shaping is not configured, packets are dequeued directly from the CBWFQ queue and into the TxQ.

2. There are 2 queues where the CBWFQ queue follows the shaping queue.

The output of the shaping queue enters the CBWFQ queue from which packets are leaked out based on the shaping parameters. The router would give the CBWFQ queue sufficient credits in each shceduling interval so that the shaping rate is not exceeded. In this case, the shaping queue is there purely to provide additional buffer space. The scheduling of packets is consistent for all classes in this case (whether or not they use shaping) - all packets are de-queueud from the CBWFQ and send to the TxQ.

3. There is just one queue which is used for CBWFQ and shaping.

In this case, it would make sense that the queue is the size of the shaping queue (1000 packets, by default). The router would give the CBWFQ queue sufficient credits in each scheduling interval so that the shaping rate is not exceeded.

Alright, so that's what I am grappling with at the moment. So which of the above is it ? Or am I totally off the mark and there is some other way this is done.

All comments appreciated.


1 Reply 1


Hi Paresh,

shaping is first, CBWFQ is later (exception: nested policies). So the Shaper relases packets at a maximum of the configured rate "towards the interface".

Now there is one additional hurdle to take. As long as you do not overload your interface the CBWFQ will not be involved. Technically speaking you only have CBWFQ involved in case the interface hardware queue (sometimes called tx-ring) is full.

CBWFQ uses it´s own queue. But be aware in a router the Shaper queue and the CBWFQ are only implemented in software. So a packet in fact is not copied from one queue to the next. Shaping and CBWFQ are more like complex rules for a router to figure out which packet in real memory should be sent next on a specific interface and which other packets still will have to wait a little longer.

The whole idea of QoS with respect to this is to change the behaviour from FIFO to something you do like more.

Hope this helps more than it confuses :-)



P.S.: also read "Quality of Service Order of Operation"

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: