tc-codel
Manage network queue discipline (CoDel)
SYNOPSIS
tc qdisc add dev DEV root | parent HANDLE codel [limit PACKETS] [target TIME] [interval TIME] [ecn | noecn] [quantum BYTES] [drop_batch PACKETS] [ce_threshold TIME]
tc qdisc change dev DEV root | parent HANDLE codel [limit PACKETS] [target TIME] [interval TIME] [ecn | noecn] [quantum BYTES] [drop_batch PACKETS] [ce_threshold TIME]
tc qdisc replace dev DEV root | parent HANDLE codel [limit PACKETS] [target TIME] [interval TIME] [ecn | noecn] [quantum BYTES] [drop_batch PACKETS] [ce_threshold TIME]
tc qdisc delete dev DEV root | parent HANDLE
PARAMETERS
limit PACKETS
The maximum number of packets that can be enqueued. Defaults to 1000 packets.
target TIME
The acceptable minimum queueing delay. If the minimum delay exceeds this target for a sustained period, CoDel starts dropping/marking. Defaults to 5ms. Specified in time units like 'ms', 'us'.
interval TIME
The time interval used to measure the minimum delay. The minimum delay is periodically sampled over this interval. Defaults to 100ms. Specified in time units.
ecn | noecn
Enables or disables Explicit Congestion Notification (ECN). When enabled, CoDel marks packets instead of dropping them if the ECN bits are set in the IP header.
quantum BYTES
A byte-oriented version of CoDel (known as Byte Queue Limits or BQL) uses this parameter. It specifies the number of bytes that can be dequeued at once. Defaults to the interface's Tx queue length.
drop_batch PACKETS
The number of packets CoDel drops in a single batch during a congestion event. This helps to quickly reduce the queue size. Defaults to 64.
ce_threshold TIME
The Explicit Congestion (CE) marking threshold for ECN-capable flows. If the queue delay exceeds this threshold, packets are marked with CE. This provides an earlier signal for congestion than dropping. Only applies if ECN is enabled. Defaults to target.
DESCRIPTION
CoDel (Controlled Delay) is an Active Queue Management (AQM) algorithm implemented as a queuing discipline (qdisc) in the Linux kernel. Its primary purpose is to address the "bufferbloat" problem, where excessive buffer sizes in network devices lead to high latency and poor interactive performance. CoDel works by monitoring the minimum queueing delay of packets passing through the queue. When this delay exceeds a configured target time for a sustained interval, CoDel begins dropping or marking packets (if ECN is enabled) to signal congestion, thereby keeping latency low while maintaining high throughput. It aims to achieve low latency without starving flows.
CAVEATS
CoDel's effectiveness heavily depends on correctly setting target and interval parameters for your specific network conditions. Incorrect tuning can lead to excessive drops or still high latency. It's designed to work best on bottleneck links where it has full control over the queue. While CoDel addresses delay, for scenarios requiring fair bandwidth allocation among flows, a flow-queuing discipline like FQ-CoDel might be more appropriate.
<B>AQM AND BUFFERBLOAT</B>
CoDel is a prime example of an Active Queue Management (AQM) algorithm. AQM techniques aim to prevent queues from growing too large by signaling congestion early, rather than waiting for buffers to overflow. Bufferbloat refers to the problem of excessively large buffers in network devices, which can cause high latency, jitter, and reduce effective throughput, even when the network is not truly congested. CoDel directly tackles this by actively managing queue delays.
<B>DEFAULT PARAMETERS</B>
While tc-codel provides tunable parameters, its default settings (target=5ms, interval=100ms, limit=1000 packets) are often robust enough for many common network scenarios, making it relatively easy to deploy without extensive tuning. These defaults are chosen to provide good performance for typical broadband connections.
HISTORY
CoDel (Controlled Delay) was developed by Kathleen Nichols and Van Jacobson and first published in 2012. It emerged as a response to the "bufferbloat" problem, a pervasive issue in network devices where excessively large buffers led to high latency and degraded performance, especially for interactive applications. Unlike earlier AQM algorithms like RED, CoDel focuses on controlling the minimum queueing delay rather than average queue size, making it more robust and easier to tune for various network conditions. Its design emphasizes simplicity, efficacy, and resilience against misconfiguration.
SEE ALSO
tc(8), tc-fq_codel(8), tc-netem(8), sch_codel(8)