434 Words. Plan about 2 minute(s) to read this.
Weighted Random Early Detection is a Cisco-created algorithm used to monitor queue lengths, and preemptively discard packets in an effort to prevent the queue from getting full. WRED monitors a queue, and will discard more and more packets as the queue gets longer and longer. This tends to improve performance of TCP conversations when compared to waiting for a queue to fill and then tail-dropping.
WRED’s algorithm functions like this: using the “average queue depth”, WRED determines whether or not the queue has enough in it to begin discarding packets. If the average depth is above the maximum threshold, then WRED discards all packets…and while that might FEEL like tail-drop, it’s really called “full drop” in the context of WRED.
- Average depth < minimum threshold – no packets are dropped – “no drop”.
- Minimum threshold < average depth < maximum threshold – a percentage of packets are dropped, where drop increases from 0 to a max percent as average rises – “random drop”.
- Average depth > maximum threshold – all new packets are dropped – “full drop”.
The rate at which WRED discards packets is not linear as we move from the minimum threshold to maximum, 0% – 100%. Rather, there’s a discard of 0% at the minimum, then a slide up the scale to the “maximum discard percentage” value, where we’re at the maximum threshold. Once we’re at maximum though, then we’re doing full-drops. So, say your minimum threshold is 50 and your max is 100. And let’s say your “maximum discard percentage” is 20%. If your queue depth was 75 (halfway between our min and max, right?), then you’d be at a 10% discard rate (halfway between 0% and 20%). Once the queue fills though and we’re up to 100 packets in our queue, then WRED would start discarding everything, a “full drop”. Oh, and one other thing – that “max discard percentage” is tweakable. You can set the “mark probability denominator” or MPD. 1/MPD is the “max discard percentage”.
IPP and DSCP values affect WRED. WRED has different values for min/max/mpd, called a traffic profile.
- AFx1/DSCP, 33/min, 40/max, 10/mpd.
- AFx2/DSCP, 28/min, 40/max, 10/mpd.
- AFx3/DSCP, 24/min, 40/max, 10/mpd.
- EF, 37/min, 40/max, 10/mpd.
Note that most queuing tools do not support WRED. You can configure it in the following places:
- On a physical interface, assuming FIFO.
- On a non-LLQ class inside a CBWFQ policy map.
- On an ATM virtual circuit.
The “random-detect” command turns on WRED, using IPP by default. “random-detect dscp-based” turns on WRED using the DSCP profiles.
You can also tweak the moving average queue depth that WRED tracks with the “random-detect exponential-weighting-constant <exponent>” command.
Ethan Banks writes & podcasts about IT, new media, and personal tech.
about | subscribe | @ecbanks