# Weighted random early detection

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Weighted_random_early_detection
> Markdown URL: https://mediated.wiki/source/Weighted_random_early_detection.md
> Source: https://en.wikipedia.org/wiki/Weighted_random_early_detection
> Source revision: 1192618787
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Network queueing discipline for congestion avoidance}}
'''Weighted random early detection''' ('''WRED''') is a queueing discipline for a [network scheduler](/source/network_scheduler) suited for [congestion avoidance](/source/Network_congestion_avoidance).<ref>{{cite web |url=https://www.cisco.com/c/en/us/td/docs/ios/12_2/qos/configuration/guide/fqos_c/qcfconav.html |title=Congestion Avoidance Overview |publisher=Cisco |accessdate=2014-02-28 |archive-url=https://web.archive.org/web/20140228234024/https://www.cisco.com/c/en/us/td/docs/ios/12_2/qos/configuration/guide/fqos_c/qcfconav.html |archive-date=28 February 2014 |url-status=dead}}</ref> It is an extension to [random early detection](/source/random_early_detection) (RED) where a single queue may have several different sets of queue thresholds. Each threshold set is associated to a particular [traffic class](/source/Traffic_shaping).

For example, a queue may have lower thresholds for lower priority packet. A queue buildup will cause the lower priority packets to be dropped, hence protecting the higher priority [packets](/source/network_packet) in the same queue. In this way [quality of service](/source/quality_of_service) prioritization is made possible for important packets from a pool of packets using the same buffer.<ref>{{cite web |url=https://www.cisco.com/en/US/docs/ios/12_0t/12_0t5/feature/guide/cbwfq.html |title=Class-Based Weighted Fair Queueing and Weighted Random Early Detection |publisher=Cisco |accessdate=2020-05-07}}</ref>

It is more likely that standard traffic will be dropped instead of higher prioritized traffic.

== Restrictions ==
On Cisco switches WRED is restricted to
* [TCP/IP](/source/TCP%2FIP) traffic. Only this kind of traffic indicates congestion to the sender to enable a reduction of the transmission rate.
Non-IP traffic will be dropped more often than TCP/IP traffic because it is treated with the lowest possible precedence.

== Functional Description ==
WRED proceeds in this order when a packet arrives:
* Calculation of the average queue size.
* The arriving packet is queued immediately if the average queue size is below the minimum queue threshold.
* Depending on the packet drop probability the packet is either dropped or queued if the average queue size is between the minimum and maximum queue threshold.
* The packet is automatically dropped if the average queue size is greater than the maximum threshold.

=== Calculation of average queue size ===
The average queue size depends on the previous average as well as the current size of the queue. The calculation formula is given below:

<math> avg= o*(1-2^{-n}) + c*(2^{-n})\,\!</math>

where <math>n</math> is the user-configurable exponential weight factor, <math>o</math> is the old average and <math>c</math> is the current queue size. The previous average is more important for high values of <math>n</math>. Peaks and lows in queue size are smoothed by a high value. For low values of <math>n</math>, the average queue size is close to the current queue size.

==References==
{{Reflist}}

Category:Network performance

---
Adapted from the Wikipedia article [Weighted random early detection](https://en.wikipedia.org/wiki/Weighted_random_early_detection) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Weighted_random_early_detection?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
