The following WRED operation graph describes the interaction of the previously described variables in the operation of WRED. When a packet arrives at a device, if Current-Q-Size is below the configured Min-Q-Threshold, the packet is accepted. If the Current-Q-Size is above the Max-Q-Threshold, the packet is dropped. If the Current-Q-Size falls between the Min-Q-Threshold and Max-Q-Threshold, the packet is dropped according to the calculated probability Pdrop described in the following "Calculating packets that are dropped " section.
The algorithm first calculates the avg-q-size through the following equation.
avg-q-size = [(1 - Wq) × Statistical Average-Q-Size)] + (Wq × Current-Q-Size)
The user-configured Wq value is instrumental to the calculation and can be:
Lower Wq values cause the avg-q-size to lean towards the statistical average queue size, reducing WRED's sensitivity to the current state of the queue and thus reducing WRED's effectiveness. On the other hand, higher Wq values cause the avg-q-size to lean towards the instantaneous queue size, which exposes WRED to any change in the instantaneous queue size and thus may cause WRED to overreact in cases of bursts. Thus, the value of Wq should be carefully chosen according to the application at hand.
The Pdrop value, as calculated in the following equation, is the probability that a packet will be dropped in a congested device.
Pdrop = Drop-Probability * (Current-Q-Size/Queue-Size - Min-Q-Threshold) / (Max-Q-Threshold - Min-Q-Threshold)