Bufferbloat, Active Queue Management, ECN and L4S
Why oversized router buffers add seconds of delay, how active queue management (RED, CoDel, FQ-CoDel, PIE, CAKE) and ECN fix it, how L4S aims for near-zero queuing, and how misbehaving receivers can attack congestion control, with latency under load and ECN marks measured in the course lab.
kvi5hnuCode Sprout team member19 min readOn this page
Loss-based TCP fills the bottleneck queue until it overflows. With a small queue, that's harmless. With a large one, every packet through that link, including your video call and your game, waits behind a queue of bulk data that can take hundreds of milliseconds or even seconds to drain. This problem is called bufferbloat. This article measures it, then covers the fixes: active queue management (AQM) in routers, Explicit Congestion Notification (ECN) so routers can signal congestion without dropping, and L4S, which aims for queues that stay nearly empty. It ends with attacks that trick a TCP sender into sending too fast.
Bufferbloat
A queue's delay is its size divided by the link rate. A full 1 MB buffer on a 10 Mbit/s link holds
1,000,000 bytes × 8 ÷ 10,000,000 bit/s = 0.8 s
of data. Memory is cheap, so home routers, cable and DSL (digital subscriber line, broadband over phone wires) modems, cellular base stations and Wi-Fi drivers often have buffers like this, sized for the fastest rate the hardware supports rather than the rate it's actually running at. Upload links are the usual problem: they're slow, so the same buffer means more delay. ITU-T G.114, a recommendation from the International Telecommunication Union, suggests one-way delay under about 150 ms for good interactive voice. One upload filling a bloated buffer blows through that.
Measured: latency under load
In the course lab, two CUBIC uploads run from the client through a 10 Mbit/s bottleneck (20 ms base RTT) while ping measures the round-trip time every 100 ms. The link stays the same; only the router's queue discipline changes:

bottleneck queue ping median ping 95th throughput
large FIFO queue (1 MB) 665.0 ms 817.0 ms 9.50 Mbit/s
small FIFO queue (30 KB) 39.0 ms 42.9 ms 9.52 Mbit/s
RED with ECN marking 34.2 ms 39.3 ms 9.47 Mbit/s
SFQ (fair queuing) 24.6 ms 28.1 ms 9.28 Mbit/s
FIFO means first in, first out: one queue, served in arrival order, dropping new packets when full. The ping columns are the median and 95th-percentile round-trip time during the uploads. Throughput is the same in all four cases: the uploads keep the link full. Only latency changes, by a factor of about 27 between the worst and the best. The large FIFO queue's ping times sit at 665 ms, and the router agrees about why:
qdisc tbf 1: root refcnt 11 rate 10Mbit burst 10000b lat 792ms
Sent 29360158 bytes 19592 pkt (dropped 114, overlimits 31952 requeues 0)
Here tbf (token bucket filter) is the shaper that limits the link to rate 10Mbit. Sent and dropped 114 count packets through it and packets thrown away when the queue was full. overlimits counts the times a packet had to wait because the rate limit was reached. The lat 792ms that tc prints is the delay of a full 1 MB queue at 10 Mbit/s. TCP filled it, because loss-based congestion control only stops growing when the queue overflows.
A small FIFO queue fixes the latency here. But a fixed small buffer is too small for some traffic (bursts, or one flow with a large BDP) and still too large at slower rates. A better fix is a queue that manages itself.
Active queue management
A router that just accepts packets until the buffer is full, then drops new arrivals, is a drop-tail FIFO. Active queue management means the router decides to drop or mark packets before the buffer is full, to keep the standing queue short. RFC 7567 (BCP 197) recommends that routers deploy AQM by default, and that the algorithms need no manual tuning.
RED
Random Early Detection (RED, 1993) tracks a moving average of the queue length. Below a minimum threshold, nothing happens. Between the minimum and maximum, each arriving packet is dropped (or marked) with a probability that rises linearly up to max_p. Above the maximum, everything is dropped or marked. Randomness spreads the signals across flows, so they don't all back off at once.
In the lab, RED was set with min 15000 max 45000 bytes and ecn, so it marked ECN-capable packets instead of dropping them:
qdisc tbf 1: root refcnt 11 rate 10Mbit burst 10000b lat 792ms
Sent 27558977 bytes 18386 pkt (dropped 4, overlimits 28911 requeues 0)
qdisc red 10: parent 1:1 limit 1000000b min 15000b max 45000b ecn
Sent 27558977 bytes 18386 pkt (dropped 4, overlimits 233 requeues 0)
marked 229 early 4 pdrop 0 other 0
The RED line underneath counts what RED did: marked is packets given a CE mark, early packets dropped early, pdrop drops because the queue was completely full. It marked 229 packets and dropped only 4 early (packets that weren't ECN-capable, such as the pings). RED's problem is tuning: good values for min, max and max_p depend on link rate, RTT and traffic mix, and badly tuned RED behaves worse than drop-tail. That's why it saw little deployment outside some ISPs and data centers.
CoDel
CoDel ("controlled delay", RFC 8289) measures what users actually care about: how long each packet has waited in the queue (its sojourn time). Its rule:
- If the minimum sojourn time over an interval (default 100 ms) stays above a target (default 5 ms), a standing queue has formed. Start dropping or marking.
- While the queue stays bad, drop or mark more often: the next drop comes after
interval / √count. - As soon as the sojourn time falls below the target, stop.
Bursts that drain quickly never trigger it; persistent queues always do. It needs no tuning for link rate, because it measures time rather than bytes.
Fair queuing: SFQ, FQ-CoDel and CAKE
The best measured result came from SFQ (stochastic fair queuing). It hashes each flow (by addresses and ports) into its own queue and serves the queues in round robin. The ping packets got their own nearly empty queue, so they didn't wait behind the uploads, and each upload shared the link equally.
FQ-CoDel (RFC 8290) combines the two ideas: fair queuing across flows, with CoDel running on each queue. New flows with small amounts of data get priority, so DNS lookups, TCP handshakes and interactive packets go almost straight through. It's the default queue discipline in many Linux distributions (set by systemd through net.core.default_qdisc), in OpenWrt, and in many home routers' "smart queue" settings.
CAKE (in Linux since 4.19) builds on FQ-CoDel with a built-in shaper, per-host fairness (so one host with 50 flows can't crowd out a host with 1), and options for overhead compensation on DSL and cable links. It's popular on home routers, where the shaper is set slightly below the ISP's rate so that the queue forms in the router, where CAKE manages it, rather than in the modem.
PIE
PIE (Proportional Integral controller Enhanced, RFC 8033) estimates queuing delay from the queue length and the departure rate, and adjusts a drop probability with a control loop to hold the delay near a target (15 ms by default). Its hardware cost is low, and a variant (DOCSIS-PIE, RFC 8034) is required in DOCSIS 3.1 cable modems (DOCSIS, Data Over Cable Service Interface Specification, is the cable broadband standard) for the upstream direction.
Explicit Congestion Notification
Every AQM above needs a way to tell senders to slow down. Dropping a packet works, but it costs a retransmission and, for a short flow, possibly a timeout. ECN (RFC 3168) lets routers mark packets instead:

ECN uses two bits in the IP header (the low two bits of the IPv4 TOS (type of service) byte or IPv6 traffic class, article 25) and two TCP flags, ECE (ECN-Echo) and CWR (Congestion Window Reduced).
Negotiation
ECN has to be agreed on in the handshake. Here's the lab capture, taken at the server, with the client's net.ipv4.tcp_ecn set to 1:
192.0.2.10 40000 flags=····CE····S· ip.ecn=0
198.51.100.10 5201 flags=·····E·A··S· ip.ecn=0
tshark's flag string has one position per TCP flag, a dot when the flag is clear: three reserved bits, then AE (Accurate ECN, shown as N), CWR (C), ECE (E), URG, ACK (A), PSH, RST, SYN (S) and FIN. The client's SYN sets both ECE and CWR (····CE····S·), meaning "I can do ECN." The server's SYN-ACK answers with ECE only (·····E·A··S·): "so can I." The handshake packets themselves aren't marked ECT (ip.ecn=0). After that, the client marks its data ECT(0).
Linux's default tcp_ecn = 2 means "accept ECN when the other side asks, but don't ask." That's why the server accepted here without any configuration. Apple's systems request it for many connections, and most of the Internet now passes ECN bits unchanged.
Marks in a real capture
During the 6-second transfer through the RED bottleneck:
4747 data segments marked ECT(0) (ECN field 2)
146 data segments marked CE (ECN field 3)
And the first congestion episode, in order:
146 0.221 data → ip.ecn=CE tcp flags: -
147 0.221 ACK ← ip.ecn=Not-ECT tcp flags: ECE
149 0.223 ACK ← ip.ecn=Not-ECT tcp flags: ECE
151 0.223 ACK ← ip.ecn=Not-ECT tcp flags: ECE
... (56 more ACKs with ECE)
280 0.312 data → ip.ecn=CE tcp flags: CWR
281 0.312 ACK ← ip.ecn=Not-ECT tcp flags: ECE
282 0.313 data → ip.ecn=CE tcp flags: -
283 0.313 ACK ← ip.ecn=Not-ECT tcp flags: ECE
- Frame 146: a data segment arrives at the server with CE: RED marked it instead of dropping it.
- From frame 147, every ACK carries ECE. The receiver keeps repeating it because ACKs can be lost, and the sender must hear it at least once.
- Frame 280, about 90 ms later, is the first data segment with CWR: the sender has reduced its window. The segments in between were already in flight before the reduction (this was still slow start, with a large window).
- That segment was itself marked CE, so the receiver starts a new round of ECE. The sender won't reduce again until a round trip has passed: one reduction per window of data.
Nothing was retransmitted for these signals. The counters show the cost of classic ECN's coarse feedback, though:
TcpExtTCPDeliveredCE 445 0.0
IpExtInCEPkts 146 0.0
The server's IP layer received 146 CE-marked packets (IpExtInCEPkts), but the sender counted 445 segments acknowledged while ECE was set (TCPDeliveredCE). Classic ECN can only say "there was congestion in this round trip," not how many packets were marked.
Accurate ECN
AccECN (RFC 9768, April 2026, Standards Track) fixes that. It repurposes the ECE, CWR and a formerly reserved flag bit as a counter of CE-marked packets, and adds an optional TCP option with byte counts for each ECN codepoint. The sender learns how much of its traffic was marked, which is what L4S senders need. Linux merged its core AccECN support in kernel 6.18 (late 2025). It isn't on by default: net.ipv4.tcp_ecn = 3 requests and accepts AccECN, while the default of 2 still accepts only classic ECN.
DCTCP and L4S
Classic TCP reduces its window by half (or 30% for CUBIC) on any congestion signal in a round trip. If routers marked as soon as any queue formed, classic flows would keep cutting deeply and underuse the link. So classic AQMs keep a queue of 5 to 15 ms on purpose.
DCTCP (Data Center TCP, RFC 8257, Informational) takes a different approach for data centers. Switches mark CE as soon as the instantaneous queue exceeds a small threshold. The sender measures the fraction of its packets that were marked in each round trip, α, and reduces by α/2: a lot of marks, a big cut; a few marks, a small cut. The result is many small adjustments and queues that stay nearly empty, with full throughput. Linux has had DCTCP since 3.18. It must not be used on the open Internet against classic flows, because it would take most of the bandwidth from them.
L4S (Low Latency, Low Loss, Scalable throughput; RFCs 9330, 9331 and 9332, January 2023, Informational and Experimental) brings DCTCP's idea to the Internet, safely alongside classic traffic:
- Scalable congestion control in senders: DCTCP-like algorithms such as TCP Prague, or L4S modes in QUIC stacks, that respond in proportion to the amount of marking.
- ECT(1) identifies L4S packets (RFC 9331). Classic ECN uses ECT(0), so the bottleneck can tell them apart.
- DualQ Coupled AQM (RFC 9332) in the bottleneck:

The coupling is what makes this fair. PI2 (a PIE-style proportional integral controller, improved by squaring its output for classic traffic) computes a base probability p from the classic queue's delay. Classic flows get drops or marks at p² (which suits their square-root response function, article 75), and L4S flows get marks at about 2p, so both kinds of flow end up with similar throughput while L4S packets see queues of around a millisecond.
Deployment has begun: some cable operators have enabled L4S on DOCSIS networks with Low Latency DOCSIS, Apple has added L4S support to its operating systems, and Linux added the dualpi2 qdisc in version 6.17 (2025).
Attacks on congestion control
Congestion control trusts the other end. A malicious or broken receiver can make a sender go faster than the network allows, and a third party can make it go slower.
ICMP Source Quench
The oldest attack: forge ICMPv4 Source Quench messages, which early hosts obeyed by slowing down. Routers were told to stop sending them in 1995 (RFC 1812), and RFC 6633 (2012) formally deprecated Source Quench, telling hosts to ignore it. Modern stacks do.
Misbehaving receivers
Three classic attacks make a sender inflate its window:
- ACK division. The receiver splits one ACK into many, each acknowledging a few bytes. A sender that grows
cwndper ACK grows many times faster. The fix is byte counting: grow by the number of bytes newly acknowledged, not the number of ACKs (Appropriate Byte Counting, RFC 3465). Linux and other modern stacks do this. - DupACK spoofing. During fast recovery, classic Reno inflates the window for every duplicate ACK. Extra fake duplicates make it send more. SACK-based recovery and PRR limit what's sent to what the SACK information shows has left the network, which removes most of the effect.
- Optimistic ACKing. The receiver acknowledges data before it arrives, making the RTT look shorter and the path look faster. The sender then sends faster than the path can carry. Defenses include ignoring ACKs for data not yet sent (RFC 5961's ACK validation), and making it hard to guess segment boundaries: if the sender varies segment sizes, an ACK that lands in the middle of a segment it hasn't sent yet reveals the trick.
Hiding ECN marks
A receiver could also simply not echo CE marks, or a middlebox could clear them, so the sender never slows down. RFC 3540 proposed an ECN nonce, using the ECT(0)/ECT(1) choice as a random bit the receiver had to sum and return. It was never deployed, and RFC 8311 (2018) moved it to Historic, freeing ECT(1) for L4S. Today's protection is weaker but practical: senders monitor for paths that never mark at all while losses occur, and AccECN's counters make inconsistent feedback easier to detect.
Common questions
Can I fix bufferbloat on my own network?
Often, yes. The queue that matters is usually your upload direction at the modem or router. Enable "smart queue management" (FQ-CoDel or CAKE) on a router that supports it, and set its shaper a little below your real upload and download speeds, so the queue forms where it's managed. Then test latency under load with a tool that pings while saturating the link.
Why not just make all router buffers small?
A buffer needs to absorb bursts, and the right size depends on the link rate and RTT. A fixed small buffer is too small for fast links with long RTTs and causes needless loss, while still too large on slow links. AQM keeps a large buffer available for bursts but a short standing queue.
Does ECN ever hurt?
Very rarely now. Early on, some middleboxes dropped packets with ECN bits set or reset connections whose SYN had ECE and CWR set. Stacks fall back to non-ECN if an ECN SYN gets no answer. Classic ECN gives the same congestion response as a loss, so it doesn't change fairness, it only avoids the retransmission.
Why does fair queuing help ping so much even without dropping?
Because the ping packets no longer share a queue with the uploads. The uploads still build queues, but only in their own flow queues. A flow that sends little, like ping, DNS or a game, is served almost as soon as it arrives.
What does an L4S sender do on a classic bottleneck?
It has to behave like a classic flow. L4S senders must detect a classic, single-queue bottleneck (for example, from rising delay or classic-style marking) and fall back to a Reno-friendly response, otherwise they would take more than their share.
Is bufferbloat only a home-network problem?
It's most common at access links (home uplinks, cellular, Wi-Fi), because they're slow and over-buffered. Core routers are fast and their buffers usually drain quickly, though some have bloated buffers too. Wi-Fi is special because its rate changes all the time; Linux's Wi-Fi stack has used FQ-CoDel-based queuing for that reason.
Summary
- Bufferbloat is the delay from large, full queues at the bottleneck. In the lab, a 1 MB FIFO queue at 10 Mbit/s held ping times around 665 ms during uploads, against 25 to 40 ms with a small queue, RED or SFQ, at the same throughput.
- AQM signals congestion before the buffer is full. RED uses average queue length and needs tuning. CoDel uses packet sojourn time with a 5 ms target. PIE uses a control loop on estimated delay. FQ-CoDel and CAKE add per-flow fair queuing, which keeps light flows fast.
- ECN lets routers mark CE instead of dropping. The receiver echoes ECE until the sender's CWR. Negotiation uses ECE and CWR in the SYN, and ECE in the SYN-ACK; Linux's default is to accept but not request.
- Classic ECN gives one bit per round trip. AccECN (RFC 9768) counts marks, which scalable senders need.
- DCTCP reacts in proportion to the fraction of marked packets. L4S brings that to the Internet with ECT(1), scalable senders and a coupled dual-queue AQM (RFCs 9330–9332), for queues of about a millisecond.
- Attacks: Source Quench is deprecated and ignored; ACK division is defeated by byte counting; DupACK spoofing is limited by SACK-based recovery; optimistic ACKs are limited by ACK validation; the ECN nonce is Historic.
Practice questions
1. A home router has a 256 KB upload buffer and a 2 Mbit/s upload link. How much delay does a full buffer add?
Answer
256,000 × 8 ÷ 2,000,000 = 1.024 seconds, added to every packet that waits behind it, in this direction only.
2. In a capture, a SYN has flags ····CE····S· and its SYN-ACK has ·······A··S· (no ECE). Will the connection use ECN?
Answer
No. The client offered ECN, but the server didn't agree (a SYN-ACK with ECE would mean yes). Data packets will be Not-ECT, and congestion will be signaled only by loss.
3. A sender receives 30 consecutive ACKs with ECE during one round trip. How many times does it reduce its window, and why?
Answer
Once. The receiver repeats ECE until it sees CWR, so many ECE ACKs can stand for a single marked packet. Classic ECN reacts at most once per window of data, the same as for multiple losses in one window.
4. Why does CoDel measure sojourn time rather than queue length?
Answer
Delay is what hurts applications, and a given queue length means very different delays at different link rates (10 KB is 8 ms at 10 Mbit/s but 0.08 ms at 1 Gbit/s). Measuring time makes the same target work at any rate without tuning, including on links like Wi-Fi whose rate changes constantly.
5. A DCTCP sender sees 20% of its packets marked CE in one round trip. By how much does it reduce its window? What would a classic ECN sender do?
Answer
DCTCP reduces by α/2, so with α = 0.2 (after its moving average converges to that value) it reduces by 10%. A classic ECN sender reduces as for a loss: by half with Reno, or to 70% with CUBIC, whatever fraction was marked.
6. How does Appropriate Byte Counting defeat ACK division?
Answer
With byte counting, cwnd grows in proportion to the number of newly acknowledged bytes, not the number of ACKs. Splitting one ACK of 1448 bytes into ten ACKs of about 145 bytes each acknowledges the same 1448 bytes, so the window grows by the same amount as with one ACK.
Review quiz
You've finished Part 12. Test yourself on slow start, congestion avoidance and fast recovery, SACK recovery and PRR, reading a real trace, CUBIC and fairness, delay-based and model-based control, and AQM, ECN and L4S:
Previous: Delay-Based and Model-Based Congestion Control: Vegas, Compound and BBR
Next: Network Security Principles and the Threats to Network Communication

More in TCP/IP Course
Quiz: TCP/IP Delicate Details
Twenty-five questions on the details that catch out experienced engineers: sequence numbers for SYN and FIN, TIME_WAIT versus tcp_fin_timeout, Karn's algorithm, socket buffer doubling, even and odd ephemeral ports, IPv6 checksums and fragmentation, negative DNS caching, and capture filter traps.
Quiz: TCP/IP Interview Questions
Thirty-three networking questions of the kind asked in developer, SRE and network engineering interviews: what happens when you load a URL, TCP versus UDP, handshakes, closing and TIME_WAIT, subnetting, NAT, DNS, MTU problems, congestion, TLS and QUIC, and debugging slow or failing connections.
Quiz: TCP/IP Course Final Exam (All Parts)
The final exam for the TCP/IP course: thirty questions across all fourteen parts, from packets and addressing through Ethernet, ARP, IP, DHCP, NAT, ICMP, UDP, DNS, TCP connections, reliability, congestion control, security, QUIC and troubleshooting.
Quiz: Modern Transports and Troubleshooting (TCP/IP Part 14)
Review modern transports and troubleshooting: QUIC packets, handshakes, 0-RTT, streams and connection migration, HTTP/3, Multipath TCP, SCTP multihoming, and a layered method for diagnosing real network faults.
Discussion
Sign in to ask a question or share what you learned.