idnits 2.17.1 draft-ietf-aqm-codel-09.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (September 29, 2017) is 2373 days in the past. Is this intentional? Checking references for intended status: Experimental ---------------------------------------------------------------------------- -- Looks like a reference, but probably isn't: '1' on line 1070 == Unused Reference: 'BMPFQ' is defined on line 995, but no explicit reference was found in the text == Unused Reference: 'SFQ1990' is defined on line 1051, but no explicit reference was found in the text -- Obsolete informational reference (is this intentional?): RFC 2309 (Obsoleted by RFC 7567) -- Obsolete informational reference (is this intentional?): RFC 2581 (Obsoleted by RFC 5681) -- Obsolete informational reference (is this intentional?): RFC 896 (Obsoleted by RFC 7805) Summary: 0 errors (**), 0 flaws (~~), 3 warnings (==), 5 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 AQM K. Nichols 3 Internet-Draft Pollere, Inc. 4 Intended status: Experimental V. Jacobson 5 Expires: April 2, 2018 A. McGregor, ed. 6 J. Iyengar, ed. 7 Google 8 September 29, 2017 10 Controlled Delay Active Queue Management 11 draft-ietf-aqm-codel-09 13 Abstract 15 This document describes a general framework called CoDel (Controlled 16 Delay) that controls bufferbloat-generated excess delay in modern 17 networking environments. CoDel consists of an estimator, a setpoint, 18 and a control loop. It requires no configuration in normal Internet 19 deployments. 21 Status of This Memo 23 This Internet-Draft is submitted in full conformance with the 24 provisions of BCP 78 and BCP 79. 26 Internet-Drafts are working documents of the Internet Engineering 27 Task Force (IETF). Note that other groups may also distribute 28 working documents as Internet-Drafts. The list of current Internet- 29 Drafts is at https://datatracker.ietf.org/drafts/current/. 31 Internet-Drafts are draft documents valid for a maximum of six months 32 and may be updated, replaced, or obsoleted by other documents at any 33 time. It is inappropriate to use Internet-Drafts as reference 34 material or to cite them other than as "work in progress." 36 This Internet-Draft will expire on April 2, 2018. 38 Copyright Notice 40 Copyright (c) 2017 IETF Trust and the persons identified as the 41 document authors. All rights reserved. 43 This document is subject to BCP 78 and the IETF Trust's Legal 44 Provisions Relating to IETF Documents 45 (https://trustee.ietf.org/license-info) in effect on the date of 46 publication of this document. Please review these documents 47 carefully, as they describe your rights and restrictions with respect 48 to this document. Code Components extracted from this document must 49 include Simplified BSD License text as described in Section 4.e of 50 the Trust Legal Provisions and are provided without warranty as 51 described in the Simplified BSD License. 53 Table of Contents 55 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 56 2. Conventions and terms used in this document . . . . . . . . . 4 57 3. Understanding the Building Blocks of Queue Management . . . . 5 58 3.1. Estimator . . . . . . . . . . . . . . . . . . . . . . . . 6 59 3.2. Target Setpoint . . . . . . . . . . . . . . . . . . . . . 8 60 3.3. Control Loop . . . . . . . . . . . . . . . . . . . . . . 10 61 4. Overview of the Codel AQM . . . . . . . . . . . . . . . . . . 12 62 4.1. Non-starvation . . . . . . . . . . . . . . . . . . . . . 13 63 4.2. Setting INTERVAL . . . . . . . . . . . . . . . . . . . . 13 64 4.3. Setting TARGET . . . . . . . . . . . . . . . . . . . . . 14 65 4.4. Use with multiple queues . . . . . . . . . . . . . . . . 15 66 4.5. Setting up CoDel . . . . . . . . . . . . . . . . . . . . 15 67 5. Annotated Pseudo-code for CoDel AQM . . . . . . . . . . . . . 16 68 5.1. Data Types . . . . . . . . . . . . . . . . . . . . . . . 16 69 5.2. Per-queue state (codel_queue_t instance variables) . . . 17 70 5.3. Constants . . . . . . . . . . . . . . . . . . . . . . . . 17 71 5.4. Enqueue routine . . . . . . . . . . . . . . . . . . . . . 17 72 5.5. Dequeue routine . . . . . . . . . . . . . . . . . . . . . 17 73 5.6. Helper routines . . . . . . . . . . . . . . . . . . . . . 19 74 5.7. Implementation considerations . . . . . . . . . . . . . . 20 75 6. Further Experimentation . . . . . . . . . . . . . . . . . . . 21 76 7. Security Considerations . . . . . . . . . . . . . . . . . . . 21 77 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 21 78 9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 21 79 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 22 80 10.1. Normative References . . . . . . . . . . . . . . . . . . 22 81 10.2. Informative References . . . . . . . . . . . . . . . . . 22 82 10.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 23 83 Appendix A. Applying CoDel in the datacenter . . . . . . . . . . 24 84 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 25 86 1. Introduction 88 The "persistently full buffer" problem has been discussed in the IETF 89 community since the early 80's [RFC896]. The IRTF's End-to-End 90 Working Group called for the deployment of active queue management 91 (AQM) to solve the problem in 1998 [RFC2309]. Despite this 92 awareness, the problem has only gotten worse as Moore's Law growth in 93 memory density fueled an exponential increase in buffer pool size. 94 Efforts to deploy AQM have been frustrated by difficult configuration 95 and negative impact on network utilization. This "bufferbloat" 96 problem [TSV2011] [BB2011] has become increasingly important 97 throughout the Internet but particularly at the consumer edge. Queue 98 management has become more critical due to increased consumer use of 99 the Internet, mixing large video transactions with time-critical VoIP 100 and gaming. 102 An effective AQM remediates bufferbloat at a bottleneck while "doing 103 no harm" at hops where buffers are not bloated. The development and 104 deployment of AQM however is frequently subject to misconceptions 105 about the cause of packet queues in network buffers. Network buffers 106 exist to absorb the packet bursts that occur naturally in 107 statistically multiplexed networks. Buffers helpfully absorb the 108 queues created by such reasonable packet network behavior as short- 109 term mismatches in traffic arrival and departure rates that arise 110 from upstream resource contention, transport conversation startup 111 transients and/or changes in the number of conversations sharing a 112 link. Unfortunately, other less useful network behaviors can cause 113 queues to fill and their effects are not nearly as benign. 114 Discussion of these issues and the reason why the solution is not 115 simply smaller buffers can be found in [RFC2309], [VANQ2006], 116 [REDL1998], and [CODEL2012]. To understand queue management, it is 117 critical to understand the difference between the necessary, useful 118 "good" queue, and the counterproductive "bad" queue. 120 Several approaches to AQM have been developed over the past two 121 decades but none has been widely deployed due to performance 122 problems. When designed with the wrong conceptual model for queues, 123 AQMs have limited operational range, require a lot of configuration 124 tweaking, and frequently impair rather than improve performance. 125 Learning from this past history, the CoDel approach is designed to 126 meet the following goals: 128 o parameterless for normal operation - has no knobs for operators, 129 users, or implementers to adjust 131 o treat "good queue" and "bad queue" differently, that is, keep 132 delay low while permitting necessary bursts of traffic 134 o control delay while insensitive (or nearly so) to round trip 135 delays, link rates and traffic loads; this goal is to "do no harm" 136 to network traffic while controlling delay 138 o adapt to dynamically changing link rates with no negative impact 139 on utilization 141 o simple and efficient implementation (can easily span the spectrum 142 from low-end access points and home routers up to high-end router 143 silicon) 145 CoDel has five major differences from prior AQMs: use of local queue 146 minimum to track congestion ("bad queue"), use of an efficient single 147 state variable representation of that tracked statistic, use of 148 packet sojourn time as the observed datum, rather than packets, 149 bytes, or rates, use of mathematically determined setpoint derived 150 from maximizing network power [KLEIN81], and a modern state space 151 controller. 153 CoDel configures itself based on a round-trip time metric which can 154 be set to 100ms for the normal, terrestrial Internet. With no 155 changes to parameters, CoDel is expected to work across a wide range 156 of conditions, with varying links and the full range of terrestrial 157 round trip times. 159 CoDel is easily adapted to multiple queue systems as shown by [FQ- 160 CODEL-ID]. Implementers and users SHOULD use the fq_codel multiple- 161 queue approach as it deals with many problems beyond the reach of an 162 AQM on a single queue. 164 CoDel was first published in [CODEL2012] and has been implemented in 165 the Linux kernel. 167 Note that while this document refers to dropping packets when 168 indicated by CoDel, it is reasonable to ECN-mark packets instead as 169 well. 171 2. Conventions and terms used in this document 173 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 174 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 175 document are to be interpreted as described in [RFC2119]. 177 In this document, these words will appear with that interpretation 178 only when in ALL CAPS. Lower case uses of these words are not to be 179 interpreted as carrying [RFC2119] significance. 181 The following terms are defined as used in this document: 183 sojourn time: the amount of time a packet has spent in a particular 184 buffer, i.e. the time a packet departs the buffer minus the time the 185 packet arrived at the buffer. A packet can depart a buffer via 186 transmission or drop. 188 standing queue: a queue (in packets, bytes, or time delay) in a 189 buffer that persists for a "long" time where "long" is on the order 190 of the longer round trip times through the buffer as discussed in 191 section 4.2. A standing queue occurs when the minimum queue over the 192 "long" time is nonzero and is usually tolerable and even desirable as 193 long as it does not exceed some target delay. 195 bottleneck bandwidth: the limiting bandwidth along a network path. 197 3. Understanding the Building Blocks of Queue Management 199 At the heart of queue management is the notion of "good queue" and 200 "bad queue" and the search for ways to get rid of the bad queue 201 (which only adds delay) while preserving the good queue (which 202 provides for good utilization). This section explains queueing, both 203 good and bad, and covers the CoDel building blocks that can be used 204 to manage packet buffers to keep their queues in the "good" range. 206 Packet queues form in buffers facing bottleneck links, i.e., where 207 the line rate goes from high to low or where many links converge. 208 The well-known bandwidth-delay product (sometimes called "pipe size") 209 is the bottleneck's bandwidth multiplied by the sender-receiver- 210 sender round-trip delay, and is the amount of data that has to be in 211 transit between two hosts in order to run the bottleneck link at 100% 212 utilization. To explore how queues can form, consider a long-lived 213 TCP connection with a 25 packet window sending through a connection 214 with a bandwidth-delay product of 20 packets. After an initial burst 215 of packets the connection will settle into a five packet (+/-1) 216 standing queue; this standing queue size is determined by the 217 mismatch between the window size and the pipe size, and is unrelated 218 to the connection's sending rate. The connection has 25 packets in 219 flight at all times, but only 20 packets arrive at the destination 220 over a round trip time. If the TCP connection has a 30 packet 221 window, the queue will be ten packets with no change in sending rate. 222 Similarly, if the window is 20 packets, there will be no queue but 223 the sending rate is the same. Nothing can be inferred about the 224 sending rate from the queue size, and any queue other than transient 225 bursts only creates delays in the network. The sender needs to 226 reduce the number of packets in flight rather than sending rate. 228 In the above example, the five packet standing queue can be seen to 229 contribute nothing but delay to the connection, and thus is clearly 230 "bad queue". If, in our example, there is a single bottleneck link 231 and it is much slower than the link that feeds it (say, a high-speed 232 ethernet link into a limited DSL uplink) a 20 packet buffer at the 233 bottleneck might be necessary to temporarily hold the 20 packets in 234 flight to keep the bottleneck link's utilization high. The burst of 235 packets should drain completely (to 0 or 1 packets) within a round 236 trip time and this transient queue is "good queue" because it allows 237 the connection to keep the 20 packets in flight and for the 238 bottleneck link to be fully utilized. In terms of the delay 239 experienced, the "good queue" goes away in about a round trip time, 240 while "bad queue" hangs around for longer, causing delays. 242 Effective queue management detects "bad queue" while ignoring "good 243 queue" and takes action to get rid of the bad queue when it is 244 detected. The goal is a queue controller that accomplishes this 245 objective. To control a queue, we need three basic components 247 o Estimator - figure out what we've got 249 o Target setpoint - know what we want 251 o Control loop - if what we've got isn't what we want, we need a way 252 to move it there 254 3.1. Estimator 256 The estimator both observes the queue and detects when good queue 257 turns to bad queue and vice versa. CoDel has two parts to its 258 estimator: what is observed as an indicator of queue and how the 259 observations are used to detect good/bad queue. 261 Queue length has been widely used as an observed indicator of 262 congestion and is frequently conflated with sending rate. Use of 263 queue length as a metric is sensitive to how and when the length is 264 observed. A high speed arrival link to a buffer serviced at a much 265 lower rate can rapidly build up a queue that might disperse 266 completely or down to a single packet before a round trip time has 267 elapsed. If the queue length is monitored at packet arrival (as in 268 original RED) or departure time, every packet will see a queue with 269 one possible exception. If the queue length itself is time sampled 270 (as recommended in [REDL1998], a truer picture of the queue's 271 occupancy can be gained at the expense of considerable implementation 272 complexity. 274 The use of queue length is further complicated in networks that are 275 subject to both short and long term changes in available link rate 276 (as in WiFi). Link rate drops can result in a spike in queue length 277 that should be ignored unless it persists. It is not the queue 278 length that should be controlled but the amount of excess delay 279 packets experience due to a persistent or standing queue, which means 280 that the packet sojourn time in the buffer is exactly what we want to 281 track. Tracking the packet sojourn times in the buffer observes the 282 actual delay experienced by each packet. Sojourn time allows queue 283 management to be independent of link rate, gives superior performance 284 to use of buffer size, and is directly related to user-visible 285 performance. It works regardless of line rate changes or link 286 sharing by multiple queues (which the individual queues may 287 experience as changing rates). 289 Consider a link shared by two queues with different priorities. 290 Packets that arrive at the high priority queue are sent as soon as 291 the link is available while packets in the other queue have to wait 292 until the high priority queue is empty (i.e., a strict priority 293 scheduler). The number of packets in the high priority queue might 294 be large but the queue is emptied quickly and the amount of time each 295 packet spends enqueued (the sojourn time) is not large. The other 296 queue might have a smaller number of packets, but packet sojourn 297 times will include the waiting time for the high priority packets to 298 be sent. This makes the sojourn time a good sample of the congestion 299 that each separate queue is experiencing. This example also shows 300 how the metric of sojourn time is independent of the number of queues 301 or the service discipline used, and is instead indicative of 302 congestion seen by the individual queues. 304 How can observed sojourn time be used to separate good queue from bad 305 queue? Although averages, especially of queue length, have 306 previously been widely used as an indicator of bad queue, their 307 efficacy is questionable. Consider the burst that disperses every 308 round trip time. The average queue will be one-half the burst size, 309 though this might vary depending on when the average is computed and 310 the timing of arrivals. The average queue sojourn time would be one- 311 half the time it takes to clear the burst. The average then would 312 indicate a persistent queue where there is none. Instead of averages 313 we recommend tracking the minimum sojourn time, then, if there is one 314 packet that has a zero sojourn time then there is no persistent 315 queue. The value of the minimum in detecting persistent queue is 316 apparent when looking at graphs of queue delay. 318 A persistent queue can be detected by tracking the (local) minimum 319 queue delay packets experience. To ensure that this minimum value 320 does not become stale, it has to have been experienced recently, i.e. 321 during an appropriate past time interval. This interval is the 322 maximum amount of time a minimum value is considered to be in effect, 323 and is related to the amount of time it takes for the largest 324 expected burst to drain. Conservatively, this interval SHOULD be at 325 least a round trip time to avoid falsely detecting a persistent queue 326 and not a lot more than a round trip time to avoid delay in detecting 327 the persistent queue. This suggests that the appropriate interval 328 value is the maximum round-trip time of all the connections sharing 329 the buffer. 331 (The following key insight makes computation of the local minimum 332 efficient: It is sufficient to keep a single state variable of how 333 long the minimum has been above or below the target value rather than 334 retaining all the local values to compute the minimum, leading to 335 both storage and computational savings. We use this insight in the 336 pseudo-code for CoDel later in the document.) 338 These two parts, use of sojourn time as observed values and the local 339 minimum as the statistic to monitor queue congestion are key to 340 CoDel's estimator building block. The local minimum sojourn time 341 provides an accurate and robust measure of standing queue and has an 342 efficient implementation. In addition, use of the minimum sojourn 343 time has important advantages in implementation. The minimum packet 344 sojourn can only be decreased when a packet is dequeued which means 345 that all the work of CoDel can take place when packets are dequeued 346 for transmission and that no locks are needed in the implementation. 347 The minimum is the only statistic with this property. 349 A more detailed explanation with many pictures can be found in 350 http://www.ietf.org/proceedings/84/slides/slides-84-tsvarea-4.pdf 351 [1]. 353 3.2. Target Setpoint 355 Now that we have a robust way of detecting standing queue, we need a 356 target setpoint that tells us when to act. If the controller is set 357 to take action as soon as the estimator has a non-zero value, the 358 average drop rate will be maximized, which minimizes TCP goodput 359 [MACTCP1997]. Also, this policy results in no backlog over time (no 360 persistent queue), which negates much of the value of having a 361 buffer, since it maximizes the bottleneck link bandwidth lost due to 362 normal stochastic variation in packet interarrival time. We want a 363 target that maximizes utilization while minimizing delay. Early in 364 the history of packet networking, Kleinrock developed the analytic 365 machinery to do this using a quantity he called 'power', which is the 366 ratio of a normalized throughput to a normalized delay [KLEIN81]. 368 It is straightforward to derive an analytic expression for the 369 average goodput of a TCP conversation at a given round-trip time r 370 and target f (where f is expressed as a fraction of r). Reno TCP, 371 for example, yields: 373 goodput = r (3 + 6f - f^2) / (4 (1+f)) 375 Since the peak queue delay is simply the product of f and r, power is 376 solely a function of f since the r's in the numerator and denominator 377 cancel: 379 power is proportional to (1 + 2f - 1/3 f^2) / (1 + f)^2 380 As Kleinrock observed, the best operating point, in terms of 381 bandwidth / delay tradeoff, is the peak power point, since points off 382 the peak represent a higher cost (in delay) per unit of bandwidth. 383 The power vs. f curve for any Additive Increase Multiplicative 384 Decrease (AIMD) TCP is monotone decreasing. But the curve is very 385 flat for f < 0.1 followed by a increasing curvature with a knee 386 around f = 0.2, then a steep, almost linear fall off [TSV84]. Since 387 the previous equation showed that goodput is monotone increasing with 388 f, the best operating point is near the right edge of the flat top 389 since that represents the highest goodput achievable for a negligible 390 increase in delay. However, since the r in the model is a 391 conservative upper bound, a target of 0.1r runs the risk of pushing 392 shorter RTT connections over the knee and giving them higher delay 393 for no significant goodput increase. Generally, a more conservative 394 target of 0.05r offers a good utilization vs. delay tradeoff while 395 giving enough headroom to work well with a large variation in real 396 RTT. 398 As the above analysis shows, a very small standing queue gives close 399 to 100% utilization of the bottleneck link. While this result was 400 for Reno TCP, the derivation uses only properties that must hold for 401 any 'TCP friendly' transport. We have verified by both analysis and 402 simulation that this result holds for Reno, Cubic, and Westwood 403 [TSV84]. This results in a particularly simple form for the target: 404 the ideal range for the permitted standing queue, or the target 405 setpoint, is between 5% and 10% of the TCP connection's RTT. 407 We used simulation to explore the impact when TCPs are mixed with 408 other traffic and with connections of different RTTs. Accordingly, 409 we experimented extensively with values in the 5-10% of RTT range 410 and, overall, used target values between 1 and 20 milliseconds for 411 RTTs from 30 to 500ms and link bandwidths of 64Kbps to 100Mbps to 412 experimentally explore a value for the target that gives consistently 413 high utilization while controlling delay across a range of 414 bandwidths, RTTs, and traffic loads. Our results were notably 415 consistent with the mathematics above. 417 A congested (but not overloaded) CoDel link with traffic composed 418 solely or primarily of long-lived TCP flows will have a median delay 419 through the link will tend to the target. For bursty traffic loads 420 and for overloaded conditions (where it is difficult or impossible 421 for all the arriving flows to be accommodated) the median queues will 422 be longer than the target. 424 The non-starvation drop inhibit feature dominates where the link rate 425 becomes very small. By inhibiting drops when there is less than an 426 (outbound link) MTU worth of bytes in the buffer, CoDel adapts to 427 very low bandwidth links, as shown in [CODEL2012]. 429 3.3. Control Loop 431 Section 3.1 describes a simple, reliable way to measure bad 432 (persistent) queue. Section 3.2 shows that TCP congestion control 433 dynamics gives rise to a target setpoint for this measure that's a 434 provably good balance between enhancing throughput and minimizing 435 delay, and that this target is a constant fraction of the same 436 'largest average RTT' interval used to distinguish persistent from 437 transient queue. The only remaining building block needed for a 438 basic AQM is a 'control loop' algorithm to effectively drive the 439 queueing system from any 'persistent queue above the target' state to 440 a state where the persistent queue is below the target. 442 Control theory provides a wealth of approaches to the design of 443 control loops. Most of classical control theory deals with the 444 control of linear, time-invariant, single-input-single-output (SISO) 445 systems. Control loops for these systems generally come from a (well 446 understood) class known as Proportional-Integral-Derivative (PID) 447 controllers. Unfortunately, a queue is not a linear system and an 448 AQM operates at the point of maximum non-linearity (where the output 449 link bandwidth saturates so increased demand creates delay rather 450 than higher utilization). Output queues are also not time-invariant 451 since traffic is generally a mix of connections which start and stop 452 at arbitrary times and which can have radically different behaviors 453 ranging from "open loop" UDP audio/video to "closed-loop" congestion- 454 avoiding TCP. Finally, the constantly changing mix of connections 455 (which can't be converted to a single 'lumped parameter' model 456 because of their transfer function differences) makes the system 457 multi-input-multi-output (MIMO), not SISO. 459 Since queueing systems match none of the prerequisites for a 460 classical controller, a modern state-space controller is a better 461 approach with states 'no persistent queue' and 'has persistent 462 queue'. Since Internet traffic mixtures change rapidly and 463 unpredictably, a noise and error tolerant adaptation algorithm like 464 Stochastic Gradient is a good choice. Since there's essentially no 465 information in the amount of persistent queue [TSV84], the adaptation 466 should be driven by how long it has persisted. 468 Consider the two extremes of traffic behavior, a single open-loop UDP 469 video stream and a single, long-lived TCP bulk data transfer. If the 470 average bandwidth of the UDP video stream is greater that the 471 bottleneck link rate, the link's queue will grow and the controller 472 will eventually enter 'has persistent queue' state and start dropping 473 packets. Since the video stream is open loop, its arrival rate is 474 unaffected by drops so the queue will persist until the average drop 475 rate is greater than the output bandwidth deficit (= average arrival 476 rate - average departure rate) so the job of the adaptation algorithm 477 is to discover this rate. For this example, the adaptation could 478 consist of simply estimating the arrival and departure rates then 479 dropping at a rate slightly greater than their difference. But this 480 class of algorithm won't work at all for the bulk data TCP stream. 481 TCP runs in closed-loop flow balance [TSV84] so its arrival rate is 482 almost always exactly equal to the departure rate - the queue isn't 483 the result of a rate imbalance but rather a mismatch between the TCP 484 sender's window and the source-destination-source round-trip path 485 capacity (i.e., the connection's bandwidth-delay product). The 486 sender's TCP congestion avoidance algorithm will slowly increase the 487 send window (one packet per round-trip-time) [RFC2581] which will 488 eventually cause the bottleneck to enter 'has persistent queue' 489 state. But, since the average input rate is the same as the average 490 output rate, the rate deficit estimation that gave the correct drop 491 rate for the video stream would compute a drop rate of zero for the 492 TCP stream. However, if the output link drops one packet as it 493 enters 'has persistent queue' state, when the sender discovers this 494 (via TCP's normal packet loss repair mechanisms) it will reduce its 495 window by a factor of two [RFC2581] so, one round-trip-time after the 496 drop, the persistent queue will go away. 498 If there were N TCP conversations sharing the bottleneck, the 499 controller would have to drop O(N) packets, one from each 500 conversation, to make all the conversations reduce their window to 501 get rid of the persistent queue. If the traffic mix consists of 502 short (<= bandwidth-delay product) conversations, the aggregate 503 behavior becomes more like the open-loop video example since each 504 conversation is likely to have already sent all its packets by the 505 time it learns about a drop so each drop has negligible effect on 506 subsequent traffic. 508 The controller does not know the number, duration, or kind of 509 conversations creating its queue, so it has to learn the appropriate 510 response. Since single drops can have a large effect if the degree 511 of multiplexing (the number of active conversations) is small, 512 dropping at too high a rate is likely to have a catastrophic effect 513 on throughput. Dropping at a low rate (< 1 packet per round-trip- 514 time) then increasing the drop rate slowly until the persistent queue 515 goes below the target is unlikely to overdrop and is guaranteed to 516 eventually dissipate the persistent queue. This stochastic gradient 517 learning procedure is the core of CoDel's control loop (the gradient 518 exists because a drop always reduces the (instantaneous) queue so an 519 increasing drop rate always moves the system "down" toward no 520 persistent queue, regardless of traffic mix). 522 The "next drop time" is decreased in inverse proportion to the square 523 root of the number of drops since the drop state was entered, using 524 the well-known nonlinear relationship of drop rate to throughput to 525 get a linear change in throughput [REDL1998], [MACTCP1997]. 527 Since the best rate to start dropping is at slightly more than one 528 packet per RTT, the controller's initial drop rate can be directly 529 derived from the estimator's interval. When the minimum sojourn time 530 first crosses the target and CoDel drops a packet, the earliest the 531 controller could see the effect of the drop is the round trip time 532 (interval) + the local queue wait time (the target). If the next 533 drop happens any earlier than this time (interval + target), CoDel 534 will overdrop. In practice, the local queue waiting time tends to 535 vary, so making the initial drop spacing (i.e., the time to the 536 second drop) be exactly the minimum possible also leads to 537 overdropping. Analysis of simulation and real-world measured data 538 shows that the 75th percentile magnitude of this variation is less 539 than the target, and so the initial drop spacing SHOULD be set to the 540 estimator's interval (i.e., initial drop spacing = interval) to 541 ensure that the controller has accounted for acceptable congestion 542 delays. 544 Use of the minimum statistic lets the controller be placed in the 545 dequeue routine with the estimator. This means that the control 546 signal (the drop) can be sent at the first sign of bad queue (as 547 indicated by the sojourn time) and that the controller can stop 548 acting as soon as the sojourn time falls below the target. Dropping 549 at dequeue has both implementation and control advantages. 551 4. Overview of the Codel AQM 553 CoDel was initially designed as a bufferbloat solution for the 554 consumer network edge. The CoDel building blocks are able to adapt 555 to different or time-varying link rates, to be easily used with 556 multiple queues, to have excellent utilization with low delay, and to 557 have a simple and efficient implementation. 559 The CoDel algorithm described in the rest of this document uses two 560 key variables: TARGET, which is the controller's target setpoint 561 described in Section 3.2 and INTERVAL, which is the estimator's 562 interval described in Section 3.3. 564 The only setting CoDel requires is the INTERVAL value, and as 100ms 565 satisfies that definition for normal Internet usage, CoDel can be 566 parameter-free for consumer use. To ensure that link utilization is 567 not adversely affected, CoDel's estimator sets TARGET to one that 568 optimizes power. CoDel's controller does not drop packets when the 569 drop would leave the queue empty or with fewer than a maximum 570 transmission unit (MTU) worth of bytes in the buffer. Section 3.2 571 shows that an ideal TARGET is 5-10% of the connection round trip time 572 (RTT). In the open terrestrial-based Internet, especially at the 573 consumer edge, we expect most unbloated RTTs to have a ceiling of 574 100ms [CHARB2007]. Using this RTT gives a minimum TARGET of 5ms and 575 INTERVAL of 100ms. In practice, uncongested links will see sojourn 576 times below TARGET more often than once per RTT, so the estimator is 577 not overly sensitive to the value of INTERVAL. 579 When the estimator finds a persistent delay above TARGET, the 580 controller enters the drop state where a packet is dropped and the 581 next drop time is set. As discussed in section 3.3, the initial next 582 drop spacing is intended to be long enough to give the endpoints time 583 to react to the single drop so SHOULD be set to a value equal to 584 INTERVAL. If the estimator's output falls below TARGET, the 585 controller cancels the next drop and exits the drop state. (The 586 controller is more sensitive than the estimator to an overly short 587 INTERVAL value, since an unnecessary drop would occur and lower link 588 utilization.) If next drop time is reached while the controller is 589 still in drop state, the packet being dequeued is dropped and the 590 next drop time is recalculated. 592 Additional logic prevents re-entering the drop state too soon after 593 exiting it and resumes the drop state at a recent control level, if 594 one exists. This logic is described more precisely in the pseudo- 595 code below. Additional work is required to determine the frequency 596 and importance of re-entering the drop state. 598 Note that CoDel AQM only enters its drop state when the local minimum 599 sojourn delay has exceeded TARGET for a time period long enough for 600 normal bursts to dissipate, ensuring that a burst of packets that 601 fits in the pipe will not be dropped. 603 4.1. Non-starvation 605 CoDel's goals are to control delay with little or no impact on link 606 utilization and to be deployed on a wide range of link bandwidths, 607 including variable-rate links, without reconfiguration. To keep from 608 making drops when it would starve the output link, CoDel makes 609 another check before dropping to see if at least an MTU worth of 610 bytes remains in the buffer. If not, the packet SHOULD NOT be 611 dropped and, therefore, CoDel exits the drop state. The MTU size can 612 be set adaptively to the largest packet seen so far or can be read 613 from the interface driver. 615 4.2. Setting INTERVAL 617 The INTERVAL value is chosen to give endpoints time to react to a 618 drop without being so long that response times suffer. CoDel's 619 estimator, TARGET, and control loop all use INTERVAL. Understanding 620 their derivation shows that CoDel is the most sensitive to the value 621 of INTERVAL for single long-lived TCPs with a decreased sensitivity 622 for traffic mixes. This is fortunate as RTTs vary across connections 623 and are not known a priori. The best policy seems to be to use an 624 INTERVAL value slightly larger than the RTT seen by most of the 625 connections using a link, a value that can be determined as the 626 largest RTT seen if the value is not an outlier (use of a 95-99th 627 percentile value should work). In practice, this value is not known 628 or measured (though see section 6.2 for an application where INTERVAL 629 is measured). An INTERVAL setting of 100ms works well across a range 630 of RTTs from 10ms to 1 second (excellent performance is achieved in 631 the range from 10 ms to 300ms). For devices intended for the normal 632 terrestrial Internet, INTERVAL SHOULD have a value of 100ms. This 633 will only cause overdropping where a long-lived TCP has an RTT longer 634 than 100ms and there is little or no mixing with other connections 635 through the link. 637 4.3. Setting TARGET 639 TARGET is the maximum acceptable persistent queue delay above which 640 CoDel is dropping or preparing to drop and below which CoDel will not 641 drop. TARGET SHOULD be set to 5ms for normal Internet traffic. 643 The calculations of section 3.2 show that the best TARGET value is 644 5-10% of the RTT, with the low end of 5% preferred. Extensive 645 simulations exploring the impact of different TARGET values when used 646 with mixed traffic flows with different RTTs and different bandwidths 647 show that below a TARGET of 5ms, utilization suffers for some 648 conditions and traffic loads, and above 5ms showed very little or no 649 improvement in utilization. 651 Sojourn times must remain above the TARGET for INTERVAL amount of 652 time in order to enter the drop state. Any packet with a sojourn 653 time less than TARGET will reset the time that the queue was last 654 below TARGET. Since Internet traffic has very dynamic 655 characteristics, the actual sojourn delay experienced by packets 656 varies greatly and is often less than TARGET unless the overload is 657 excessive. When a link is not overloaded, it is not a bottleneck and 658 packet sojourn times will be small or nonexistent. In the usual 659 case, there are only one or two places along a path where packets 660 will encounter a bottleneck (usually at the edge), so the total 661 amount of queueing delay experienced by a packet should be less than 662 10ms even under extremely congested conditions. This net delay is 663 substantially lower than common current queueing delays on the 664 Internet that grow to orders of seconds [NETAL2010, CHARB2007]. 666 A note on the roles of TARGET and the minimum-tracking INTERVAL. 667 TARGET SHOULD NOT be increased in response to lower layers that have 668 a bursty nature, where packets are transmitted for short periods 669 interspersed with idle periods where the link is waiting for 670 permission to send. CoDel's estimator will "see" the effective 671 transmission rate over an INTERVAL amount of time, and increasing 672 TARGET only leads to longer queue delays. On the other hand, where a 673 significant additional delay is added to the intrinsic RTT of most or 674 all packets due to the waiting time for a transmission, it is 675 necessary to increase INTERVAL by that extra delay. TARGET SHOULD 676 NOT be adjusted for such short-term bursts, but INTERVAL MAY need to 677 be adjusted if the path's intrinsic RTT changes. 679 4.4. Use with multiple queues 681 CoDel is easily adapted to multiple queue systems. With other 682 approaches there is always a question of how to account for the fact 683 that each queue receives less than the full link rate over time and 684 usually sees a varying rate over time. This is what CoDel excels at: 685 using a packet's sojourn time in the buffer completely circumvents 686 this problem. In a multiple-queue setting, a separate CoDel 687 algorithm runs on each queue, but each CoDel instance uses the packet 688 sojourn time the same way a single-queue CoDel does. Just as a 689 single-queue CoDel adapts to changing link bandwidths [CODEL2012], so 690 does a multiple-queue CoDel system. As an optimization to avoid 691 queueing more than necessary, when testing for queue occupancy before 692 dropping, the total occupancy of all queues sharing the same output 693 link SHOULD be used. This property of CoDel has been exploited in 694 fq_codel [FQ-CODEL-ID], which hashes on the packet header fields to 695 determine a specific bin, or sub-queue, for the packet, and runs 696 CoDel on each bin or sub-queue thus creating a well-mixed output flow 697 and obviating issues of reverse path flows (including "ack 698 compression"). Packets arriving at a full buffer SHOULD be dropped. 700 4.5. Setting up CoDel 702 CoDel is set for use in devices in the open Internet. An INTERVAL 703 setting of 100ms is used, TARGET is set to 5% of INTERVAL, and the 704 initial drop spacing is also set to the INTERVAL. These settings 705 have been chosen so that a device, such as a small WiFi router, can 706 be sold without the need for any values to be made adjustable, 707 yielding a parameterless implementation. In addition, CoDel is 708 useful in environments with significantly different characteristics 709 from the normal Internet, for example, in switches used as a cluster 710 interconnect within a data center. Since cluster traffic is entirely 711 internal to the data center, round trip latencies are low (typically 712 <100us) but bandwidths are high (1-40Gbps) so it's relatively easy 713 for the aggregation phase of a distributed computation (e.g., the 714 Reduce part of a Map/Reduce) to persistently fill then overflow the 715 modest per-port buffering available in most high speed switches. A 716 CoDel configured for this environment (TARGET and INTERVAL in the 717 microsecond rather than millisecond range) can minimize drops or ECN 718 marks while keeping throughput high and latency low. 720 Devices destined for these environments MAY use a different value for 721 INTERVAL, where suitable. If appropriate analysis indicates, the 722 TARGET MAY be set to some other value in the 5-10% of INTERVAL and 723 the initial drop spacing MAY be set to a value of 1.0 to 1.2 times 724 INTERVAL. But these settings will cause problems such as 725 overdropping and low throughput if used on the open Internet, so 726 devices that allow CoDel to be configured SHOULD default to Internet- 727 appropriate values given in this document. 729 5. Annotated Pseudo-code for CoDel AQM 731 What follows is the CoDel algorithm in C++-like pseudo-code. Since 732 CoDel adds relatively little new code to a basic tail-drop fifo- 733 queue, we have attempted to highlight just these additions by 734 presenting CoDel as a sub-class of a basic fifo-queue base class. 735 The reference code is included to aid implementers who wish to apply 736 CoDel to queue management as described here or to adapt its 737 principles to other applications. 739 Implementors are strongly encouraged to also look at the Linux kernel 740 version of CoDel - a well-written, well tested, real-world, C-based 741 implementation. As of this writing, it is available at 742 https://github.com/torvalds/linux/blob/master/net/sched/sch_codel.c. 744 5.1. Data Types 746 time_t is an integer time value in units convenient for the system. 747 The code presented here uses 0 as a flag value to indicate "no time 748 set." 750 packet_t* is a pointer to a packet descriptor. We assume it has a 751 tstamp field capable of holding a time_t and that field is available 752 for use by CoDel (it will be set by the enqueue routine and used by 753 the dequeue routine). 755 queue_t is a base class for queue objects (the parent class for 756 codel_queue_t objects). We assume it has enqueue() and dequeue() 757 methods that can be implemented in child classes. We assume it has a 758 bytes() method that returns the current queue size in bytes. This 759 can be an approximate value. The method is invoked in the dequeue() 760 method but shouldn't require a lock with the enqueue() method. 762 flag_t is a Boolean. 764 5.2. Per-queue state (codel_queue_t instance variables) 766 time_t first_above_time_ = 0; // Time to declare sojourn time above 767 // TARGET 768 time_t drop_next_ = 0; // Time to drop next packet 769 uint32_t count_ = 0; // Packets dropped in drop state 770 uint32_t lastcount_ = 0; // Count from previous iteration 771 flag_t dropping_ = false; // Set to true if in drop state 773 5.3. Constants 775 time_t TARGET = MS2TIME(5); // 5ms TARGET queue delay 776 time_t INTERVAL = MS2TIME(100); // 100ms sliding-minimum window 777 u_int maxpacket = 512; // Maximum packet size in bytes 778 // (SHOULD use interface MTU) 780 5.4. Enqueue routine 782 All the work of CoDel is done in the dequeue routine. The only CoDel 783 addition to enqueue is putting the current time in the packet's 784 tstamp field so that the dequeue routine can compute the packet's 785 sojourn time. 787 void codel_queue_t::enqueue(packet_t* pkt) 788 { 789 pkt->timestamp() = clock(); 790 queue_t::enqueue(pkt); 791 } 793 5.5. Dequeue routine 795 This is the heart of CoDel. There are two branches based on whether 796 the controller is in drop state: (i) if the controller is in drop 797 state (that is, the minimum packet sojourn time is greater than 798 TARGET) then the controller checks if it is time to leave drop state 799 or schedules the next drop(s); or (ii) if the controller is not in 800 drop state, it determines if it should enter drop state and do the 801 initial drop. 803 packet_t* CoDelQueue::dequeue() 804 { 805 time_t now = clock(); 806 dodequeue_result r = dodequeue(now); 807 uint32_t delta; 809 if (dropping_) { 810 if (! r.ok_to_drop) { 811 // sojourn time below TARGET - leave drop state 812 dropping_ = false; 813 } 814 // Time for the next drop. Drop current packet and dequeue 815 // next. If the dequeue doesn't take us out of dropping 816 // state, schedule the next drop. A large backlog might 817 // result in drop rates so high that the next drop should 818 // happen now, hence the 'while' loop. 819 while (now >= drop_next_ && dropping_) { 820 drop(r.p); 821 ++count_; 822 r = dodequeue(now); 823 if (! r.ok_to_drop) { 824 // leave drop state 825 dropping_ = false; 826 } else { 827 // schedule the next drop. 828 drop_next_ = control_law(drop_next_, count_); 829 } 830 } 831 // If we get here we're not in drop state. The 'ok_to_drop' 832 // return from dodequeue means that the sojourn time has been 833 // above 'TARGET' for 'INTERVAL' so enter drop state. 834 } else if (r.ok_to_drop) { 835 drop(r.p); 836 r = dodequeue(now); 837 dropping_ = true; 839 // If min went above TARGET close to when it last went 840 // below, assume that the drop rate that controlled the 841 // queue on the last cycle is a good starting point to 842 // control it now. ('drop_next' will be at most 'INTERVAL' 843 // later than the time of the last drop so 'now - drop_next' 844 // is a good approximation of the time from the last drop 845 // until now.) Implementations vary slightly here; this is 846 // the Linux version, which is more widely deployed and 847 // tested. 848 delta = count_ - lastcount_; 849 count_ = 1; 850 if ((delta > 1) && (now - drop_next_ < 16*INTERVAL)) 851 count_ = delta; 853 drop_next_ = control_law(now, count_); 854 lastcount_ = count_; 855 } 856 return (r.p); 857 } 859 5.6. Helper routines 861 Since the degree of multiplexing and nature of the traffic sources is 862 unknown, CoDel acts as a closed-loop servo system that gradually 863 increases the frequency of dropping until the queue is controlled 864 (sojourn time goes below TARGET). This is the control law that 865 governs the servo. It has this form because of the sqrt(p) 866 dependence of TCP throughput on drop probability. Note that for 867 embedded systems or kernel implementation, the inverse sqrt can be 868 computed efficiently using only integer multiplication. 870 time_t codel_queue_t::control_law(time_t t, uint32_t count) 871 { 872 return t + INTERVAL / sqrt(count); 873 } 875 Next is a helper routine the does the actual packet dequeue and 876 tracks whether the sojourn time is above or below TARGET and, if 877 above, if it has remained above continuously for at least INTERVAL 878 amount of time. It returns two values: a Boolean indicating if it is 879 OK to drop (sojourn time above TARGET for at least INTERVAL), and the 880 packet dequeued. 882 typedef struct { 883 packet_t* p; 884 flag_t ok_to_drop; 885 } dodequeue_result; 887 dodequeue_result codel_queue_t::dodequeue(time_t now) 888 { 889 dodequeue_result r = { queue_t::dequeue(), false }; 890 if (r.p == NULL) { 891 // queue is empty - we can't be above TARGET 892 first_above_time_ = 0; 893 return r; 894 } 896 // To span a large range of bandwidths, CoDel runs two 897 // different AQMs in parallel. One is sojourn-time-based 898 // and takes effect when the time to send an MTU-sized 899 // packet is less than TARGET. The 1st term of the "if" 900 // below does this. The other is backlog-based and takes 901 // effect when the time to send an MTU-sized packet is >= 902 // TARGET. The goal here is to keep the output link 903 // utilization high by never allowing the queue to get 904 // smaller than the amount that arrives in a typical 905 // interarrival time (MTU-sized packets arriving spaced 906 // by the amount of time it takes to send such a packet on 907 // the bottleneck). The 2nd term of the "if" does this. 908 time_t sojourn_time = now - r.p->tstamp; 909 if (sojourn_time_ < TARGET || bytes() <= maxpacket_) { 910 // went below - stay below for at least INTERVAL 911 first_above_time_ = 0; 912 } else { 913 if (first_above_time_ == 0) { 914 // just went above from below. if still above at 915 // first_above_time, will say it's ok to drop. 916 first_above_time_ = now + INTERVAL; 917 } else if (now >= first_above_time_) { 918 r.ok_to_drop = true; 919 } 920 } 921 return r; 922 } 924 5.7. Implementation considerations 926 time_t is an integer time value in units convenient for the system. 927 Resolution to at least a millisecond is required and better 928 resolution is useful up to the minimum possible packet time on the 929 output link; 64- or 32-bit widths are acceptable but with 32 bits the 930 resolution should be no finer than 2^{-16} to leave enough dynamic 931 range to represent a wide range of queue waiting times. Narrower 932 widths also have implementation issues due to overflow (wrapping) and 933 underflow (limit cycles because of truncation to zero) that are not 934 addressed in this pseudocode. 936 Since CoDel requires relatively little per-queue state and no direct 937 communication or state sharing between the enqueue and dequeue 938 routines, it is relatively simple to add CoDel to almost any packet 939 processing pipeline, including ASIC- or NPU-based forwarding engines. 940 One issue to consider is dodequeue()'s use of a 'bytes()' function to 941 determine the current queue size in bytes. This value does not need 942 to be exact. If the enqueue part of the pipeline keeps a running 943 count of the total number of bytes it has put into the queue and the 944 dequeue routine keeps a running count of the total bytes it has 945 removed from the queue, 'bytes()' is simply the difference between 946 these two counters (32-bit counters should be adequate.) Enqueue has 947 to update its counter once per packet queued but it does not matter 948 when (before, during or after the packet has been added to the 949 queue). The worst that can happen is a slight, transient, 950 underestimate of the queue size which might cause a drop to be 951 briefly deferred. 953 6. Further Experimentation 955 We encourage experimentation with the recommended values of TARGET 956 and INTERVAL for Internet settings. CoDel provides general, 957 efficient, parameterless building blocks for queue management that 958 can be applied to single or multiple queues in a variety of data 959 networking scenarios. CoDel's settings may be modified for other 960 special-purpose networking applications. 962 7. Security Considerations 964 This document describes an active queue management algorithm for 965 implementation in networked devices. There are no known security 966 exposures associated with CoDel at this time. 968 8. IANA Considerations 970 This document does not require actions by IANA. 972 9. Acknowledgments 974 The authors thank Jim Gettys for the constructive nagging that made 975 us get the work "out there" before we thought it was ready. We thank 976 Dave Taht, Eric Dumazet, and the open source community for showing 977 the value of getting it "out there" and for making it real. We thank 978 Nandita Dukkipati for contributions to section 6 and for comments 979 which helped to substantially improve this draft. We thank the AQM 980 working group and the Transport Area shepherd, Wes Eddy, for 981 patiently prodding this draft all the way to a standard. 983 10. References 985 10.1. Normative References 987 [RFC2119] Bradner, S., "Key Words for use in RFCs to Indicate 988 Requirement Levels", March 1997. 990 10.2. Informative References 992 [BB2011] Gettys, J. and K. Nichols, "Bufferbloat: Dark Buffers in 993 the Internet", Communications of the ACM 9(11) pp. 57-65. 995 [BMPFQ] Suter, B., "Buffer Management Schemes for Supporting TCP 996 in Gigabit Routers with Per-flow Queueing", IEEE Journal 997 on Selected Areas in Communications Vol. 17 Issue 6, June, 998 1999, pp. 1159-1169. 1000 [CHARB2007] 1001 Dischinger, M., "Characterizing Residential Broadband 1002 Networks", Proceedings of the Internet Measurement 1003 Conference San Diego, CA, 2007. 1005 [CODEL2012] 1006 Nichols, K. and V. Jacobson, "Controlling Queue Delay", 1007 Communications of the ACM Vol. 55 No. 11, July, 2012, pp. 1008 42-50. 1010 [FQ-CODEL-ID] 1011 Hoeiland-Joergensen, T., McKenney, P., 1012 dave.taht@gmail.com, d., Gettys, J., and E. Dumazet, 1013 "FlowQueue-Codel", draft-ietf-aqm-fq-codel-06 (work in 1014 progress), March 2017. 1016 [KLEIN81] Kleinrock, L. and R. Gail, "An Invariant Property of 1017 Computer Network Power", International Conference on 1018 Communications June, 1981, 1019 . 1021 [MACTCP1997] 1022 Mathis, M., Semke, J., and J. Mahdavi, "The Macroscopic 1023 Behavior of the TCP Congestion Avoidance Algorithm", ACM 1024 SIGCOMM Computer Communications Review Vol. 27 no. 1, Jan. 1025 2007. 1027 [NETAL2010] 1028 Kreibich, C., "Netalyzr: Illuminating the Edge Network", 1029 Proceedings of the Internet Measurement 1030 Conference Melbourne, Australia, 2010. 1032 [REDL1998] 1033 Nichols, K., Jacobson, V., and K. Poduri, "RED in a 1034 Different Light", Tech report, September, 1999, 1035 . 1038 [RFC2309] Braden, B., Clark, D., Crowcroft, J., Davie, B., Deering, 1039 S., Estrin, D., Floyd, S., Jacobson, V., Minshall, G., 1040 Partridge, C., Peterson, L., Ramakrishnan, K., Shenker, 1041 S., Wroclawski, J., and L. Zhang, "Recommendations on 1042 Queue Management and Congestion Avoidance in the 1043 Internet", RFC 2309, April 1998. 1045 [RFC2581] Allman, M., Paxson, V., and W. Stevens, "TCP Congestion 1046 Control", RFC 2581, April 1999. 1048 [RFC896] Nagle, J., "Congestion control in IP/TCP internetworks", 1049 RFC 896, January 1984. 1051 [SFQ1990] McKenney, P., "Stochastic Fairness Queuing", Proceedings 1052 of IEEE INFOCOMM 90 San Francisco, 1990. 1054 [TSV2011] Gettys, J., "Bufferbloat: Dark Buffers in the Internet", 1055 IETF 80 presentation to Transport Area Open Meeting, 1056 March, 2011, 1057 . 1059 [TSV84] Jacobson, V., "CoDel talk at TSV meeting IETF 84", 1060 . 1063 [VANQ2006] 1064 Jacobson, V., "A Rant on Queues", talk at MIT Lincoln 1065 Labs, Lexington, MA July, 2006, 1066 . 1068 10.3. URIs 1070 [1] http://www.ietf.org/proceedings/84/slides/slides-84-tsvarea-4.pdf 1072 Appendix A. Applying CoDel in the datacenter 1074 Nandita Dukkipati and her group at Google realized that the CoDel 1075 building blocks could be applied to bufferbloat problems in 1076 datacenter servers, not just to Internet routers. The Linux CoDel 1077 queueing discipline (qdisc) was adapted in three ways to tackle this 1078 bufferbloat problem. 1080 1. The default CoDel action was modified to be a direct feedback 1081 from qdisc to the TCP layer at dequeue. The direct feedback 1082 simply reduces TCP's congestion window just as congestion control 1083 would do in the event of drop. The scheme falls back to ECN 1084 marking or packet drop if the TCP socket lock could not be 1085 acquired at dequeue. 1087 2. Being located in the server makes it possible to monitor the 1088 actual RTT to use as CoDel's interval rather than making a "best 1089 guess" of RTT. The CoDel interval is dynamically adjusted by 1090 using the maximum TCP round-trip time (RTT) of those connections 1091 sharing the same Qdisc/bucket. In particular, there is a history 1092 entry of the maximum RTT experienced over the last second. As a 1093 packet is dequeued, the RTT estimate is accessed from its TCP 1094 socket. If the estimate is larger than the current CoDel 1095 interval, the CoDel interval is immediately refreshed to the new 1096 value. If the CoDel interval is not refreshed for over a second, 1097 it is decreased it to the history entry and the process is 1098 repeated. The use of the dynamic TCP RTT estimate lets interval 1099 adapt to the actual maximum value currently seen and thus lets 1100 the controller space its drop intervals appropriately. 1102 3. Since the mathematics of computing the setpoint are invariant, a 1103 target of 5% of the RTT or CoDel interval was used here. 1105 Non-data packets were not dropped as these are typically small and 1106 sometimes critical control packets. Being located on the server, 1107 there is no concern with misbehaving users as there would be on the 1108 public Internet. 1110 In several data center workload benchmarks, which are typically 1111 bursty, CoDel reduced the queueing latencies at the qdisc, and 1112 thereby improved the mean and 99th-percentile latencies from several 1113 tens of milliseconds to less than one millisecond. The minimum 1114 tracking part of the CoDel framework proved useful in disambiguating 1115 "good" queue versus "bad" queue, particularly helpful in controlling 1116 qdisc buffers that are inherently bursty because of TCP Segmentation 1117 Offload (TSO). 1119 Authors' Addresses 1121 Kathleen Nichols 1122 Pollere, Inc. 1123 PO Box 370201 1124 Montara, CA 94037 1125 USA 1127 Email: nichols@pollere.com 1129 Van Jacobson 1130 Google 1132 Email: vanj@google.com 1134 Andrew McGregor 1135 Google 1137 Email: andrewmcgr@google.com 1139 Janardhan Iyengar 1140 Google 1142 Email: jri@google.com