Congestion management and avoidance
Congestion management is queuing plus scheduling. Queuing starts only when the interface's hardware transmit ring is full; the scheduler then decides which packet goes next. CBWFQ guarantees bandwidth classes their share and LLQ gives real-time traffic a priority queue. When a queue fills, tail drop discards; RED and WRED drop early instead, and ECN marks.
By Arif, founder of Daveth · Updated
The full 8 min walkthrough is in Daveth Pro (Network). See what the plan opens
What this page answers
When does QoS queuing start?
Only when the output interface is congested: while the hardware transmit ring, the Tx-ring, is full. When it is not full, packets go straight out and queuing stops; scheduling is always active. Read it in “4.1 When the queue starts”
Can LLQ starve the other queues?
A strict priority queue that never empties would stop everything else, like a till that always serves the priority lane first. LLQ avoids that by policing its priority traffic, so the bandwidth classes still get their share. Read it in “4.1 When the queue starts”
4.1 When the queue starts
Congestion management is queuing plus scheduling. Queuing, or buffering, is the temporary storage of excess packets; it's switched on only when the output interface is congested and off again when it clears. How does the router know? There's a Layer 1 hardware queue on physical interfaces, the transmit ring (Tx-ring, TxQ). While it's full, the interface is congested and queuing is active; when it isn't full, queuing stops. It's like the pass in a restaurant kitchen: as long as there's space on the pass, plates go straight out; only when it's full do they start stacking up behind it.
Congestion comes from one of two things: the input interface is faster than the output, or the output is receiving from several inputs at once. While packets are queued, some algorithms reorder them so higher-priority ones leave first; a scheduling algorithm decides which packet goes next, and scheduling is always active, congested or not. Scheduling works like the merge where a motorway drops from three lanes to one: the merge rule applies to every car, busy or not; on an empty road you just never notice it, and the moment it's busy it decides everything.
On a quiet link, queuing does nothing at all. It's a very well-paid lifeguard.
Most queuing algorithms were designed before voice and HD video, and don't suit them, like a bus timetable written before the motorway opened. The legacy ones, older than MQC:
| Algorithm | How it picks | The catch |
|---|---|---|
| FIFO | one queue: first in, first out | every packet is the same class |
| Round robin | one packet from each queue in turn; equal shares if the packets are about the same size | nothing starves, but nothing has priority |
| WRR | round robin with a weight per queue, so each gets its own share: that's how it adds prioritisation | by share only: no strict priority, so no delay guarantee |
| CQ | Cisco's WRR: 16 queues, round robin between them, FIFO within each; unused bandwidth can be borrowed | long delays, and FIFO's problems in all 16 queues |
| PQ | four queues (high, medium, normal, low) in strict order, FIFO within each | a lower queue is served only when every higher one is empty: it starves while they're busy |
| WFQ | divides bandwidth by the number of flows, weighted by IP Precedence | better for real-time flows, but no fixed bandwidth guarantee for any flow |
PQ is the one to remember, because it's the one LLQ fixes. Picture yourself at a supermarket with a single till that always serves the priority lane first: if the priority lane never empties, the regular queue never moves.
PQ's low queue is the only queue in networking with a lifetime guarantee of waiting.
The algorithms recommended for rich-media networks, and supported by MQC, combine the best of the legacy ones: bandwidth and delay guarantees for real-time traffic, without starving everything else.
CBWFQ, class-based weighted fair queuing, creates up to 256 queues for up to 256 classes, each served according to the bandwidth assigned to its class; it extends WFQ with user-defined classes. Classes come from markings, protocols, ACLs or input interfaces; each can get a bandwidth, a weight, a queue limit and a maximum packet limit. The class's bandwidth is its minimum during congestion; its queue limit is the most packets its queue will hold, and beyond it the excess is dropped. And CBWFQ alone gives no latency guarantee, so it only suits non-real-time traffic. You can think of it as a kitchen that promises each table a share of the chef's time: nobody's forgotten, but nobody's promised their starter in two minutes either.
LLQ, low-latency queuing, is CBWFQ plus priority queuing, built for real-time traffic like voice. Traffic in the strict-priority queue is served, up to its assigned bandwidth, before any CBWFQ queue. All real-time traffic should go there. You can define several real-time classes, each with its own bandwidth guarantee, but one priority queue schedules them all; unused bandwidth is shared with the other classes. And the crucial part: during congestion, real-time traffic beyond its guarantee is policed by a congestion-aware policer, so the non-priority classes aren't starved (Cisco's scheduling guide: "a conditional policer will only drop packets if the schedule is congested", so the excess is dropped, not marked down); starving them is exactly what legacy PQ did. That's why LLQ gives real-time traffic both latency and bandwidth guarantees, and suits a mix of real-time and non-real-time traffic. When you configure LLQ you give that policing rate as a fixed bandwidth or a percentage of the interface. It's like the express lane with a limit painted on the floor: ten items or fewer goes first, and on a busy day anything over the limit is left at the till.
Why two priority classes? So each gets its own policer: voice policed to 10 Mbps during congestion and video to 100 Mbps, say, which one class with one policer couldn't do. The guide's Figure 14-17 draws exactly that: voice and video each through their own policer into one priority queue, the other classes into CBWFQ queues, a CBWFQ scheduler, and the priority queue always served first into the Tx-ring. D1 runs a single-policer version of it.
Predict before you open D1: voice floods the link. What happens to bulk data under PQ, and under LLQ?
D1

