Smart Queue Management (SQM)
The solution to bufferbloat is not to remove buffers — you need some buffering to handle bursts. The solution is to manage buffers intelligently, dropping packets before the queue grows large enough to cause noticeable latency. This is called Active Queue Management (AQM).
CoDel (Controlled Delay)
CoDel, pronounced "coddle," was developed by Van Jacobson and Kathleen Nichols and introduced in Linux 3.5. Its key insight is to measure sojourn time — how long a packet spends sitting in the queue — rather than queue depth.
The algorithm:
1. If a packet exits the queue having waited less than 5ms, the queue is healthy. Do nothing.
2. If packets are consistently waiting longer than 5ms, the queue is too deep. Begin dropping packets at an increasing rate.
3. Dropping packets signals TCP senders to reduce their rate, which drains the queue.
The 5ms target is chosen because it is below the threshold of human perception for most real-time applications (VoIP, gaming) while still allowing enough buffering to handle legitimate bursts.
FQ_CoDel (Fair Queuing + CoDel)
FQ_CoDel is the production-grade evolution. It combines CoDel's delay-based dropping with stochastic fair queuing: traffic is hashed into multiple independent flow queues (typically 1024), and the scheduler services them in a round-robin fashion.
The result:
- Your 1 GB file upload occupies one flow queue.
- Your VoIP call occupies a different flow queue.
- The scheduler alternates between them, so your VoIP packet never waits behind megabytes of upload data.
- CoDel runs independently within each flow queue, keeping per-flow latency low.
FQ_CoDel is a queue discipline you assign to an outbound network interface, and Linux exposes several tunable parameters on it: the sojourn time target (5ms by default), how long CoDel waits before it starts dropping once that target is exceeded, and the number of independent flow queues. It also supports ECN.
ECN (Explicit Congestion Notification):
Rather than dropping packets to signal congestion, ECN allows routers to mark packets with a congestion signal. The receiver echoes this back to the sender, which reduces its rate without any packet loss. This is strictly better than dropping when both endpoints support it, and is a single kernel parameter to enable.
Key Point: FQ_CoDel isolates traffic into per-flow queues and uses delay-based dropping to keep each queue shallow. It eliminates bufferbloat without sacrificing burst tolerance, and is the recommended queue discipline for any Linux router or server handling mixed traffic.