Skip to main content
Congestion Engineering
ECN &
Buffer Bloat.

In 800G AI networks, 'good' congestion is a signal. Learn how Explicit Congestion Notification (ECN) prevents buffer bloat and keeps your GPU fabric responsive.

ECN Congestion Control Visualization
RED/WRED Marking StageLow-Latency Guarantee
Pingdo Reference Series

How ECN Prevents Buffer Bloat

Pingdo Technical Team Published: April 14, 2026 Last Updated: April 14, 2026
Verified by Engineering

The Signal Before the Stall

In a high-speed AI fabric, congestion is inevitable. When thousands of GPUs synchronize their model weights simultaneously (All-Reduce), switches experience massive bursts of traffic. **Explicit Congestion Notification (ECN)** is the protocol mechanism that prevents these bursts from filling switch buffers entirely, a phenomenon known as "Buffer Bloat" that causes massive latency spikes.

WRED Detection

Switches use Weighted Random Early Detection (WRED) to identify buffer growth. Instead of dropping, they change the ECN bits in the IP header to binary '11' (CE - Congestion Experienced).

CNP Notification

When a receiver sees a 'CE' marked packet, it sends a **Congestion Notification Packet (CNP)** back to the source NIC, requesting immediate rate reduction.

The DCQCN Algorithm Cycle

Loading Visualization...

For RoCE v2 fabrics, the industry standard is **DCQCN** (Data Center Quantized Congestion Control). It operates in a 4-step recurring cycle:

01

Marking Threshold (Kmin/Kmax)

The switch starts marking ECN bits when the buffer exceeds Kmin and increases probability until Kmax.

02

RC Feedbacks

The Receiver (Reaction Point) generates CNPs whenever it encounters CE bits in the RDMA stream.

03

Rate Reduction

The Source (Sender) processes CNPs and immediately throttles its transmission speed to prevent buffer overflow.

04

Rate Recovery

If no CNPs are received for a specific time window, the source incrementally ramps back up to full line-rate.

ECN Threshold Tuner

Tuning Kmin and Kmax is an art. Too aggressive and you sacrifice throughput. Too lax and you trigger PFC pause storms. Use our tuner to find the optimal DCQCN settings.

Managing 'Incast' Congestion

The most common cause of buffer bloat in AI clusters is **TCP/Incast**, where multiple senders transmit to a single receiver simultaneously. ECN is exceptionally good at handling Incast because:

  • Fine-Grained Throttling: Unlike PFC which pauses the whole link, ECN marks only the affected flows.
  • Zero-Packet Loss: By signaling at 50-80% buffer utilization, ECN prevents the buffer from ever reaching 100%, ensuring no packets are dropped.

Kmin/Kmax Calibration Curves and Alpha Scaling in DCQCN Rate Recovery

The DCQCN algorithm's effectiveness hinges on three parameters: Kmin, Kmax, and Pmax. Kmin defines the buffer occupancy threshold where ECN marking begins, Kmax defines where marking probability reaches 100%, and Pmax specifies the maximum marking probability at Kmax. The marking probability between Kmin and Kmax follows a linear ramp: P(mark) = Pmax x (Qlen - Kmin) / (Kmax - Kmin). At 800 Gbps, the buffer fills at a rate of 100 GB/s, meaning the ramp from Kmin to Kmax (typically set to Kmax = 3 x Kmin) takes only 2-5 µs depending on the configured buffer sizes.

The choice of Kmin directly determines the equilibrium buffer occupancy. If Kmin is set too low (below approximately 50 KB for a 400 Gbps link), the switch marks packets during normal micro-bursts that would not cause actual congestion, unnecessarily reducing throughput. If Kmin is set too high (above 200 KB), the buffer may overflow before the ECN feedback loop can react, triggering PFC as the emergency brake. The optimal Kmin for a DCQCN-configured fabric is typically 1.5x the Bandwidth-Delay Product (BDP) of the link. For a 400 Gbps link with 5 µs RTT, the BDP is 250 KB, giving a Kmin of approximately 375 KB.

The alpha scaling factor controls how aggressively the sender reduces its rate upon receiving CNP feedback. DCQCN defines alpha as a per-flow variable updated as: alpha = (1 - g) x alpha + g x (number_of_CNPs / total_packets) in each update window. The gain parameter g (typically 1/16 or 1/8) determines the smoothing. A higher g allows faster convergence but introduces rate oscillation. When a CNP is received, the sender rate is immediately halved: new_rate = rate x (1 - alpha / 2). The rate recovery phase increases the rate by approximately 5% per RTT if no CNPs are received, following a linear increase with a lower bound equal to the minimum rate (NIC configuration parameter).

Tuning the rate recovery pace is critical for AI training workloads. During All-Reduce, all flows burst simultaneously, triggering ECN marking across all ports. If recovery is too fast, the flows synchronize and oscillate between rate reduction and recovery, a phenomenon known as **flow synchronization collapse**. Randomizing the recovery start time by introducing a jitter of +/- one RTT breaks this synchronization and improves aggregate throughput by 15-20% in measured deployments.

ECN RTT Fairness and Flow Synchronization Collapse

