Saturday, November 12, 2005

Flow-based WRED and WRED

FRED overcomes the problem of TCP starvation. When nonadaptive flows (UDP) compete with adaptive flows (TCP), WRED discards packetsfrom all the flows. However, only the TCP flows adapt, sending less traffic into the network, butUDP flows do not slow down. Queues can become filled with packets from large-volume UDPflows, causing the TCP flows to get progressively less queue space. This phenomenon is calledTCP starvation.

Firstly, FRED classifies eachflow into one of three FRED flow types:
1. Robust flows, which on average have a uniform data rate and slow down in response to congestion (TCP)
2. Fragile flows, which does not adapt to lost packets byslowing down, but the number of packetssent is not excessive (UDP)
3. Nonadaptive flows, which does not adapt to lost packets byslowing down, and the number ofpackets sent is excessive (UDP)

For UDP flows, FRED simply decides which flows are taking toomuch of the queue, classifies these flows as nonadaptive, and discards packets in those flowsmore aggressively. For other UDP flows that FRED believes are not sending too many packets(fragile flows) FRED discards their packets less frequently.

The key to understanding how FRED works is to understand how FRED determines whether aparticular UDP flow is fragile or nonadaptive. A couple of simple examples make the logicmuch more obvious. First, suppose FRED is enabled on a router’s S0/0 interface, and the interfaceFIFO output queue has 40 queue entries maximum. At a particular point in time, 10 flowsexist, called Flow 1, Flow 2, and so on. (Keep in mind that FRED only supports FIFO Queuing.)With a maximum queue depth of 40, and 10 flows, you can think of each flow’s fair share of thequeue space to be 40/10, or 4, in this case. FRED multiplies this fair share by a scaling factor,which defaults to 4. The scaling factor is used so that each flow has some capability to burst.This final number, 16 in this case, is the dividing line between fragile flows and nonadaptiveflows.

Suppose, for instance, that Flow 1 and Flow 2 both use UDP. Flow 1 has 3 packets in the FIFOoutput queue, and Flow 2 has 20 packets in the queue. At first glance, it seems that Flow 2should be considered a nonadaptive flow, because it has many packets in the queue. The calculatedvalue of 4 * 40/10 (scaling factor * maximum queue length/number of flows), or 16, isgreater than the number of packets in the queue that are part of Flow 1 (3 packets in the queue).

Therefore, FRED considers Flow 1 to be a fragile flow. Similarly, the calculated value of 16 issmaller than the number of packets in the queue that are part of Flow 2 (20 packets in thequeue), so FRED considers Flow 2 to be nonadaptive.

The first example hides one subtlety in how FRED decides which UDP flows are fragile, andwhich are nonadaptive. Consider the same example, but suppose now that only five flows exist.The formula works out to be 4 * 40/5 = 32. (Notice that the only part of the formula that changesover time is the number of flows; the scaling factor remains static, as does the maximum queuelength.) As the number of flows decreases, the threshold that determines whether a flow isnonadaptive increases. If Flow 2 still has 20 packets in the queue, Flow 2 would now beconsidered to be a fragile flow, with packets discarded less aggressively.

After FRED decides which flows are robust, fragile, and nonadaptive, FRED can apply WREDlikelogic to decide whether to discard any packets at all, and if so, what percentage of thepackets. Frankly, the published details on how FRED determines the flows are sketchy at best.For you QoS exam takers, the following details about how FRED discards packets for the threetypes of flows is unlikely to be covered, because the coverage in the corresponding courses isalso sketchy, or not even mentioned.

For robust and fragile flows, FRED acts just like WRED in terms of packet discard. FRED stilluses the per-precedence or per-DSCP minimum threshold, maximum threshold, and MPD todetermine when to discard packets, and how many. You can override the default values for eachprecedence or DSCP value through configuration, just like with WRED.

For nonadaptive flows, FRED lowers the maximum threshold. By doing so, FRED increases thepacket discard rate more quickly. More importantly, lowering the maximum threshold for packetsin the flow causes FRED to discard all packets for these nonadaptive flows more quicklythan for fragile and robust flows, essentially preventing these flows from consuming the entirequeue.

To get a full sense of what happens to nonadaptive flows, consider the following example. Fornonadaptive flows, FRED reduces the maximum threshold used for the flow by half of thedifference between the maximum and minimum thresholds. FRED and WRED use defaults forprecedence 0 as follows: minimum threshold 20, maximum threshold 40, drop percentage 10percent (MPD=10). FRED reduces the maximum threshold for a precedence 0 nonadaptiveflow to 30, because the difference between the maximum and minimum is 20, and half of thatis 10. By reducing the maximum threshold by half of the difference between the minimum andmaximum, FRED increases the packet discard rate more quickly as the average queue depthnears 30. Most importantly, FRED discards all packets for these nonadaptive precedence 0flows when the average queue depth reaches 30, preventing these flows from taking over theentire queue.

No comments: