# WRED (Weighted Random Early Detection)

**URL:** https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130
**Category:** Lessons Discussion
**Created:** [October 9, 2018, 1:13pm UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130 "2018-10-09T13:13:04Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![ReneMolenaar](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/renemolenaar/32/488_2.png) [@ReneMolenaar](https://forum.networklessons.com/u/ReneMolenaar)
#### Post date: [October 9, 2018, 1:13pm UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/1 "2018-10-09T13:13:04Z")

</div>

This topic is to discuss the following lesson:

> **[WRED (Weighted Random Early Detection)](https://networklessons.com/cisco/ccie-routing-switching-written/wred-weighted-random-early-detection)**
>
> WRED (Weighted Random Early Detection) lets the router drop random packets to prevent tail drop. This improves throughput for TCP connections.

---

<div class="post-metadata">

### Author: ![sammiria801](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/s/53a042/32.png) [@sammiria801](https://forum.networklessons.com/u/sammiria801)
#### Post date: [January 25, 2019, 10:00pm UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/2 "2019-01-25T22:00:42Z")

</div>

Hello Rene,

Thank you very much for the lesson.

but I’m still a little bit confused, Please, correct me if I’m wrong:  
based on the command below if it’s set AF probability will be considered:  
`random-detect dscp-based`

now if we have AF21 and AF33 the class different but the probability of dropping packet from AF33 more than AF21, correct?  
what about if the packets AF21 and AF31? what about if we have AF21 and EF and CS3 and CS4?

also what is the meaning for fair-queue command? what is the impact when you are using it in the policy map?

Thank you,  
Samer Abbas

---

<div class="post-metadata">

### Author: ![sammiria801](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/s/53a042/32.png) [@sammiria801](https://forum.networklessons.com/u/sammiria801)
#### Post date: [January 25, 2019, 10:02pm UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/3 "2019-01-25T22:02:15Z")

</div>

Adding I’m looking for the drop probability for these Marking if they are in the same Policy Map with `random-detect dscp-based`

Thanks,  
Samer

---

<div class="post-metadata">

### Author: ![lagapidis](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/lagapidis/32/4949_2.png) [@lagapidis](https://forum.networklessons.com/u/lagapidis)
#### Post date: [January 28, 2019, 12:20pm UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/4 "2019-01-28T12:20:21Z")

</div>

Hello Samer

> [@sammiria801](#):
>
> now if we have AF21 and AF33 the class different but the probability of dropping packet from AF33 more than AF21, correct?

Class 4 has the highest priority, so if you have AF33, it will have a lower drop probability than AF21 for example. But within the same class, the higher the number the higher the drop probability, so AF13 will more likely be dropped compared to AF11. So yes, you are correct.

> [@sammiria801](#):
>
> what about if the packets AF21 and AF31?

AF31 is in a higher priority class than AF21, so AF 21 has the higher drop probability.

> [@sammiria801](#):
>
> what about if we have AF21 and EF and CS3 and CS4?

EF are also considered part of the DSCP based WREN procedure and are given an even higher priority than the AF markings. As for CS3 and CS4, they have a higher drop probability than the AF series of values.

Ultimately, when using the `random-detect dscp-based` command, you are telling the device to use the six bit DSCP value as the criteria for random drops. As Cisco documentation states, the “dscp-based argument enables WRED to use the DSCP value of a packet when calculating drop probability.” This means that the whole value (6 bits) is used, which means that CS, AF and EF values are considered in this calculation.

You are also able to optionally specify the minimum and maximum packet thresholds for the DSCP value using the `random-detect dscp` command.

More info can be found here:

> **[QoS: Congestion Avoidance Configuration Guide, Cisco IOS Release 12.4T -...](https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/qos_conavd/configuration/12-4t/qos-conavd-12-4t-book/qos-conavd-oview.html#GUID-654C88AF-0E34-4864-8526-93C6C3615F51)**
>
> Congestion Avoidance Overview

> [@sammiria801](#):
>
> also what is the meaning for fair-queue command?

The `fair-queue` command is used to implement Distributed WRED (DWRED). It’s a feature only available in the 7000 series routers. This specific command specifies the number of queues to be reserved for the specific traffic class. You can find out more about DWRED here:

> **[QoS: Congestion Avoidance Configuration Guide, Cisco IOS Release 15M&T -...](https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/qos_conavd/configuration/15-mt/qos-conavd-15-mt-book/qos-conavd-oview.html#GUID-E89670B1-9EFA-4DDD-8862-58818247DD94)**
>
> QoS: Congestion Avoidance Configuration Guide, Cisco IOS Release 15M&T-Congestion Avoidance Overview

I hope this has been helpful!

Laz

---

<div class="post-metadata">

### Author: ![jetti.ranganna123](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jetti.ranganna123](https://forum.networklessons.com/u/jetti.ranganna123)
#### Post date: [May 30, 2019, 6:44am UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/5 "2019-05-30T06:44:16Z")

</div>

Hi There,

can explain me the average size calculation in WRED. Is queue size calculated based on the bandwidth available to the specific queue or total available bandwidth of link ?

Regards,  
Ranganna

---

<div class="post-metadata">

### Author: ![lagapidis](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/lagapidis/32/4949_2.png) [@lagapidis](https://forum.networklessons.com/u/lagapidis)
#### Post date: [May 31, 2019, 5:16am UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/6 "2019-05-31T05:16:49Z")

</div>

Hello Ranganna

When WRED calculates the average queue size, it does so by calculating the actual size of the real queue. Specifically, the average is calculated periodically every few milliseconds. It uses the following formula:

![image](https://cdn-forum.networklessons.com/uploads/default/original/2X/4/49dee3e66a13cca56dab8dce4c14e612f03c090d.png)

- **o** is the old average calculated the previous time
- **n** is the weight factor you configure
- **c** is the current queue size

The maximum size of the physical queue will depend on what kind of interface we’re talking about and what platform it is functioning on.

I hope this has been helpful!

Laz

---

<div class="post-metadata">

### Author: ![staut\_stefanita](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/staut_stefanita/32/1652_2.png) [@staut\_stefanita](https://forum.networklessons.com/u/staut_stefanita)
#### Post date: [July 16, 2019, 9:05pm UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/7 "2019-07-16T21:05:56Z")

</div>

Hello,

Perhaps a note would be useful informing that the instantaneous queue depth is used for the tail drop (Exponential Weighting Constant chapter).

Also in the formula for the average queue depth:  
the (instantaneous\_old\_average) should be change into (instantaneous - old\_average)

Many thanks,  
Stefanita

---

<div class="post-metadata">

### Author: ![ReneMolenaar](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/renemolenaar/32/488_2.png) [@ReneMolenaar](https://forum.networklessons.com/u/ReneMolenaar)
#### Post date: [July 18, 2019, 12:51pm UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/8 "2019-07-18T12:51:19Z")

</div>

Thanks Stefanita. I fixed this and added something about the instantaneous queue depth.

Rene

---

<div class="post-metadata">

### Author: ![robbo7987](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/r/a8b319/32.png) [@robbo7987](https://forum.networklessons.com/u/robbo7987)
#### Post date: [April 8, 2020, 9:52am UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/9 "2020-04-08T09:52:14Z")

</div>

Hi,

Is the MPD the number of packets that will be dropped (1 in 4 in the lesson for 25%) before we reach the maximum threshold then everything is dropped?  
So 25% MPD means 1 out of 4 packets will be dropped to start with when the minimum threshold has been breached and does it continue like that until the max threshold has been reached then all packets are dropped? So the higher the number of packets the average queue depth rises but the drop rate is still 1 in 4 until the max threshold has been reached then everything dropped?

And also…Is the number of packets configured in the thresholds the amount of packets in the queue when there is congestion in the queue?

Thanks again

---

<div class="post-metadata">

### Author: ![lagapidis](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/lagapidis/32/4949_2.png) [@lagapidis](https://forum.networklessons.com/u/lagapidis)
#### Post date: [April 8, 2020, 1:53pm UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/10 "2020-04-08T13:53:32Z")

</div>

Hello Michael

Let me answer your last question first:

> [@robbo7987](#):
>
> And also…Is the number of packets configured in the thresholds the amount of packets in the queue when there is congestion in the queue?

The thresholds can be defined either as number of packets, bytes, or even milliseconds, all three of which can define the “fullness” of a queue. But keep in mind that **queues will only exist when there is congestion**. If there is no congestion, there is no queue, and there are actually no active QoS mechanisms. If there’s no congestion, every single packet that arrives at the interface is served immediately. So, the thresholds define the average number of packets (bytes/milliseconds) in the queue, a value which will be greater than zero only when there is congestion.

> [@robbo7987](#):
>
> Is the MPD the number of packets that will be dropped (1 in 4 in the lesson for 25%) before we reach the maximum threshold then everything is dropped?

To be more precise, the MPD is the **maximum** percentage of packets that will be dropped as the average queue depth **approaches the maximum threshold**.

Remember that the discard probability is a function of the current average depth of the queue:

- For values between 0 and the minimum threshold, **discard probability is zero**
- For values between minimum and maximum threshold, the **discard probability ranges linearly between 0% and the MPD value.**
- For values above the maximum threshold, **discard probability is 100%**

So a discard probability of MPD **is approached as the average queue depth approaches the maximum threshold**.

One of the things that confused me initially was my interpretation of graphs like this:

 ![image](https://cdn-forum.networklessons.com/uploads/default/original/2X/4/42dacec80f460ffac420e93d23774186f0abb235.png)  
We are so used to interpreting the X axis as time, so for me it was strange that the discard probability stays at 100% to infinity. But remember, that over time, the average queue depth continually changes, up and down, so over time, you continually go back and forth on the curve (the green line) in the graph.

So you can see how the discard probability changes over time, as the average queue depth changes. The thresholds and the MPD are simply parameters that are used to define the graph, and ultimately the behaviour of the mechanism.

I hope this has been helpful!

Laz

---

<div class="post-metadata">

### Author: ![robbo7987](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/r/a8b319/32.png) [@robbo7987](https://forum.networklessons.com/u/robbo7987)
#### Post date: [April 8, 2020, 6:26pm UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/11 "2020-04-08T18:26:16Z")

</div>

Hi Laz,

I think i understand what you mean now. So 25% for example in the lesson is the maximum amount of packets (1 in every 4) that will be dropped before the average queue depth reaches its threshold and then drops all packets.  
So for example, the green line could be in the middle at around 12-13% discard probability and so that doesn’t mean that 1 in every 4 packets will be discarded, it could be 1 in every 8 because it’s half way and hasn’t approached the maximum MPD yet?

Thanks again

---

<div class="post-metadata">

### Author: ![lagapidis](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/lagapidis/32/4949_2.png) [@lagapidis](https://forum.networklessons.com/u/lagapidis)
#### Post date: [April 9, 2020, 7:25am UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/12 "2020-04-09T07:25:41Z")

</div>

Hi Michael

> [@robbo7987](#):
>
> I think i understand what you mean now. So 25% for example in the lesson is the maximum amount of packets (1 in every 4) that will be dropped before the average queue depth reaches its threshold and then drops all packets.

Yes, that’s it exactly, you got it. The number of packets that will be dropped changes depending on how the average bit depth changes over time.

> [@robbo7987](#):
>
> So for example, the green line could be in the middle at around 12-13% discard probability and so that doesn’t mean that 1 in every 4 packets will be discarded, it could be 1 in every 8 because it’s half way and hasn’t approached the maximum MPD yet?

Exactly!

I’m glad this has been helpful!

Laz

---

<div class="post-metadata">

### Author: ![robbo7987](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/r/a8b319/32.png) [@robbo7987](https://forum.networklessons.com/u/robbo7987)
#### Post date: [April 10, 2020, 2:04pm UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/13 "2020-04-10T14:04:29Z")

</div>

Hi,

In the lesson its mentioned that the ICMP packets won’t be shaped, why? Is this because the class-default does not trigger on ICMP packets (I know this is the behaviour of the ASA’s but so sure with IOS).  
And it’s also mentioned in the lesson that WRED only works with TCP but ICMP packets are being dropped to. Could you maybe shed some light on this?

Thanks

---

<div class="post-metadata">

### Author: ![lagapidis](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/lagapidis/32/4949_2.png) [@lagapidis](https://forum.networklessons.com/u/lagapidis)
#### Post date: [April 13, 2020, 6:45am UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/14 "2020-04-13T06:45:51Z")

</div>

Hello Michael

In the lesson, Rene states that:

> Since my pings use ICMP it won’t slow down R1’s traffic rate…

The statement “slow down R1’s traffic rate” is not referring to shaping, but to the TCP slow start process. So since ICMP uses UDP and is not involved in any TCP sessions, sending these ICMP packets **will not contribute to the triggering of any slow start mechanism**.

> [@robbo7987](#):
>
> And it’s also mentioned in the lesson that WRED only works with TCP but ICMP packets are being dropped to. Could you maybe shed some light on this?

The random drops that WRED executes are **applied to all traffic**. WRED **does not distinguish between TCP and UDP traffic**. However, the goal of WRED is to discard random packets (many of which belong to TCP sessions) in order to slow down the TCP sessions in such a way as to avoid TCP global syncrhonization.

Now it is up to the network designer to examine the type of traffic that exists on the network, and to determine if WRED is indeed useful for the network or not. If most traffic is not TCP, then WRED will not be of any benefit. If there is substantial TCP traffic however, it is definitely useful.

I hope this has been helpful!

Laz

---

<div class="post-metadata">

### Author: ![TechnologyOperationT](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/technologyoperationt/32/3279_2.png) [@TechnologyOperationT](https://forum.networklessons.com/u/TechnologyOperationT)
#### Post date: [April 24, 2020, 9:36pm UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/15 "2020-04-24T21:36:59Z")

</div>

Hi,

I have one question in regards to use the ping with datagram size. How would Rene know that if he specify the datagram size to 160 there won’t be any tail drop but if it’s 170 there will be? Of course, based on his setup.

Thanks,  
Helen

---

<div class="post-metadata">

### Author: ![lagapidis](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/lagapidis/32/4949_2.png) [@lagapidis](https://forum.networklessons.com/u/lagapidis)
#### Post date: [April 27, 2020, 5:46am UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/16 "2020-04-27T05:46:43Z")

</div>

Hello Helen

The quick answer is that he doesn’t. During the making of this lesson, he had to experiment to find what ping sizes would bring about the results he wanted, so that the output would be meaningful and show the mechanisms in action.

Unlike the Windows or Linux operating systems, the ping function on Cisco devices will send the next echo request as soon as the echo response is received from the previous one. This means that the actual data rate the ping produces depends on the round trip time, and will thus be variable. After trial and error, he found that using a byte size of 160 didn’t have tail drops, while a higher value did.

I hope this has been helpful!

Laz

---

<div class="post-metadata">

### Author: ![rodriarz](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/r/50afbb/32.png) [@rodriarz](https://forum.networklessons.com/u/rodriarz)
#### Post date: [June 30, 2021, 9:01pm UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/17 "2021-06-30T21:01:38Z")

</div>

Hello  
this statement is not clear to me.  
_When a queue is full, there is no room for any more packets and the router drops all packets. This is called tail drop._

When we have a tail drop, all the packets in the queue are dropped? or just those that are in the tail of the queue?  
Regards  
Rodrigo

---

<div class="post-metadata">

### Author: ![lagapidis](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/lagapidis/32/4949_2.png) [@lagapidis](https://forum.networklessons.com/u/lagapidis)
#### Post date: [July 2, 2021, 5:26am UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/18 "2021-07-02T05:26:38Z")

</div>

Hello Rodrigo

When a queue is full, the router doesn’t drop all the packets in the queue but drops **any additional packets attempting to be sent**. I’ll ask Rene to reword this in the lesson to make it clearer.

I hope this has been helpful!

Laz

---

<div class="post-metadata">

### Author: ![Networking\_heart](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/n/9e8a1a/32.png) [@Networking\_heart](https://forum.networklessons.com/u/Networking_heart)
#### Post date: [August 6, 2021, 7:25am UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/19 "2021-08-06T07:25:36Z")

</div>

Hi Rene/Networklessons Team,

I’m new joiner here just now.  
I wondering if we have topic here for QoS in Nexus 7K.

TIA

---

<div class="post-metadata">

### Author: ![lagapidis](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/lagapidis/32/4949_2.png) [@lagapidis](https://forum.networklessons.com/u/lagapidis)
#### Post date: [August 8, 2021, 8:08am UTC](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130/20 "2021-08-08T08:08:35Z")

</div>

Hello Levisle

Great to have you with us! We hope you’re finding the site useful.

The content on the site is centered around the Cisco certifications which primarily focus on Cisco IOS, so we don’t have much content on Nexus devices.

However, if this is content that you would like to see on the site in the future, feel free to let us know at the Member Ideas page below. You may find that others have also made similar suggestions, and you can add your voice to theirs.

> **[Lesson Ideas - NetworkLessons.com](https://networklessons.com/lesson-ideas)**
>
> This page allows networklessons members to share what content they would like to see in the future.

In the meantime, take a look at this Cisco documentation that may help you in what you are attempting to do.

> **[Cisco Nexus 7000 Series NX-OS Quality of Service Configuration Guide 7.x](https://www.cisco.com/c/en/us/td/docs/switches/datacenter/sw/nx-os/qos/configuration/guide/b-Cisco-Nexus-7000-Series-NX-OS-QOS-Configuration-Guide.html)**
>
> Cisco Nexus 7000 Series NX-OS Quality of Service Configuration Guide 7.x

I hope this has been helpful!

Laz

[Next page](https://forum.networklessons.com/t/wred-weighted-random-early-detection/5130.md?page=2)