ECN-based congestion control has a well-documented fairness problem: flows with shorter Round-Trip Times (RTTs) receive a disproportionately large share of the bandwidth because they detect and respond to congestion faster. In an AI fabric where GPU-to-GPU RTTs range from 2 microseconds (same rack) to 20 microseconds (cross-cluster), this RTT unfairness can cause severe bandwidth allocation imbalance. A same-rack flow will capture 3-5x more bandwidth than a cross-rack flow under the same DCQCN configuration, leading to straggler effects in All-Reduce operations that depend on the slowest flow completing first.

The RTT fairness problem is rooted in the DCQCN rate adaptation formula. When a CNP is received, the sender rate is halved: new_rate = rate x (1 - alpha/2). The short-RTT flow receives CNP feedback faster and can begin recovery sooner. After the rate reduction, both flows enter the recovery phase where the rate is increased by approximately 5% per RTT. The short-RTT flow experiences more recovery cycles per unit time, allowing it to regain its share faster. Over a 10-millisecond window, a 2-microsecond RTT flow experiences 100 recovery cycles while a 20-microsecond RTT flow experiences only 10 cycles — the short flow's rate remains at 85% of peak while the long flow's rate oscillates between 40% and 60%.

The mitigation is **RTT-Independent Rate Recovery (RIR)**, where the recovery rate increase is tied to a global timer rather than the RTT. Instead of increasing the rate by 5% per RTT, the sender increases the rate by a fixed amount (e.g., 1 Gbps) every 100 microseconds, regardless of RTT. This decouples recovery speed from path latency and ensures that all flows converge to the same equilibrium rate. NVIDIA's Spectrum-4 switch supports RIR through the **DCQCN Extended** mode, which includes an RTT measurement field in the CNP packet that allows the sender to normalize its recovery rate against the measured path RTT.

Flow synchronization collapse is a separate but related phenomenon. When multiple flows share the same bottleneck and simultaneously detect congestion, they reduce their rates in phase, causing the bottleneck queue to drain completely before all flows ramp back up simultaneously, recreating the congestion in a repeating cycle. This synchronized oscillation reduces aggregate throughput by 20-30%. The standard fix is **Randomized CNP Jitter** — each sender waits for a random period (0 to 50 microseconds) before processing a CNP, effectively de-correlating the rate reduction timing across flows. With jitter enabled, the bottleneck utilization smooths from a 30% amplitude oscillation to under 5%, restoring near-theoretical throughput.

ECN Code Points, Tunnel Propagation, and the Not-ECT Trap

ECN lives in the two least-significant bits of the DSCP/ECN byte in the IPv4 header, redefined by RFC 3168 from the old ToS field. The four code points drive everything: 00 is Not-ECT (the endpoint did not opt in), 01 is ECT(1) and 10 is ECT(0) (the two ECN-capable encodings), and 11 is CE (Congestion Experienced). A switch running an AQM — WRED, CoDel, or PIE — sets the CE bit on a passing packet instead of dropping it, but only when that packet is ECT. RFC 3168 Section 13 is explicit: a device MUST NOT mark a Not-ECT packet, because the sender has no mechanism to read the signal and the mark would be silently discarded — an ECN-aware AQM reduced to a pure loss-based device by accident. The DSCP/ECN sharing has an operational consequence: a policy that rewrites DSCP with a swap-and-replace (rather than a bitwise AND) also wipes the ECN bits and silently disables marking on that path.

Tunnels are where ECN silently dies in production. RFC 6040 ("Tunnelling of Explicit Congestion Notification") requires the encapsulator to copy the inner ECN code point into the outer header so congestion inside the tunnel is signaled end-to-end, and requires the decapsulator to leave a Not-ECT inner packet unmarked even if the outer header arrived CE. The real-world failure is ECN masking: a hardware or overlay device that zeroes the ECN bits on encapsulation. In a VXLAN or GRE overlay between data centers, that single misconfiguration reintroduces the exact buffer-bloat behavior ECN was deployed to eliminate — queues grow to the drop threshold, RTT balloons, and PFC or TCP loss does the signaling instead. Validate end-to-end: send an ECT(0) probe across every tunnel segment and confirm the CE bit survives decapsulation, then check the ASIC counters for CE marks on the tunnel egress port. Fragmentation has a second gotcha — the ECN field exists only in the first fragment — so keep a consistent MTU and keep the fabric ECN-transparent from source NIC to receiver NIC.

Classification discipline starts at the endpoint: RFC 3168 requires ECN negotiation via the TCP SYN/SYN-ACK flags before any ECT-marked data is sent, so a host that sets ECT without negotiation pollutes the fabric's signal. Verify that the three classes you will actually see — Not-ECT legacy flows, ECT(0) standard ECN flows, and CE-marked packets — are marked exactly once per RTT window; double marking masks the bottleneck location and makes the counters diagnostically useless.

Marking Versus Dropping: TCP's AIMD Reaction and the AQM Contract