Under PQ, the other classes get nothing while voice keeps the high queue full. Under LLQ, voice beyond its rate is policed (in this model, dropped) and the others keep their shares. And notice PQ with voice behaving: best effort already gets nothing, because voice and bulk together keep the queues above it busy. Same priority; the policer is the difference.
LLQ is priority boarding with a bag limit. PQ is priority boarding where the priority passengers never stop arriving.
Congestion avoidance watches the load and drops packets to head off congestion. The default drop mechanism is tail drop: it treats all traffic the same, and when the output queue is full, every packet trying to enter is dropped, whatever its priority, until the queue has room again. It works behind the scenes just like a car park that only closes its gate when the last space is taken: everyone queuing at the barrier at that moment is turned away, together.
That "together" is the problem. Tail drop should be avoided for TCP, because it can cause TCP global synchronisation, which leaves the link significantly underused. RFC 2309 gives tail drop two drawbacks: lock-out, where a few flows monopolise the queue, and full queues, kept full or nearly full for long periods. Under the second it explains the chain: a burst arriving at a full queue loses several packets, which "can result in a global synchronization of flows throttling back, followed by a sustained period of lowered link utilization". The flows behave like a motorway where one driver brakes and the whole lane brakes with them, then speeds up together, then brakes together again.
Predict before D2: with tail drop, when the queue overflows, how many of four flows back off at once?
Global synchronisation is the network's version of everyone leaving the office at 5:00 exactly. The car park is empty at 4:59 and gridlocked at 5:01.
RED, random early detection, drops packets at random before the queue is full. Dropping a few at random instead of many at once avoids global synchronisation. RED watches the queue depth and starts early drops on random packets once the minimum threshold is exceeded. RFC 2309 adds the detail: the drop probability rises as the average queue grows, and RED responds to a time-averaged queue length, not the instantaneous one. It's a bit like a café that starts saying "we're nearly full, maybe try next door" to one customer at a time as it fills, instead of locking the door on a whole crowd.
WRED, weighted RED, is Cisco's implementation: the randomness can be steered by IP Precedence or DSCP. Lower IPP values are dropped more aggressively than higher ones, and with DSCP, AFx3 goes before AFx2, and AFx2 before AFx1. It works the same for IPv6, because the DSCP sits in the same six bits of the IPv6 Traffic Class. That's where 05-2's drop probability and 05-3's markdown finally pay off, like the standby list at a gate, where the cheapest tickets are the first to be bumped.
D2

Tail drop: all four flows halve together, again and again, and the link dips after each. RED: one flow at a time, a shorter queue that never reaches the top, and no two flows halve in the same round trip. One honest detail from the model: in this steady illustration RED doesn't make the link busier: about 94% against tail drop's 98%, with dips to about 72% against 89%. Its one-at-a-time drops still reach every flow within a few round trips, so their combined rate still dips. It trades throughput for less queuing delay here. RFC 2309's claim is that short queues "can" raise throughput as well, because they leave room for the bursts real traffic has and this illustration doesn't. Know the guide's version for the exam: tail drop, global synchronisation, underused link; RED and WRED prevent it.
RED is the only bouncer who turns people away while the club's still half empty, and it's the reason the club never has a riot at the door.
WRED can also set the IP ECN bits, to say that congestion was experienced in transit. ECN is an extension to WRED that signals ECN-capable endpoints to slow down. The two bits are the ones 05-2 left at the bottom of the DiffServ byte, like the spare line at the bottom of a form that finally gets used.
Continue the lesson
The whole lesson, with its drawings and its questions. The rest of this section and 9 more after it.



