Configuring Explicit Congestion Notification (ECN)

 

Overview

Explicit Congestion Notification (ECN) is a network protocol feature that allows end-to-end notification of network congestion without dropping packets. It is an extension of the IP and TCP protocols, enhancing the way congestion is managed by marking packets instead of discarding them.

How ECN Works

ECN works by marking packets instead of dropping them when network devices detect congestion. This approach allows the sender to reduce its transmission rate proactively, improving overall network performance and reducing packet loss.

Key Concepts

  1. ECN-Capable Transport (ECT): Indicates that the endpoints are ECN-aware and can handle ECN markings.

  2. Congestion Experienced (CE): Indicates that the network is experiencing congestion.

  3. TCP ECN Echo (ECE): A TCP flag used to notify the sender that the receiver has received a packet marked with CE.

  4. Congestion Window Reduced (CWR): A TCP flag used by the sender to indicate that it has reduced its congestion window in response to receiving an ECE flag.

ECN Field in the IP Header

ECN uses two bits in the IP header, known as the ECN field, to signal congestion information:

  • 00: Not ECN-Capable Transport (Non-ECT)

  • 01: ECN Capable Transport (ECT(1))

  • 10: ECN Capable Transport (ECT(0))

  • 11: Congestion Experienced (CE)

ECN Operation

  1. Negotiation: During the TCP three-way handshake, both endpoints negotiate the use of ECN. If both support ECN, they set the appropriate flags in their SYN packets.

  2. Packet Marking: When an ECN-capable router detects congestion, it marks packets instead of dropping them. It sets the ECN field in the IP header to CE (11).

  3. Receiver Notification: The receiver detects the CE marking and sets the ECE flag in the TCP header of its acknowledgment (ACK) packets.

  4. Sender Adjustment: Upon receiving an ACK with the ECE flag, the sender reduces its transmission rate and sets the CWR flag in subsequent packets to indicate that it has responded to the congestion notification.

Therefore, it is necessary to reasonably set the ECN thresholds so that the buffer space between the ECN thresholds and PFC thresholds can accommodate the traffic sent during the time after the ECN congestion marking and before the source end slows down. This helps to avoid triggering PFC flow control as much as possible.

Advantages of ECN

  1. Reduced Packet Loss: By marking packets instead of dropping them, ECN helps in avoiding packet loss, which is particularly beneficial for applications sensitive to packet drops, such as real-time video or voice.

  2. Improved Network Efficiency: ECN allows for more efficient use of network resources by preventing congestion before it becomes severe enough to cause packet drops.

  3. Better Performance: By avoiding packet loss, ECN can lead to better overall performance for TCP connections, resulting in higher throughput and lower latency.

  4. Smooth Traffic Flow: ECN provides a mechanism for more graceful handling of congestion, leading to smoother traffic flow and improved end-user experience.

Restrictions and Guidelines

When you configure ECN, follow these restrictions and guidelines:

  • To use ECN, both the network devices (such as routers and switches) and the endpoints (such as servers and clients) must support ECN.

Configuring ECN via WRED

On PICOS switches, ECN is used in conjunction with Weighted Random Early Detection (WRED) to provide early signals of congestion to avoid packet loss and improve network performance.

WRED is an active queue management (AQM) mechanism that selectively drops packets based on the average queue length, helping to manage congestion before the queue becomes full. When combined with ECN, WRED can mark packets instead of dropping them when congestion is detected.

Procedure

Step 1         Enable WRED.

set interface gigabit-ethernet <interface-name> wred queue <queue-value> enable <true |false>

Step 2         Set the maximum and minimum thresholds.

set interface gigabit-ethernet <interface-name> wred queue <queue-value> max_thresh <max_thresh>

set interface gigabit-ethernet <interface-name> wred queue <queue-value> min_thresh <min_thresh>

Step 3         Set drop probability.

set interface gigabit-ethernet <interface-name> wred queue <queue-value> drop_probability <int>

Step 4         Enable ECN.   

set interface gigabit-ethernet <interface-name> wred queue <queue-value> ecn_thresh <int>

Step 5         Commit the configuration.   

commit

Key Configuration Parameters

  • Min_Thresh: The minimum average queue size at which WRED starts to mark packets.

  • Max_Thresh: The maximum average queue size at which WRED starts to drop packets with the configured Drop_Probability.

  • Drop_Probability: The probability that a packet will be marked with ECN when the average queue size is between the min and max thresholds.

Verify Configuration

Use the command run show interface gigabit-ethernet <interface-name> wred to check the settings of ECN and WRED .

Monitor and Adjust

Monitor the network to ensure that ECN marking and WRED are effectively managing congestion. Adjust the thresholds and probabilities as needed to optimize performance.

Configuration Example

The following commands complete the configurations:

  • Enable WRED on queue 0 of interface ge-1/1/3;

  • Set the maximum threshold to 400 and the minimum threshold to 200 on queue 0 of interface ge-1/1/3;

  • Set the drop probability to 50% on queue 0 of interface ge-1/1/3;

  • Enable ECN (Explicit Congestion Notification) on queue 0 of interface ge-1/1/3.

admin@PICOS# set interface gigabit-ethernet ge-1/1/3 wred queue 0 enable true admin@PICOS# set interface gigabit-ethernet ge-1/1/3 wred queue 0 max_thresh 400 admin@PICOS# set interface gigabit-ethernet ge-1/1/3 wred queue 0 min_thresh 200 admin@PICOS# set interface gigabit-ethernet ge-1/1/3 wred queue 0 drop_probability 50 admin@PICOS# set interface gigabit-ethernet ge-1/1/3 wred queue 0 ecn_thresh 1 admin@PICOS# commit

Show the WRED information of the specified interface.

admin@PICOS# run show interface gigabit-ethernet ge-1/1/3 wred Queue Num Min Thresh Max Thresh Drop Probability ECN Thresh Status ---------- ---------- ---------- ---------------- ----------- ---------- 0 200 400 50% Enabled Enabled 1 0 0 0% Disabled Disabled 2 0 0 0% Disabled Disabled 3 0 0 0% Disabled Disabled 4 0 0 0% Disabled Disabled 5 0 0 0% Disabled Disabled 6 0 0 0% Disabled Disabled 7 0 0 0% Disabled Disabled

Test Recommended Configuration

Configuring ECN thresholds properly is crucial for ensuring optimal network performance, which helps in managing congestion proactively, leading to improved network performance, reduced packet loss, and lower latency.Testing recommended configurations involves setting specific parameters for ECN to manage congestion effectively and then evaluating the performance outcomes.

In the Lab, we use network simulation tools to create a controlled environment for testing. Simulate various traffic patterns and congestion scenarios to test how the network handles congestion. The table below provides recommended configuration values to prevent packet loss and avoid triggering the PFC threshold.

Test Method

Switch Port MTU

Switch Egress Port Link Bandwidth

ECN Min Threshold

(Bytes)

ECN Max Threshold

(Bytes)

Probability

Test Method

Switch Port MTU

Switch Egress Port Link Bandwidth

ECN Min Threshold

(Bytes)

ECN Max Threshold

(Bytes)

Probability

image-20240624-023147.png

Three Ingress Ports to One Egress Port

9000

99.75G

80000

8000000

80

image-20240624-023426.png

Three Ingress Ports to One Egress Port

4096

97.68G

1000000

30000000

50

Three Ingress Ports to One Egress Port

9000

99.75G

1000000

32000000

50

Users have to continuously monitor network performance and ECN marking rates. Make dynamic adjustments to the ECN thresholds as needed to respond to changing network conditions.

Copyright © 2024 Pica8 Inc. All Rights Reserved.