RED(8)

๐Ÿ’– RED(8) โ€” the red page, but make it a vibe ๐Ÿ’–

okay bestie, gather round, because today we're talking about red โ€” Random Early Detection โ€” and no, it's not the color, it's a queueing discipline and it's honestly kind of iconic. ๐ŸŒˆ


โœจ NAME โœจ

red โ€” Random Early Detection ๐ŸŽ€


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

tc qdisc ... red limit bytes [ min bytes ] [ max bytes ] avpkt bytes [
burst packets ] [ ecn ] [ harddrop ] [ nodrop ] [ bandwidth rate ] [
probability chance ] [ adaptive ] [ qevent early_drop block index ] [
qevent mark block index ]

๐ŸŒธ DESCRIPTION ๐ŸŒธ

so. Random Early Detection is a classless qdisc, and the way it manages its queue size is, like, smart. ๐Ÿ’…

Regular queues are giving "no thoughts, head empty" โ€” they just drop packets from the tail once they're full, which is lowkey not the optimal behaviour. RED also does tail drop, but it does it in a way more gradual, slow-burn, character-development-arc kind of way. ๐Ÿงš

Here's the tea: once the queue hits a certain average length, the packets getting enqueued have a configurable chance of being marked (and marking might mean dropped). That chance increases linearly up to a point called the max average queue length โ€” even though the queue itself might still get bigger. The audacity, honestly. ๐Ÿ˜ญ

This has a whole host of benefits over plain simple taildrop, and it's not processor intensive. It prevents synchronous retransmits after a burst in traffic โ€” which would otherwise cause further retransmits, etc. etc. cascade of chaos, we don't do that here. ๐Ÿ™ˆ

The goal? A small queue size. Which is good for interactivity, while not disturbing TCP/IP traffic with too many sudden drops after a burst of traffic. Balance. Main character energy. ๐Ÿ‘‘

And depending on if ECN is configured, marking either means dropping, or purely marking a packet as overlimit. โœจ


๐ŸŽ€ ALGORITHM ๐ŸŽ€

The average queue size is what determines the marking probability, periodt. It's calculated using an Exponential Weighted Moving Average, which can be more or less sensitive to bursts โ€” depending on how you set it up.

  • When the average queue size is below min bytes, no packet will ever be marked. Zero. None. Not happening. ๐Ÿšซ
  • When it exceeds min, the probability of marking climbs linearly up to probability, until the average queue size hits max bytes. ๐Ÿ“ˆ
  • Because probability is normally not set to 100%, the queue size might conceivably rise above max bytes โ€” so the limit parameter is provided to set a hard maximum for the size of the queue. ๐Ÿ›‘

๐Ÿ’… PARAMETERS ๐Ÿ’…

  • min โ€” Average queue size at which marking becomes a possibility. Defaults to max /3. ๐ŸŒฑ
  • max โ€” At this average queue size, the marking probability is maximal. Should be at least twice min to prevent synchronous retransmits, and higher for a low min. Defaults to limit /4. ๐Ÿ”ฅ
  • probability โ€” Maximum probability for marking, specified as a floating point number from 0.0 to 1.0. Suggested values are 0.01 or 0.02 (that's 1% or 2%, respectively). Default: 0.02. ๐ŸŽฒ
  • limit โ€” Hard limit on the real (not average!) queue size, in bytes. Further packets get dropped. Should be set higher than max+burst. It is advised to set this a few times higher than max. โš ๏ธ
  • burst โ€” Used for determining how fast the average queue size is influenced by the real queue size. Larger values make the calculation more sluggish, allowing longer bursts of traffic before marking starts. Real life experiments support the following guideline: (min+min+max)/(3*avpkt). ๐ŸŒ€
  • avpkt โ€” Specified in bytes. Used together with burst to determine the time constant for average queue size calculations. 1000 is a good value. ๐Ÿ“
  • bandwidth โ€” This rate is used for calculating the average queue size after some idle time. Should be set to the bandwidth of your interface. > ๐Ÿšจ It does not mean that RED will shape for you! Optional. Default: 10Mbit.
  • ecn โ€” As mentioned before, RED can either 'mark' or 'drop'. Explicit Congestion Notification allows RED to notify remote hosts that their rate exceeds the amount of bandwidth available. Non-ECN capable hosts can only be notified by dropping a packet. If this parameter is specified, packets which indicate that their hosts honor ECN will only be marked and not dropped โ€” unless the queue size hits limit bytes. Recommended. ๐Ÿ’–
  • harddrop โ€” If the average flow queue size is above max bytes, this parameter forces a drop instead of an ECN marking. ๐Ÿ’€
  • nodrop โ€” With this parameter, traffic that should be marked, but is not ECN-capable, is enqueued. Without the parameter, it is early-dropped. ๐Ÿ™ˆ
  • adaptive โ€” (Added in linux-3.3) Sets RED in adaptive mode, as described in http://icir.org/floyd/papers/adaptiveRed.pdf. The goal of Adaptive RED is to make probability a dynamic value between 1% and 50%, to reach the target average queue: (max - min) / 2. ๐Ÿฆ‹

โญ QEVENTS โญ

See tc (8) for some general notes about qevents. The RED qdisc supports the following qevents:

  • early_drop โ€” The associated block is executed when packets are early-dropped. This includes non-ECT packets in ECN mode. ๐Ÿ˜ญ
  • mark โ€” The associated block is executed when packets are marked in ECN mode. โœจ

๐ŸŒˆ EXAMPLE ๐ŸŒˆ

# tc qdisc add dev eth0 parent 1:1 handle 10: red
 limit 400000 min 30000 max 90000 avpkt 1000
 burst 55 ecn adaptive bandwidth 10Mbit

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

tc(8), tc-choke(8)


๐Ÿ“š SOURCES ๐Ÿ“š


๐Ÿซถ AUTHORS ๐Ÿซถ

Alexey N. Kuznetsov, <kuznet@ms2.inr.ac.ru>, Alexey Makarenko <makar@phoenix.kharkov.ua>, J Hadi Salim <hadi@nortelnetworks.com>, Eric Dumazet <eric.dumazet@gmail.com>. This manpage maintained by bert hubert <ahu@ds9a.nl>


and that's the whole page bestie, no crumbs left ๐Ÿ’œ โ€” this one shipped with iproute2, dated 13 December 2001, and it's still eating to this day. slay. ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from