5.2 Congestion Avoidance

TCP decrease the rate at which packets are transmitted when packet loss takes place. The TCP header contains a field that numbers or marks every TCP sequence number, or segment. A different field in the TCP header is used to indicate that the packet was received. This is indicated by the acknowledgement number. When an acknowledgment is not received or the recipient of the packets indicates that the packet was not received, the sender reduces the rate at which packets are transmitted. The sender also resends the packet. Congestion Avoidance QoS tools depend on the manner in which TCP operates to decrease congestion. Congestion avoidance QoS tools deliberately drop some packets that in turn actually force the TCP senders of packets to reduce the rate at which packets are transmitted. This in turn reduces congestion.

TCP has two individual window sizes that it uses for establishing the uppermost window size of data. This uppermost window size of data is the amount of data that can be transmitted prior to its sender pausing and expecting an acknowledgement. The Receiver Window or Advertised Window is the window field in the TCP header that is used to specify the number of bytes of data that the receiver permits the sender to transmit. This window is relayed among the sender and the receiver. Acknowledgments are received by the sender before an entire window of traffic is transmitted. The receiver window stops the sender from transmitting data at a speed that the receiver cannot handle.

The TCP sender computes the Congestion Window, or CWND, as specified in RFC 2581. This window is not transmitted among the parties as the receiver window is, but responds to network congestion by permitting the sender to reduce the rate of sending packets. CWND differs in size quite faster than the advertised window. RED uses this inconsistency of the CWND when it responds to packet lost.

CWND is moved up according to the TCP congestion avoidance algorithm and the TCP slow start algorithm. These two algorithms function in union. CWND is moved down based on packets that are lost. Prior to a segment being lost, the slow start threshold (SSTHRESH) is placed at half the value of CWND, or 50 percent. The TCP sender lowers CWND to the size of one segment size of the window when it does not obtain an acknowledgement in a specified period of time. This process is referred to as slamming the window shut or slamming the window. Slow start determines the speed at which CWND increases to the point that it reaches the SSTHRESH value. This growth process is fairly quick. Once this process is finished, congestion avoidance determines the rate of CWND's enlargement once it is greater than SSTHRESH. At this point the rate of CWND growth is much slower.

A large number of TCP connections can experience packet loss at nearly the same time. In this instance, the lessening and increasing of the CWND value at approximately the exact time results in the synchronization of TCP connections. This is referred to as global synchronization. The supplied rate consistently drops when synchronization takes place. As a result, the router does not completely utilize the link bandwidth. WRED can decrease global synchronization considerably if it is applied to the tail dropping interface. WRED makes it possible for the output rate to move towards the line rate. This enhances throughput and reduces packet loss.

UDP traffic requires a lower amount of bandwidth when compared to the bandwidth that TCP requires. However, when TCP responds to packets being lost, UDP tends to consume an inconsistent amount of bandwidth. Because the TCP senders reduce the rate of transmitting packets when congestion takes place, UDP senders can utilize more bandwidth. Remember that UDP senders do not reduce the rate of sending when congestion occurs. In addition to this, UDP applications that consume vast amounts of bandwidth can lead to a queue being full. This could lead to TCP packets being tail dropped. These processes just described that result in the output queues tail dropping TCP packets, and being filled with UDP packets, are referred to as TCP starvation.

5.2.2 Random Early Detection (RED)

RED was never deployed in IOS and IOS does not support RED. IOS does however support Weighted RED (WRED) and Flow Based WRED (FRED). RED identifies congested queues prior to them filling and then randomly selects the packets to be dropped once it is determined that some packets should be dropped. RED therefore prevents tail dropping and synchronization.

To achieve this, RED must be able to identify the circumstances under which packets must be discarded and determine the number of packets to drop under these circumstances. RED calculates the average queue depth because the average transforms at a slower pace than the actual queue depth. The average queue depth is evaluated against the minimum threshold and the maximum threshold.

  • When the average queue depth is less than the minimum threshold, no packets are discarded.

  • When the average queue depth is between the minimum threshold and maximum threshold, a percentage of packets are discarded by RED. As the average queue depth approaches the maximum threshold, more packets are discarded. The percentage of packets dropped moves from zero to the maximum percentage of packets discarded as congestion increases. The maximum percentage of packets dropped can be defined by specifying the mark probability denominator (MPD). IOS uses 1/MPD to compute the MPD.

  • When the average queue depth is greater than the maximum threshold, every new packet is dropped. The algorithm used to determine the average queue depth is:

New Average Depth = (Old Average Depth x (1 - 2"")) + (Current Queue Depth x 2"n)

The value of n can be modified. This is done by adjusting the exponential weighting constant setting. When the value is small, the average depth transforms faster than when the value is big.

5.2.3 Weighted RED (WRED)

WRED operates almost exactly like RED. The only difference is that WRED weights its performance on a packet's IP precedence and DCSP values. When WRED is enabled on an interface, no queuing tool can be enabled on the exact same interface at the same time. Only the FIFO queuing logic can be used on a single FIFO output queue on the interface that WRED is enabled. Before WRED places a packet into the FIFO output queue, WRED first determines if the packet should be discarded. WRED can however be used with separate class queues when MQC is used for configuring the queuing tool. CBWFQ and LLQ are the queuing tools that can utilize WRED. These queuing tools should be configured first, and WRED should be enabled within each class. When WRED is enabled with CBWFQ, WRED calculates its average queue depth on every individual class for the single FIFO queue within that class. Therefore, WRED operates differently on each individual class. Each class of CBWFQ has one FIFO queue in the class. WRED does not need to be enabled for all the CBWFQ classes.

WRED uses the following elements when it weights packets:

  • Average Queue Depth: This value is evaluated against the minimum and maximum thresholds.

  • Minimum and Maximum Thresholds: A percentage of packets are dropped when the average queue depth is between the minimum and maximum thresholds.

  • Mark Probability Denominator (MPD): When the average queue depth moves above the maximum threshold, WRED begins dropping a percentage of packets. This percentage is determined by the MPD setting.

WRED calculates the average queue depth in the same manner as RED does. WRED weights according to the IP precedence and DSCP values and sets the minimum threshold value, the maximum threshold value, and the MPD value to differing values for each IP precedence and DSCP value. When WRED has to drop packets, it drops packets according to the IP precedence and DSCP values. WRED would therefore commence dropping precedence 0 packets prior to dropping precedence 1 packets. The rate of dropping packet precedence 0 packets increases more rapidly than the rate of dropping the precedence 1 packets.

IOS default values for WRED settings are displayed below. The maximum drop percentage value is 10 percent in each instance.

The Default IP precedence and DSCP values for WRED

IP precedence

Min Threshold

Max Threshold

MPD

0

20

40

10

1

22

40

10

2

24

40

10

3

26

40

10

4

28

40

10

5

31

40

10

6

33

40

10

7

35

40

10

Resource Reservation Protocol

37

40

10

(RSVP)

DSCP

Min Threshold

Max Threshold

MPD

AF11, AF21, AF31, AF41

33

40

10

AF12, AF22, AF32, AF42

28

40

10

AF13, AF23, AF33, AF43

24

40

10

EF

37

40

10

When the above defaults settings are used, WRED does not need lots of configuration.

The following commands are used for configuring WRED:

  • random-detect [dscp-based | prec-based]: Used in interface or class configuration mode, this command is used to enable WRED.

  • random-detect [attach group-name]: This command is used in interface configuration mode to enable WRED per Virtual Circuit (VC) on ATM interfaces. This is done by referencing a random-detect-group.

  • random-detect-group group-name [dscpbased| prec-based]: Used in global config mode, this command establishes a set of WRED values that can in turn be enabled per VC on the ATM interfaces using the related random-detect attach command

  • random-detect precedence precedence min-threshold max-threshold mark-prob-denominator: Used in interface, class or random-detect-group config mode, this command changes the default settings for the particular precedence value.

  • random-detect dscp dscpvalue min-threshold max-threshold [mark-probability-denominator]: Used in interface, class or random-detect-group config mode, this command changes the default settings for the particular dscp value.

  • random-detect exponential-weighting-constant exponent: Used in interface, class or random-detect-group config mode, this command changes the default exponential weighting constant setting.

  • show interfaces: This command displays if WRED is enabled on the interface.

  • show policy-map [interface interface-name interface-number]: This command displays WRED related information when it is enabled within a MQC policy map

  • show interface random-detect: This command displays WRED related information when it is enabled on a VIP interface.

  • show queue interface-name interface-number [vc [vpi/] vci]]: This command will display packet information relating to those packets in a queue on the interface.

  • show queueing random-detect [interface atm-subinterface [vc [[vpi/] vci]]]: This command will display information relating to the interface's queuing tool.

