RED random early detection
Random Early Detection (RED) is a congestion control mechanism used in computer networks to manage the flow of data packets. It is primarily employed in network devices such as routers to prevent congestion and ensure efficient network performance. RED operates by selectively dropping or marking packets before the network becomes congested, thus providing feedback to the data sources to adjust their transmission rates.
The main objective of RED is to maintain low network latency and avoid packet loss by proactively managing congestion. It achieves this by monitoring the length of the queue in the network device, which represents the number of packets waiting to be transmitted. When the queue length exceeds a predefined threshold, RED takes action to reduce the congestion.
Here's how RED works in detail:
- Queue Length Monitoring: The RED mechanism continuously monitors the length of the queue in the network device. It tracks the average queue length over a period of time using a weighted moving average or other statistical methods.
- Minimum and Maximum Thresholds: RED sets two threshold values: a minimum threshold (MinTh) and a maximum threshold (MaxTh) for the queue length. These thresholds define the acceptable range of queue lengths. If the queue length is below the minimum threshold, no action is taken. If it exceeds the maximum threshold, it indicates severe congestion, and RED responds by dropping or marking packets indiscriminately.
- Dropping Probability: Between the minimum and maximum thresholds, RED determines a dropping probability for each incoming packet. The dropping probability is calculated based on the current queue length and a configured set of parameters such as maximum threshold, average queue length, and scaling factors. The purpose of this dropping probability is to selectively discard packets before congestion becomes severe.
- Random Dropping: RED introduces randomness into the dropping process to avoid synchronized congestion collapse. Instead of dropping packets in a deterministic manner, RED randomly selects packets to be dropped based on the calculated dropping probability. This randomness helps prevent all flows from experiencing significant packet loss at the same time, which could worsen congestion.
- Marking: In addition to dropping packets, RED can also mark packets by setting a specific bit or modifying the packet header. Marking packets instead of dropping them allows feedback to be provided to the data sources without actually discarding the packets. The marked packets can then be given lower priority during transmission or subjected to other forms of handling at subsequent network devices.
- Explicit Congestion Notification (ECN): RED can also work in conjunction with the ECN mechanism. ECN enables network devices to inform the sending hosts about network congestion without dropping or marking packets. Instead, the ECN-capable network devices set a specific flag in the packet header to indicate congestion. The sender can then respond by reducing its transmission rate.
By employing RED, network devices can effectively manage congestion by selectively discarding or marking packets based on the observed queue length. This mechanism helps regulate traffic flow, prevent congestion collapse, and maintain a high level of network performance.