CoDel

最後更新: 2019-04-08

介紹

Homepage: https://www.bufferbloat.net/projects/codel/wiki/

CoDel name comes from "controlled delay" , pronounced "coddle"

It is designed to overcome bufferbloat in network links,

by setting limits on the delay network packets experience as they pass through the buffer.

它是一種 simple AQM algorithm (Active Queue Management)

Active Queue Management (AQM)

It is the intelligent drop of network packets inside a buffer associated with a NIC

Historically: drop-tail discipline

AQM: drop or mark packets probabilistically before the queue is full (even when the queue is shor)

 - maintain a shorter queue length than droptail queues

no knobs are required for operators

FQ_Codel uses a stochastic model to classify incoming packets into different flows

and is used to provide a fair share of the bandwidth to all the flows using the queue.

( Early AQM disciplines (notably RED and SRED) require careful tuning of their parameters

in order to provide good performance )

OS Support

OpenWrt use fq_codel in their main QoS system

iproute2 added support for fq_codel in the 3.6

In order to run well at line rate - requires the Linux 3.3 Byte Queue Limits .

bufferbloat

buffer -> delay

With packets held in an overly-large buffer, the packets will arrive at their destination

but with a higher latency but no packets are dropped so TCP does not slow down.

原理

The algorithm is independently computed at each network hop.
(CoDel works off of a parameter that is determined completely locally)

The algorithm operates over an interval, initially 100 ms.

The goal is to keep this minimum delay below 5 ms.

If the minimum delay rises to too high a value, packets are dropped from the queue

until the delay drops below the maximum level.

CoDel treats good queue and bad queue differently.

 - A good queue has low delays by nature, so the management algorithm can ignore it

 - bad queue is subject to management intervention in the form of dropping packets.

The lowest queuing delay for the interval is stored.

When the last packet of the interval is dequeued, if the lowest queuing delay for the interval is greater than 5 milliseconds,

this single packet is dropped and the interval used for the next group of packets is shortened.

If the lowest queuing delay for the interval is less than 5 milliseconds,

the packet is forwarded and the interval is reset to 100 milliseconds.

在 drop 時的 interval: 100 ms, 100/(square root 2) ms, 100/(square root 3) ms ...

 


Usage

 

/etc/sysctl.conf

# Default: pfifo_fast
net.core.default_qdisc=fq_codel

 


tc

tc qdisc add dev eth0 root fq_codel

tc -s qdisc show

qdisc fq_codel 0: dev ens4 root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 32Mb ecn
 Sent 20042 bytes 248 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0

 


 

 

Creative Commons license icon Creative Commons license icon