tc-fq_codel
Manage network queue disciplines with fair queuing
SYNOPSIS
tc qdisc { add | change | replace | del } dev DEV { root | parent CLASSID } fq_codel [ limit PACKETS ] [ flows NUM_BUCKETS ] [ target TIME ] [ interval TIME ] [ ecn | noecn ] [ ce_threshold TIME ] [ drop_batch PACKETS ] [ quantum BYTES ] [ pacing | nopacing ]
PARAMETERS
limit PACKETS
Sets the maximum number of packets that can be enqueued. Default is 1024 packets.
flows NUM_BUCKETS
Configures the number of hash buckets used to classify flows. Must be a power of 2. Default is 1024.
target TIME
Sets the acceptable minimum queueing delay. If delay consistently exceeds this, CoDel takes action. Default is 5ms.
interval TIME
Defines the interval for CoDel's internal state updates and decision making. Should be at least 4x the target. Default is 100ms.
ecn
Enables Explicit Congestion Notification (ECN). Marks packets instead of dropping them when congestion is detected.
noecn
Disables ECN. Packets will be dropped when congestion is detected, even if ECN is supported.
ce_threshold TIME
CoDel's CE (Congestion Experienced) mark threshold. Specifies the minimum average queue delay before ECN marking begins. Default is 0 (ECN marking starts whenever CoDel detects congestion).
drop_batch PACKETS
Specifies the number of packets to drop in a single burst when CoDel enters a dropping state. Default is 64 packets.
quantum BYTES
The amount of bytes a flow is allowed to dequeue during its turn. This affects how fairly small vs. large packets are treated. Default is 1514 bytes (typical Ethernet MTU).
pacing
Enables pacing of packet transmission. This smooths out bursts and improves overall network stability. Enabled by default.
nopacing
Disables pacing. Packets are sent without smoothing, potentially leading to more burstiness.
DESCRIPTION
fq_codel
is a powerful Linux traffic control queueing discipline (qdisc) that combines Fair Queueing (FQ) with the Controlled Delay (CoDel) active queue management (AQM) algorithm. Its primary goal is to prevent "bufferbloat" – excessive buffering of packets that leads to high latency and reduced throughput – while ensuring fair bandwidth allocation among different network flows.
Fair Queueing works by categorizing network traffic into individual flows and then ensuring each flow gets an equitable share of the available bandwidth, preventing a single bursty flow from monopolizing the link. CoDel, on the other hand, actively monitors the queueing delay for packets. If this delay consistently exceeds a predefined "target" time, CoDel will drop packets or mark them with ECN (Explicit Congestion Notification) to signal congestion, rather than allowing buffers to grow indefinitely.
By integrating these two mechanisms, fq_codel
provides per-flow queue management and intelligent congestion control, leading to significantly lower latency for interactive traffic, better responsiveness for web browsing, and overall improved network performance, even under heavy load. It's particularly effective for heterogeneous traffic mixes and can pace output for a smoother flow.
CAVEATS
Care must be taken when configuring fq_codel
parameters, as inappropriate values can lead to suboptimal network performance, including increased latency or reduced throughput. While generally robust, its effectiveness depends on proper tuning for specific network conditions and traffic patterns. Its integration with more complex hierarchical qdiscs like HTB or HFSC requires a thorough understanding of traffic control principles to avoid unintended interactions.
DEFAULT PARAMETERS AND TUNING
While fq_codel
works well with its default parameters for most home and small office networks, advanced users might want to fine-tune target
and interval
based on their link's RTT (Round Trip Time). A target
of around 5ms is generally suitable for typical broadband, and interval
should be at least four times the target
to give CoDel enough time to react.
PACING EXPLAINED
The pacing
feature, enabled by default, plays a crucial role in fq_codel
's effectiveness. Instead of sending packets in bursts as quickly as the hardware allows, pacing smooths out the transmission rate. This reduces the likelihood of creating new queues downstream, minimizes jitter, and can significantly improve the performance of latency-sensitive applications like VoIP and gaming.
HISTORY
The fq_codel
queueing discipline emerged from the broader effort to combat 'bufferbloat,' a phenomenon where excessively large network buffers lead to high latency and poor interactive performance. CoDel (Controlled Delay) itself was designed by Kathleen Nichols and Van Jacobson and introduced around 2012 as an active queue management algorithm to address this. Fair Queueing (FQ) principles, aiming for equitable bandwidth distribution, were combined with CoDel to create fq_codel
, offering a robust solution that gained widespread adoption in the Linux kernel and other network devices. Its development marked a significant step towards achieving low-latency, high-throughput network performance by default.