Weighted Random Early Detection (WRED)
WRED is a method of congestion avoidance which manages and slows down TCP flows to prevent them from congesting a link.
Tail Drops are packets which are dropped when the queues are full, if trail drops occur then multiple packets usually get dropped this causes TCP to slow down considerably. It is more efficient to discard fewer packets before the queue gets full rather than have packets being tail dropped, WRED achieves this.
WRED looks at the average queue depth and compares this to the minimum & maximum queue depth. If the average queue depth stays below the minimum queue depth no packets will be dropped, but likewise if it goes past the maximum queue depth all packets will be dropped, this is called full drop and is different to tail drop as the buffers are not full but it works in a similar way. If the average queue depth is between the minimum & maximum queue depths then it will drop a percentage of packets from 0 to a maximum percent. The maximum percent to drop is defined in the Mark Probability Denominator (MPD), the simple formula is;
Drop % = 1 / MPD
For IPP 0 traffic the MPD defaults to 10, which results in a maximum of 10% (10% = 1 / 10) of the traffic being dropped between the minimum & maximum threshold, remember that if the average queue depth exceeds the the maximum threshold it will always drop 100% of the traffic. I have created a graph showing this below;
Not all queuing methods support WRED so it can only be configured on a physical interface (with FIFO), on a non LLQ class inside a CBWFQ policy map, or on an ATM VC.
WRED is configured on a physical interface or in a class within a policy map with the random-detect command. By default WRED will only look at IPP and not DSCP but we can use the random-detect dscp-based command to tell WRED to look at DSCP instead of IPP.
By default WRED will also respect the drop probability set in the DSCP value for Assured Forwarding by changing the default minimum drop threshold depending upon the drop proabibiltiy.
The WRED settings for each IPP or DSCP value can be changed with either of the following commands;
Random-detect precedence precedence-value min-threshold max-threshold [mark-probability-denominator]
Random-detect dscp dscp-value min-threshold max-threshold [mark-probability-denominator]
We can also change part of the WRED calculation which changes the formula for the rolling average queue depth, this is called the exponential weighting constant and changed with the command random-detect exponential weighting-constant exponent. Setting it to a high value makes the changing average move slower, and setting it to a low value makes it a quicker changing value, its not recommended that this is changed.