TCP congestion control is additive-increase, multiplicative-decrease (AIMD): the window grows by roughly one MSS per RTT on every ACK and halves on a congestion event. Before ECN, the only congestion event a sender could observe was a dropped packet, so the bottleneck queue had to fill to the drop threshold before any flow slowed — that is buffer bloat: queues grow, latency spikes from sub-millisecond to tens of milliseconds, and the flow learns about congestion only after overflow. ECN replaces the loss signal with a mark while keeping the same AIMD law — the receiver sets ECE in the ACK, the sender halves the window and echoes ECE — but the reaction no longer costs a retransmission. RFC 8087 documents the operational benefits: no duplicate ACKs, no fast retransmit, no RTO ambiguity, no spurious retransmissions. At 400 Gbps, one 1-second RTO (RFC 6298's initial value) wastes up to 50 GB of capacity.

The ECN thresholds are the contract between the AQM and the endpoints, and the math is the same whether the event is a drop or a mark. WRED computes an exponentially weighted average queue depth with weight 1/512 and, between min_th and max_th, applies a drop probability of (max_p) x (avg_q - min_th) / (max_th - min_th); for ECN that curve becomes a mark probability, letting the queue run up to max_th — where a drop would have occurred — with no retransmission penalty. CoDel (RFC 8289) measures the minimum packet sojourn time over a 100 ms window and, once it exceeds the 5 ms target, marks or drops until the delay subsides. PIE (RFC 8033) runs a proportional-integral controller on queue length or delay, recomputing probability every 16–33 ms for stability under bursty All-Reduce fan-in. In every case the discipline is identical: set thresholds against the Bandwidth-Delay Product, never an arbitrary byte count. For a 400 Gbps link with 5 µs RTT, the BDP is 250 KB; put Kmin near 1.5x BDP (about 375 KB) and Kmax near 3x Kmin so marking begins well before the PFC XOFF line.

From DCTCP to L4S: The Next Generation of ECN

The default reaction to a single mark — halve the window — is too violent for data-center workloads, which is why DCTCP (Alizadeh et al., SIGCOMM 2010) reworks the sender and receiver. The switch marks at a single threshold K, the receiver returns the fraction of marked packets per RTT, and the sender keeps an exponentially weighted moving average alpha, cutting the window by (1 - alpha/2) rather than a fixed half. The paper's stability condition is quantitative: K must scale with the Bandwidth-Delay Product (roughly K greater than or equal to 0.17 x C x RTT for 10 Gbps) to avoid oscillation. DCQCN, the control loop this fabric runs for RoCE v2, is the RDMA analog with the same control law: the switch marks CE above Kmin, the receiver emits a Congestion Notification Packet (CNP), and the sender reduces by (1 - alpha/2) and recovers at roughly 5% per RTT. Because the law is shared, the threshold math for TCP transfers directly to RoCE v2.

L4S — Low Latency, Low Loss, Scalable Throughput — is ECN taken to its logical endpoint. RFC 9330 defines the architecture and RFC 9331 the signalling: L4S-eligible flows mark with ECT(1), classic ECN flows with ECT(0), and a dual-queue AQM isolates the classes so L4S flows see a small dedicated queue with thresholds as low as a few packets of delay while classic flows keep their mark-or-drop queue. Because L4S control (Prague TCP, or DCTCP on the ECT(1) signal) scales its rate with a handful of marks per RTT regardless of capacity, it sustains sub-millisecond queuing delay at 800 Gbps — the endgame for AI-scale fabrics. The migration is deliberately staged: deploy ECT(0) ECN with DCTCP or DCQCN today, prove the counters under All-Reduce, then enable ECT(1) dual-queue marking as NIC and switch hardware supports it.

The production checklist, in order: (1) enable ECN on every endpoint (net.ipv4.tcp_ecn = 1, or the NIC's DCQCN profile); (2) confirm no device marks Not-ECT or strips ECT on encapsulation — RFC 6040 on every tunnel; (3) set Kmin near 1.5x BDP and Kmax near 3x Kmin on every fabric port; (4) baseline ECN/CNP counters, queue depth, and PFC pause counts (target: zero); (5) stress-test Incast with 8:1 and 16:1 fan-in and confirm the queue plateaus below Kmax; (6) only then consider L4S. The tells are unambiguous: high ECN marking with nonzero PFC means the thresholds are too late; zero ECN counters means ECN is not running at all — buffer bloat included.

Share Article

Technical Standards & References

REF [rfc-3168]
RFC 3168 (2001)
The Addition of Explicit Congestion Notification (ECN) to IP
Published: IETF
VIEW OFFICIAL SOURCE
REF [roce-dcqcn-2015]
Mellanox/Microsoft (2015)
DCQCN: Data Center Quantized Congestion Control
Published: SIGCOMM
VIEW OFFICIAL SOURCE
Mathematical models derived from standard engineering protocols. Not for human safety critical systems without redundant validation.

Ready to audit your connection?

Theory is the foundation, but data is the proof. Apply these engineering principles to your own network link right now.

Launch Diagnostics Tool
Partner in Accuracy

"You are our partner in accuracy. If you spot a discrepancy in calculations, a technical typo, or have a field insight to share, don't hesitate to reach out. Your expertise helps us maintain the highest standards of reliability."

Contributors are acknowledged in our technical updates.