## Sunday, January 29, 2012

### SRR queue - sharing and shaping on 3750

On 3750, both ingress and egress queue are serviced by SRR queue.  Here are a summary on SRR queue sharing and shaping:

1. You can configure sharing or shaping for egress queue, however for ingress you can only configure sharing.

2. In shaped mode, the egress queues are guaranteed a percentage of the bandwidth, and they are rate-limited to that amount. Shaped traffic does not use more than the allocated bandwidth even if the link is idle.

3. With shaping, the inverse absolute value of each weight is used to compute the bandwidth available for the queues.

Example: "srr-queue bandwidth shape 4 0 0 0", which means 1/4 of the interface bandwidth is assigned to queue 1.  If the link is a FE interface, around 25Mbps is allocated.  Even if the link is idle, queue 1 can't use more than 25Mbps bandwidth in this case.

4. In shared mode, the queues share the bandwidth among them according to the configured weights. The bandwidth is guaranteed at this level but not limited to it. For example, if a queue is empty and no longer requires a share of the link, the remaining queues can expand into the unused bandwidth and share it among them.

5. With sharing, the ratio of the weights controls the frequency of dequeuing.

Example: "srr-queue bandwidth share 30 40 25 5", the sum is 30 + 40 + 25 + 5 = 100 (better to reference to 100 for ease of calculation). The relative rate are 30/100, 40/100, 25/100 and 5/100

6. Shaping and sharing is configured per interface. Each interface can be uniquely configured.

7. You can mix shared and shaped on the same interface.

Example:
interface GigabitEthernet 1/0/1
srr-queue bandwidth share 1 30 40 30
srr-queue bandwidth shape 5 0 0 0

The interface bandwidth is 1000Mbps, queue 1 will get 1/5 = 200 Mbps. Queue 2, 3 and 4 will share the remaining 800Mbps.

Queue 2 = 800Mbps x 30% = 240Mbps
Queue 3 = 800Mbps x 40% = 320Mbps
Queue 4 = 800Mbps x 30% = 240Mbps

8. When you type "priority-queue out", you will turn queue 1 into PQ, it will ignore shared and shaped weight in the calculation. It means the PQ has 100% bandwidth when it needs, therefore other shaped queue may starve.