5.2.4 Flow Based WRED (FRED)

WRED and FRED drop packets prior to tail dropping occurring. FRED also reduces TCP starvation by observing for UDP flows that utilize too much bandwidth. These flows are known as non-adaptive flows.

FRED drops the packets in the non-adaptive flows more forcefully than it drops packets from the other flow types. FRED classifies packets into flows so that it can identify non-adaptive flows.

FRED examines fields within a packet to determine if it is part of a flow. The flows are then used to discover traffic streams. The following fields are examined to ascertain if the packet is a component of a current flow:

  • The Source IP Address and Destination IP Address

  • The Source Port number and Destination Port Number

  • The Interface that the packet arrived on or is received at.

  • The Layer 3 Protocol

  • The DSCP marking or IP Precedence marking

FRED in turn classifies the identified flows into one of the following types of flows:

  • The Robust Flow consists of TCP packets. In times of congestion the sending rate of these packets is reduced. FRED uses a moderate drop rate when it drops packets in this flow.

  • The Fragile Flow consists of UDP packets that do not change their sending rate when packet loss occurs. Because the rate of sending is not extreme, FRED uses a low drop rate when it drops packets in this flow

  • The Non-Adaptive Flow consists of UDP packets that do not change their sending rate when packet loss occurs. Because the rate of sending is extreme, FRED uses a high drop rate when it drops packets in this flow

Once FRED determines what the flow type is FRED uses WRED logic to determine if packets should be discarded. In actual fact, FRED acts in the same manner as WRED when discarding packets for the nonadaptive and fragile flows. The maximum threshold with FRED is dropped to a lower value for non-adaptive flows. This enables FRED to drop packets in the non-adaptive flow more rapidly than packets in the other two flows. This prevents these flows from consuming the whole queue. When FRED determines whether a flow is fragile or non-adaptive, it calculates each queue's space by using the maximum queue depth and sharing it equally among the number of flows. FIFO queuing has a maximum of 40 queues. If there are 5 flows, a flow would receive queue space as follows: 40/5, or 8. FRED multiplies the queue space with a scaling factor of 4 so that each queue could burst. The final calculation would therefore be: scaling factor * maximum queue length / amount of flows. The result of this calculation is used for differentiating fragile flows from non-adaptive flows.

The following commands are used for configuring FRED:

  • random-detect flow: Used in interface config mode, this command is used to enable FRED.

  • random-detect flow average-depth-factor scaling-factor: This command is used in interface config mode to modify the scaling factor. A lower number indicates that FRED will more rapidly drop those packets for flows that consume too much of a queue.

  • random-detect flow count number: Used in interface config mode, this command is used to change the default setting of the maximum number of flows that FRED follows and monitors simultaneously.

  • random-detect precedence precedence min-threshold max-threshold mark-prob-denominator: Used in interface, class or random-detect-group config mode, this command changes the default settings for the particular precedence value.

  • random-detect dscp dscpvalue min-threshold max-threshold [mark-probability-denominator]: Used in interface, class or random-detect-group config mode, this command changes the default settings for the particular dscp value.

  • random-detect exponential-weighting-constant exponent: Used in interface, class or random-detect-group config mode, this command changes the default exponential weighting constant setting.

  • show interfaces: This command displays if WRED is enabled on the interface.

  • show interface random-detect: This command displays WRED related information when it is enabled on a VIP interface.

  • show queue interface-name interface-number [vc [vpi/] vci]]: This command will display packet information relating to those packets in a queue on the interface.

  • show queueing random-detect [interface atm-subinterface [vc [[vpi/] vci]]]: This command will display information relating to the interface's queuing tool.