WRED Summary

WRED provides a valuable tool for managing congestion in queues. Cisco IOS uses defaults that conform to the DiffServ Assured Forwarding conventions, which reduce the likelihood that you will need to configure thresholds for WRED. WRED can be particularly effective when used with MQC-based queuing tools, but when enabled directly on an interface, WRED has the unfortunate side effect of disallowing other queuing tools to be used. Table 6-8 lists some of WRED's key points.

Table 6-8 WRED Feature Summary

Feature

WRED

Discards packets to avoid congestion

Yes

Can be enabled on physical interface concurrently with a queuing tool

No

Can be combined with CBWFQ or LLQ policy map

Yes

Bases drop decision, at least in part, on different thresholds per precedence or DSCP value

Yes

Flow-Based WRED (FRED)

FRED uses flows to identify streams of traffic. A flow is a unidirectional sequence of packets between a source and destination that share the same protocol and transport layer information. The following seven fields are used to determine whether the received packet is a part of an existing flow:

• Source IP address

• Source port number

• Destination IP address

• Destination port number

• Layer 3 protocol

• IP precedence/DSCP marking

• Interface the packet is received on

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

Both WRED and FRED discard packets before tail drop is required, hoping to get the senders of the traffic to slow down, thereby reducing congestion. FRED, however, adds the goal of stopping TCP starvation by watching for hungry UDP flows that try to use too much of a queue. FRED aggressively discards these hungry UDP flows, termed nonadapative flows, preventing these flows from consuming too much of a queue.

To recognize nonadaptive flows, FRED classifies packets into flows. Then FRED classifies each flow into one of three FRED flow types, as listed in Table 6-9.

Table 6-9 FRED Flow Types

Flow Type

Description

Discard Policy

Robust

Adapts to lost packets by slowing down the rate of sending packets

TCP

Moderate discard rates

Fragile

Does not adapt to lost packets by slowing down, but the number of packets sent is not excessive

UDP

Low discard rates

Nonadaptive

Does not adapt to lost packets by slowing down, and the number of packets sent is excessive

UDP

High discard rates

Keep in mind that FRED specifically wants to defeat the UDP flows that consume too many queue entries. FRED still drops some packets from UDP flows when congestion occurs, based on normal WRED logic. For UDP flows, FRED simply decides which flows are taking too much of the queue, classifies these flows as nonadaptive, and discards packets in those flows more aggressively. For other UDP flows that FRED believes are not sending too many packets (fragile flows) FRED discards their packets less frequently.

NOTE UDP does not adapt to packet loss, so by definition, all UDP flows are nonadaptive. However, FRED uses the term "nonadaptive" to categorize those flows that are currently using too much of the queue.

The key to understanding how FRED works is to understand how FRED determines whether a particular UDP flow is fragile or nonadaptive. A couple of simple examples make the logic much more obvious. First, suppose FRED is enabled on a router's S0/0 interface, and the interface FIFO output queue has 40 queue entries maximum. At a particular point in time, 10 flows exist, 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 the queue 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 nonadaptive flows.

Suppose, for instance, that Flow 1 and Flow 2 both use UDP. Flow 1 has 3 packets in the FIFO output queue, and Flow 2 has 20 packets in the queue. At first glance, it seems that Flow 2 should be considered a nonadaptive flow, because it has many packets in the queue. The calculated value of 4 * 40/10 (scaling factor * maximum queue length/number of flows), or 16, is greater 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 is smaller than the number of packets in the queue that are part of Flow 2 (20 packets in the queue), so FRED considers Flow 2 to be nonadaptive.

The first example hides one subtlety in how FRED decides which UDP flows are fragile, and which 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 changes over time is the number of flows; the scaling factor remains static, as does the maximum queue length.) As the number of flows decreases, the threshold that determines whether a flow is nonadaptive increases. If Flow 2 still has 20 packets in the queue, Flow 2 would now be considered to be a fragile flow, with packets discarded less aggressively.

After FRED decides which flows are robust, fragile, and nonadaptive, FRED can apply WRED-like logic to decide whether to discard any packets at all, and if so, what percentage of the packets. 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 three types of flows is unlikely to be covered, because the coverage in the corresponding courses is also sketchy, or not even mentioned.

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

For nonadaptive flows, FRED lowers the maximum threshold. By doing so, FRED increases the packet discard rate more quickly. More importantly, lowering the maximum threshold for packets in the flow causes FRED to discard all packets for these nonadaptive flows more quickly than for fragile and robust flows, essentially preventing these flows from consuming the entire queue.

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

Table 6-10 lists the terms used by FRED to describe these processes.

Table 6-10 FRED Terminology

Term

Definition

Average per-flow queue size

A calculated value, based on the formula maximum queue size/ number of active flows.

Active flow

A flow that currently has packets in the queue.

Maximum per-flow queue size

A calculated value, based on the formula (average queue size * scaling factor). (This same formula is used in the previous example that results in an answer of 16.) This value is used to determine which flows are fragile, and which are nonadaptive.

Scaling factor

Number used in the calculation of maximum per-flow queue size, which may be changed using configuration.

Average depth factor

Another name for scaling factor.

Continue reading here: Congestion Avoidance Concepts and Random Early Detection RED

Was this article helpful?

+1 0