In the last chapter, we introduced the queues and congestion management. The queues helps buffering the packets when the packet rate exceeds the interface bandwidth or the bandwidth allocated to the queue that buffers packets. The queuing technology is not a good solution if the congestion becomes worse. So that the congestion avoidance is introduced.
Congestion avoidance is a flow control technique used to relieve network overload. By monitoring the usage of network resources for queues or memory buffers, a device automatically drops packets that shows a sign of traffic congestion.
Huawei routers support two drop policies: Tail drop and Weighted Random Early Detection (WRED).
Tail drop is a simple way. It drops the newly arrived packets when congestion occures. As every sword has two blades, there is a huge disadvantage if the tail drop is enabled, which is TCP global synchronization.
As known, TCP is a reliable protocol, there is a mechanism called sliding window. When the source detects the massive of packets loss in a short time, it will reduce the window size to ease the congestion. After the network recovers from the congestion, device increase the window size, which casing the congestion again. The behavior cycles contantly. This phenomenon, called TCP global sychronization, servely reducing the network usage.
![]()
Besides the tail drop, another drop policy called WRED is more reasonable.
WRED is a congestion avoidance mechanism used to drop packets before the queue overflows. WRED resolves TCP global synchronization by randomly dropping packets to prevent a burst of TCP retransmission. If a TCP connection reduces the transmission rate when packet loss occurs, other TCP connections still keep a high rate for sending packets. The WRED mechanism improves the bandwidth resource usage.
WRED sets lower and upper thresholds for each queue and defines the following rules:
1. When the length of a queue is lower than the lower threshold, no packet is dropped.
2. When the length of a queue exceeds the upper threshold, all newly arrived packets are tail dropped.
3. When the length of a queue ranges from the lower threshold to the upper threshold, newly arrived packets are randomly dropped, but a maximum drop probability is set. The maximum drop probability refers to the drop probability when the queue length reaches the upper threshold.
WRED delivers a random value i to each arrived packet, (0 < i% < 100%), and compares the random value with the drop probability of the current queue. Supposing the drop paobability is x when the queue length is m. If the random value i ranges from 0 to x, the newly arrived packet is dropped; if the random value ranges from x to 100%, the newly arrived packet is not dropped.
Some guys might be confuessed, why the lower drop probability packets are droped while higher drop probability packets are not.
![]()
As the picture above shows, when i>x, the pacekt is not droped. The range of T1 will decrease when the x increase, so the probability of the random number i locates in the range of T1 reduced.
In another word, the higher of the drop probability(x), the higher probability of the packets droped.
From the picture, we can get other conclusions.
1. The longer of the queue length, the drop probability is higher.
![]()
2. The higher drop probability configured, the higher drop probability of the packets.
![]()
In actual applications, the WRED lower threshold is recommended to start from 50% and change with the drop precedence. As shown in Figure 5, a lowest drop probability and highest lower and upper thresholds are recommended for green packets; a medium drop probability and medium lower and upper thresholds are recommended for yellow packets; a highest drop probability and lowest lower and upper thresholds are recommended for red packets. When traffic congestion intensifies, red packets are first dropped due to low lower threshold and high drop probability. As the queue length increases, the device drops green packets at last. If the queue length reaches the upper threshold for red/yellow/green packets, red/yellow/green packets respectively start to be tail dropped.
As the picture below shows:
![]()
