DualQ Coupled AQMs for Low Latency, Low Loss and Scalable Throughput (L4S)
draft-ietf-tsvwg-aqm-dualq-coupled-15
The information below is for an old version of the document.
Document | Type |
This is an older version of an Internet-Draft that was ultimately published as RFC 9332.
|
|
---|---|---|---|
Authors | Koen De Schepper , Bob Briscoe , Greg White | ||
Last updated | 2021-05-23 | ||
Replaces | draft-briscoe-tsvwg-aqm-dualq-coupled | ||
RFC stream | Internet Engineering Task Force (IETF) | ||
Formats | |||
Reviews | |||
Additional resources | Mailing list discussion | ||
Stream | WG state | WG Document | |
Document shepherd | Wesley Eddy | ||
Shepherd write-up | Show Last changed 2020-04-21 | ||
IESG | IESG state | Became RFC 9332 (Experimental) | |
Consensus boilerplate | Unknown | ||
Telechat date | (None) | ||
Responsible AD | (None) | ||
Send notices to | Wesley Eddy <wes@mti-systems.com> |
draft-ietf-tsvwg-aqm-dualq-coupled-15
#x27; includes cases where a flow becomes temporarily unresponsive, for instance, a real-time flow that takes a while to adapt its rate in response to congestion, or a standard Reno flow that is normally responsive, but above a certain congestion level it will not be able to reduce its congestion window below the allowed minimum of 2 segments [RFC5681], effectively becoming unresponsive. (Note that L4S traffic ought to remain responsive below a window of 2 segments (see [I-D.ietf-tsvwg-ecn-l4s-id]). Saturation raises the question of whether to relieve congestion by introducing some drop into the L4S queue or by allowing delay to grow in both queues (which could eventually lead to tail drop too): Drop on Saturation: Saturation can be avoided by setting a maximum threshold for L4S ECN marking (assuming k>1) before saturation starts to make the flow rates of the different traffic types diverge. Above that the drop probability of Classic traffic is applied to all packets of all traffic types. Then experiments have shown that queueing delay can be kept at the target in any overload situation, including with unresponsive traffic, and no further measures are required [DualQ-Test]. De Schepper, et al. Expires November 22, 2021 [Page 23] Internet-Draft DualQ Coupled AQMs May 2021 Delay on Saturation: When L4S marking saturates, instead of switching to drop, the drop and marking probabilities could be capped. Beyond that, delay will grow either solely in the queue with unresponsive traffic (if WRR is used), or in both queues (if time-shifted FIFO is used). In either case, the higher delay ought to control temporary high congestion. If the overload is more persistent, eventually the combined DualQ will overflow and tail drop will control congestion. The example implementation in Appendix A solely applies the "drop on saturation" policy. The DOCSIS specification of a DualQ Coupled AQM [DOCSIS3.1] also implements the 'drop on saturation' policy with a very shallow L buffer. However, the addition of DOCSIS per-flow Queue Protection [I-D.briscoe-docsis-q-protection] turns this into 'delay on saturation' by redirecting some packets of the flow(s) most responsible for L queue overload into the C queue, which has a higher delay target. If overload continues, this again becomes 'drop on saturation' as the level of drop in the C queue rises to maintain the target delay of the C queue. 4.1.3. Protecting against Unresponsive ECN-Capable Traffic Unresponsive traffic has a greater advantage if it is also ECN- capable. The advantage is undetectable at normal low levels of drop/ marking, but it becomes significant with the higher levels of drop/ marking typical during overload. This is an issue whether the ECN- capable traffic is L4S or Classic. This raises the question of whether and when to switch off ECN marking and use solely drop instead, as required by both Section 7 of [RFC3168] and Section 4.2.1 of [RFC7567]. Experiments with the DualPI2 AQM (Appendix A) have shown that introducing 'drop on saturation' at 100% L4S marking addresses this problem with unresponsive ECN as well as addressing the saturation problem. It leaves only a small range of congestion levels where unresponsive traffic gains any advantage from using the ECN capability, and the advantage is hardly detectable [DualQ-Test]. 5. Acknowledgements Thanks to Anil Agarwal, Sowmini Varadhan's, Gabi Bracha, Nicolas Kuhn, Greg Skinner, Tom Henderson and David Pullen for detailed review comments particularly of the appendices and suggestions on how to make the explanations clearer. Thanks also to Tom Henderson for insights on the choice of schedulers and queue delay measurement techniques. De Schepper, et al. Expires November 22, 2021 [Page 24] Internet-Draft DualQ Coupled AQMs May 2021 The early contributions of Koen De Schepper, Bob Briscoe, Olga Bondarenko and Inton Tsang were part-funded by the European Community under its Seventh Framework Programme through the Reducing Internet Transport Latency (RITE) project (ICT-317700). Bob Briscoe's contribution was also part-funded by the Comcast Innovation Fund and the Research Council of Norway through the TimeIn project. The views expressed here are solely those of the authors. 6. Contributors The following contributed implementations and evaluations that validated and helped to improve this specification: Olga Albisser <olga@albisser.org> of Simula Research Lab, Norway (Olga Bondarenko during early drafts) implemented the prototype DualPI2 AQM for Linux with Koen De Schepper and conducted extensive evaluations as well as implementing the live performance visualization GUI [L4Sdemo16]. Olivier Tilmans <olivier.tilmans@nokia-bell-labs.com> of Nokia Bell Labs, Belgium prepared and maintains the Linux implementation of DualPI2 for upstreaming. Shravya K.S. wrote a model for the ns-3 simulator based on the -01 version of this Internet-Draft. Based on this initial work, Tom Henderson <tomh@tomh.org> updated that earlier model and created a model for the DualQ variant specified as part of the Low Latency DOCSIS specification, as well as conducting extensive evaluations. Ing Jyh (Inton) Tsang of Nokia, Belgium built the End-to-End Data Centre to the Home broadband testbed on which DualQ Coupled AQM implementations were tested. 7. References 7.1. Normative References [I-D.ietf-tsvwg-ecn-l4s-id] Schepper, K. D. and B. Briscoe, "Explicit Congestion Notification (ECN) Protocol for Ultra-Low Queuing Delay (L4S)", draft-ietf-tsvwg-ecn-l4s-id-14 (work in progress), March 2021. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, <https://www.rfc-editor.org/info/rfc2119>. De Schepper, et al. Expires November 22, 2021 [Page 25] Internet-Draft DualQ Coupled AQMs May 2021 [RFC3168] Ramakrishnan, K., Floyd, S., and D. Black, "The Addition of Explicit Congestion Notification (ECN) to IP", RFC 3168, DOI 10.17487/RFC3168, September 2001, <https://www.rfc-editor.org/info/rfc3168>. [RFC8311] Black, D., "Relaxing Restrictions on Explicit Congestion Notification (ECN) Experimentation", RFC 8311, DOI 10.17487/RFC8311, January 2018, <https://www.rfc-editor.org/info/rfc8311>. 7.2. Informative References [Alizadeh-stability] Alizadeh, M., Javanmard, A., and B. Prabhakar, "Analysis of DCTCP: Stability, Convergence, and Fairness", ACM SIGMETRICS 2011 , June 2011, <https://dl.acm.org/citation.cfm?id=1993753>. [AQMmetrics] Kwon, M. and S. Fahmy, "A Comparison of Load-based and Queue- based Active Queue Management Algorithms", Proc. Int'l Soc. for Optical Engineering (SPIE) 4866:35--46 DOI: 10.1117/12.473021, 2002, <https://www.cs.purdue.edu/homes/fahmy/papers/ldc.pdf>. [ARED01] Floyd, S., Gummadi, R., and S. Shenker, "Adaptive RED: An Algorithm for Increasing the Robustness of RED's Active Queue Management", ACIRI Technical Report , August 2001, <http://www.icir.org/floyd/red.html>. [BBRv1] Cardwell, N., Cheng, Y., Hassas Yeganeh, S., and V. Jacobson, "BBR Congestion Control", Internet Draft draft- cardwell-iccrg-bbr-congestion-control-00, July 2017, <https://tools.ietf.org/html/draft-cardwell-iccrg-bbr- congestion-control-00>. [CoDel] Nichols, K. and V. Jacobson, "Controlling Queue Delay", ACM Queue 10(5), May 2012, <http://queue.acm.org/issuedetail.cfm?issue=2208917>. [CRED_Insights] Briscoe, B., "Insights from Curvy RED (Random Early Detection)", BT Technical Report TR-TUB8-2015-003 arXiv:1904.07339 [cs.NI], July 2015, <https://arxiv.org/abs/1904.07339>. De Schepper, et al. Expires November 22, 2021 [Page 26] Internet-Draft DualQ Coupled AQMs May 2021 [DCttH15] De Schepper, K., Bondarenko, O., Briscoe, B., and I. Tsang, "`Data Centre to the Home': Ultra-Low Latency for All", RITE project Technical Report , 2015, <http://riteproject.eu/publications/>. [DOCSIS3.1] CableLabs, "MAC and Upper Layer Protocols Interface (MULPI) Specification, CM-SP-MULPIv3.1", Data-Over-Cable Service Interface Specifications DOCSIS(R) 3.1 Version i17 or later, January 2019, <https://specification- search.cablelabs.com/CM-SP-MULPIv3.1>. [DualPI2Linux] Albisser, O., De Schepper, K., Briscoe, B., Tilmans, O., and H. Steen, "DUALPI2 - Low Latency, Low Loss and Scalable (L4S) AQM", Proc. Linux Netdev 0x13 , March 2019, <https://www.netdevconf.org/0x13/session.html?talk- DUALPI2-AQM>. [DualQ-Test] Steen, H., "Destruction Testing: Ultra-Low Delay using Dual Queue Coupled Active Queue Management", Masters Thesis, Dept of Informatics, Uni Oslo , May 2017. [I-D.briscoe-docsis-q-protection] Briscoe, B. and G. White, "Queue Protection to Preserve Low Latency", draft-briscoe-docsis-q-protection-00 (work in progress), July 2019. [I-D.briscoe-tsvwg-l4s-diffserv] Briscoe, B., "Interactions between Low Latency, Low Loss, Scalable Throughput (L4S) and Differentiated Services", draft-briscoe-tsvwg-l4s-diffserv-02 (work in progress), November 2018. [I-D.cardwell-iccrg-bbr-congestion-control] Cardwell, N., Cheng, Y., Yeganeh, S. H., and V. Jacobson, "BBR Congestion Control", draft-cardwell-iccrg-bbr- congestion-control-00 (work in progress), July 2017. [I-D.ietf-tsvwg-l4s-arch] Briscoe, B., Schepper, K. D., Bagnulo, M., and G. White, "Low Latency, Low Loss, Scalable Throughput (L4S) Internet Service: Architecture", draft-ietf-tsvwg-l4s-arch-08 (work in progress), November 2020. De Schepper, et al. Expires November 22, 2021 [Page 27] Internet-Draft DualQ Coupled AQMs May 2021 [I-D.ietf-tsvwg-nqb] White, G. and T. Fossati, "A Non-Queue-Building Per-Hop Behavior (NQB PHB) for Differentiated Services", draft- ietf-tsvwg-nqb-05 (work in progress), March 2021. [L4Sdemo16] Bondarenko, O., De Schepper, K., Tsang, I., and B. Briscoe, "Ultra-Low Delay for All: Live Experience, Live Analysis", Proc. MMSYS'16 pp33:1--33:4, May 2016, <http://dl.acm.org/citation.cfm?doid=2910017.2910633 (videos of demos: https://riteproject.eu/dctth/#1511dispatchwg )>. [LLD] White, G., Sundaresan, K., and B. Briscoe, "Low Latency DOCSIS: Technology Overview", CableLabs White Paper , February 2019, <https://cablela.bs/low-latency-docsis- technology-overview-february-2019>. [Mathis09] Mathis, M., "Relentless Congestion Control", PFLDNeT'09 , May 2009, <http://www.hpcc.jp/pfldnet2009/ Program_files/1569198525.pdf>. [MEDF] Menth, M., Schmid, M., Heiss, H., and T. Reim, "MEDF - a simple scheduling algorithm for two real-time transport service classes with application in the UTRAN", Proc. IEEE Conference on Computer Communications (INFOCOM'03) Vol.2 pp.1116-1122, March 2003. [PI2] De Schepper, K., Bondarenko, O., Briscoe, B., and I. Tsang, "PI2: A Linearized AQM for both Classic and Scalable TCP", ACM CoNEXT'16 , December 2016, <https://riteproject.files.wordpress.com/2015/10/ pi2_conext.pdf>. [PragueLinux] Briscoe, B., De Schepper, K., Albisser, O., Misund, J., Tilmans, O., Kuehlewind, M., and A. Ahmed, "Implementing the `TCP Prague' Requirements for Low Latency Low Loss Scalable Throughput (L4S)", Proc. Linux Netdev 0x13 , March 2019, <https://www.netdevconf.org/0x13/ session.html?talk-tcp-prague-l4s>. [RFC0970] Nagle, J., "On Packet Switches With Infinite Storage", RFC 970, DOI 10.17487/RFC0970, December 1985, <https://www.rfc-editor.org/info/rfc970>. De Schepper, et al. Expires November 22, 2021 [Page 28] Internet-Draft DualQ Coupled AQMs May 2021 [RFC2309] Braden, B., Clark, D., Crowcroft, J., Davie, B., Deering, S., Estrin, D., Floyd, S., Jacobson, V., Minshall, G., Partridge, C., Peterson, L., Ramakrishnan, K., Shenker, S., Wroclawski, J., and L. Zhang, "Recommendations on Queue Management and Congestion Avoidance in the Internet", RFC 2309, DOI 10.17487/RFC2309, April 1998, <https://www.rfc-editor.org/info/rfc2309>. [RFC3246] Davie, B., Charny, A., Bennet, J., Benson, K., Le Boudec, J., Courtney, W., Davari, S., Firoiu, V., and D. Stiliadis, "An Expedited Forwarding PHB (Per-Hop Behavior)", RFC 3246, DOI 10.17487/RFC3246, March 2002, <https://www.rfc-editor.org/info/rfc3246>. [RFC3649] Floyd, S., "HighSpeed TCP for Large Congestion Windows", RFC 3649, DOI 10.17487/RFC3649, December 2003, <https://www.rfc-editor.org/info/rfc3649>. [RFC5033] Floyd, S. and M. Allman, "Specifying New Congestion Control Algorithms", BCP 133, RFC 5033, DOI 10.17487/RFC5033, August 2007, <https://www.rfc-editor.org/info/rfc5033>. [RFC5348] Floyd, S., Handley, M., Padhye, J., and J. Widmer, "TCP Friendly Rate Control (TFRC): Protocol Specification", RFC 5348, DOI 10.17487/RFC5348, September 2008, <https://www.rfc-editor.org/info/rfc5348>. [RFC5681] Allman, M., Paxson, V., and E. Blanton, "TCP Congestion Control", RFC 5681, DOI 10.17487/RFC5681, September 2009, <https://www.rfc-editor.org/info/rfc5681>. [RFC5706] Harrington, D., "Guidelines for Considering Operations and Management of New Protocols and Protocol Extensions", RFC 5706, DOI 10.17487/RFC5706, November 2009, <https://www.rfc-editor.org/info/rfc5706>. [RFC7567] Baker, F., Ed. and G. Fairhurst, Ed., "IETF Recommendations Regarding Active Queue Management", BCP 197, RFC 7567, DOI 10.17487/RFC7567, July 2015, <https://www.rfc-editor.org/info/rfc7567>. [RFC8033] Pan, R., Natarajan, P., Baker, F., and G. White, "Proportional Integral Controller Enhanced (PIE): A Lightweight Control Scheme to Address the Bufferbloat Problem", RFC 8033, DOI 10.17487/RFC8033, February 2017, <https://www.rfc-editor.org/info/rfc8033>. De Schepper, et al. Expires November 22, 2021 [Page 29] Internet-Draft DualQ Coupled AQMs May 2021 [RFC8034] White, G. and R. Pan, "Active Queue Management (AQM) Based on Proportional Integral Controller Enhanced PIE) for Data-Over-Cable Service Interface Specifications (DOCSIS) Cable Modems", RFC 8034, DOI 10.17487/RFC8034, February 2017, <https://www.rfc-editor.org/info/rfc8034>. [RFC8257] Bensley, S., Thaler, D., Balasubramanian, P., Eggert, L., and G. Judd, "Data Center TCP (DCTCP): TCP Congestion Control for Data Centers", RFC 8257, DOI 10.17487/RFC8257, October 2017, <https://www.rfc-editor.org/info/rfc8257>. [RFC8290] Hoeiland-Joergensen, T., McKenney, P., Taht, D., Gettys, J., and E. Dumazet, "The Flow Queue CoDel Packet Scheduler and Active Queue Management Algorithm", RFC 8290, DOI 10.17487/RFC8290, January 2018, <https://www.rfc-editor.org/info/rfc8290>. [RFC8298] Johansson, I. and Z. Sarker, "Self-Clocked Rate Adaptation for Multimedia", RFC 8298, DOI 10.17487/RFC8298, December 2017, <https://www.rfc-editor.org/info/rfc8298>. [RFC8312] Rhee, I., Xu, L., Ha, S., Zimmermann, A., Eggert, L., and R. Scheffenegger, "CUBIC for Fast Long-Distance Networks", RFC 8312, DOI 10.17487/RFC8312, February 2018, <https://www.rfc-editor.org/info/rfc8312>. [SigQ-Dyn] Briscoe, B., "Rapid Signalling of Queue Dynamics", Technical Report TR-BB-2017-001 arXiv:1904.07044 [cs.NI], September 2017, <https://arxiv.org/abs/1904.07044>. Appendix A. Example DualQ Coupled PI2 Algorithm As a first concrete example, the pseudocode below gives the DualPI2 algorithm. DualPI2 follows the structure of the DualQ Coupled AQM framework in Figure 1. A simple ramp function (configured in units of queuing time) with unsmoothed ECN marking is used for the Native L4S AQM. The ramp can also be configured as a step function. The PI2 algorithm [PI2] is used for the Classic AQM. PI2 is an improved variant of the PIE AQM [RFC8033]. The pseudocode will be introduced in two passes. The first pass explains the core concepts, deferring handling of overload to the second pass. To aid comparison, line numbers are kept in step between the two passes by using letter suffixes where the longer code needs extra lines. De Schepper, et al. Expires November 22, 2021 [Page 30] Internet-Draft DualQ Coupled AQMs May 2021 All variables are assumed to be floating point in their basic units (size in bytes, time in seconds, rates in bytes/second, alpha and beta in Hz, and probabilities from 0 to 1. Constants expressed in k (kilo), M (mega), G (giga), u (micro), m (milli) , %, ... are assumed to be converted to their appropriate multiple or fraction to represent the basic units. A real implementation that wants to use integer values needs to handle appropriate scaling factors and allow accordingly appropriate resolution of its integer types (including temporary internal values during calculations). A full open source implementation for Linux is available at: https://github.com/L4STeam/sch_dualpi2_upstream and explained in [DualPI2Linux]. The specification of the DualQ Coupled AQM for DOCSIS cable modems and CMTSs is available in [DOCSIS3.1] and explained in [LLD]. A.1. Pass #1: Core Concepts The pseudocode manipulates three main structures of variables: the packet (pkt), the L4S queue (lq) and the Classic queue (cq). The pseudocode consists of the following six functions: o The initialization function dualpi2_params_init(...) (Figure 2) that sets parameter defaults (the API for setting non-default values is omitted for brevity) o The enqueue function dualpi2_enqueue(lq, cq, pkt) (Figure 3) o The dequeue function dualpi2_dequeue(lq, cq, pkt) (Figure 4) o The recurrence function recur(q, likelihood) for de-randomized ECN marking (shown at the end of Figure 4). o The L4S AQM function laqm(qdelay) (Figure 5) used to calculate the ECN-marking probability for the L4S queue o The base AQM function that implements the PI algorithm dualpi2_update(lq, cq) (Figure 6) used to regularly update the base probability (p'), which is squared for the Classic AQM as well as being coupled across to the L4S queue. It also uses the following functions that are not shown in full here: o scheduler(), which selects between the head packets of the two queues; the choice of scheduler technology is discussed later; o cq.len() or lq.len() returns the current length (aka. backlog) of the relevant queue in bytes; De Schepper, et al. Expires November 22, 2021 [Page 31] Internet-Draft DualQ Coupled AQMs May 2021 o cq.time() or lq.time() returns the current queuing delay (aka. sojourn time or service time) of the relevant queue in units of time (see Note a); o mark(pkt) and drop(pkt) for ECN-marking and dropping a packet; In experiments so far (building on experiments with PIE) on broadband access links ranging from 4 Mb/s to 200 Mb/s with base RTTs from 5 ms to 100 ms, DualPI2 achieves good results with the default parameters in Figure 2. The parameters are categorised by whether they relate to the Base PI2 AQM, the L4S AQM or the framework coupling them together. Constants and variables derived from these parameters are also included at the end of each category. Each parameter is explained as it is encountered in the walk-through of the pseudocode below. 1: dualpi2_params_init(...) { % Set input parameter defaults 2: % DualQ Coupled framework parameters 5: limit = MAX_LINK_RATE * 250 ms % Dual buffer size 3: k = 2 % Coupling factor 4: % NOT SHOWN % scheduler-dependent weight or equival't parameter 6: 7: % PI2 AQM parameters 8: RTT_max = 100 ms % Worst case RTT expected 9: RTT_typ = 15 ms % Typical RTT 11: % PI2 constants derived from above PI2 parameters 10: p_Cmax = min(1/k^2, 1) % Max Classic drop/mark prob 12: target = RTT_typ % PI AQM Classic queue delay target 13: Tupdate = min(RTT_typ, RTT_max/3) % PI sampling interval 14: alpha = 0.1 * Tupdate / RTT_max^2 % PI integral gain in Hz 15: beta = 0.3 / RTT_max % PI proportional gain in Hz 16: 17: % L4S ramp AQM parameters 18: minTh = 800 us % L4S min marking threshold in time units 19: range = 400 us % Range of L4S ramp in time units 20: Th_len = 2 * MTU % Min L4S marking threshold in bytes 21: % L4S constants incl. those derived from other parameters 22: p_Lmax = 1 % Max L4S marking prob 23: floor = Th_len / MIN_LINK_RATE 24: if (minTh < floor) { 25: % Shift ramp so minTh >= serialization time of 2 MTU 26: minTh = floor 27: } 28: maxTh = minTh+range % L4S max marking threshold in time units 29: } Figure 2: Example Header Pseudocode for DualQ Coupled PI2 AQM De Schepper, et al. Expires November 22, 2021 [Page 32] Internet-Draft DualQ Coupled AQMs May 2021 The overall goal of the code is to maintain the base probability (p', p-prime as in Section 2.4), which is an internal variable from which the marking and dropping probabilities for L4S and Classic traffic (p_L and p_C) are derived, with p_L in turn being derived from p_CL. The probabilities p_CL and p_C are derived in lines 4 and 5 of the dualpi2_update() function (Figure 6) then used in the dualpi2_dequeue() function where p_L is also derived from p_CL at line 6 (Figure 4). The code walk-through below builds up to explaining that part of the code eventually, but it starts from packet arrival. 1: dualpi2_enqueue(lq, cq, pkt) { % Test limit and classify lq or cq 2: if ( lq.len() + cq.len() + MTU > limit) 3: drop(pkt) % drop packet if buffer is full 4: timestamp(pkt) % attach arrival time to packet 5: % Packet classifier 6: if ( ecn(pkt) modulo 2 == 1 ) % ECN bits = ECT(1) or CE 7: lq.enqueue(pkt) 8: else % ECN bits = not-ECT or ECT(0) 9: cq.enqueue(pkt) 10: } Figure 3: Example Enqueue Pseudocode for DualQ Coupled PI2 AQM De Schepper, et al. Expires November 22, 2021 [Page 33] Internet-Draft DualQ Coupled AQMs May 2021 1: dualpi2_dequeue(lq, cq, pkt) { % Couples L4S & Classic queues 2: while ( lq.len() + cq.len() > 0 ) { 3: if ( scheduler() == lq ) { 4: lq.dequeue(pkt) % Scheduler chooses lq 5: p'_L = laqm(lq.time()) % Native L4S AQM 6: p_L = max(p'_L, p_CL) % Combining function 7: if ( recur(lq, p_L) ) % Linear marking 8: mark(pkt) 9: } else { 10: cq.dequeue(pkt) % Scheduler chooses cq 11: if ( recur(cq, p_C) ) { % probability p_C = p'^2 12: if ( ecn(pkt) == 0 ) { % if ECN field = not-ECT 13: drop(pkt) % squared drop 14: continue % continue to the top of the while loop 15: } 16: mark(pkt) % squared mark 17: } 18: } 19: return(pkt) % return the packet and stop 20: } 21: return(NULL) % no packet to dequeue 22: } 23: recur(q, likelihood) { % Returns TRUE with a certain likelihood 24: q.count += likelihood 25: if (q.count > 1) { 26: q.count -= 1 27: return TRUE 28: } 29: return FALSE 30: } Figure 4: Example Dequeue Pseudocode for DualQ Coupled PI2 AQM When packets arrive, first a common queue limit is checked as shown in line 2 of the enqueuing pseudocode in Figure 3. This assumes a shared buffer for the two queues (Note b discusses the merits of separate buffers). In order to avoid any bias against larger packets, 1 MTU of space is always allowed and the limit is deliberately tested before enqueue. If limit is not exceeded, the packet is timestamped in line 4. This assumes that queue delay is measured using the sojourn time technique (see Note a for alternatives). At lines 5-9, the packet is classified and enqueued to the Classic or L4S queue dependent on the least significant bit of the ECN field in the IP header (line 6). Packets with a codepoint having an LSB of 0 De Schepper, et al. Expires November 22, 2021 [Page 34] Internet-Draft DualQ Coupled AQMs May 2021 (Not-ECT and ECT(0)) will be enqueued in the Classic queue. Otherwise, ECT(1) and CE packets will be enqueued in the L4S queue. Optional additional packet classification flexibility is omitted for brevity (see [I-D.ietf-tsvwg-ecn-l4s-id]). The dequeue pseudocode (Figure 4) is repeatedly called whenever the lower layer is ready to forward a packet. It schedules one packet for dequeuing (or zero if the queue is empty) then returns control to the caller, so that it does not block while that packet is being forwarded. While making this dequeue decision, it also makes the necessary AQM decisions on dropping or marking. The alternative of applying the AQMs at enqueue would shift some processing from the critical time when each packet is dequeued. However, it would also add a whole queue of delay to the control signals, making the control loop sloppier (for a typical RTT it would double the Classic queue's feedback delay). All the dequeue code is contained within a large while loop so that if it decides to drop a packet, it will continue until it selects a packet to schedule. Line 3 of the dequeue pseudocode is where the scheduler chooses between the L4S queue (lq) and the Classic queue (cq). Detailed implementation of the scheduler is not shown (see discussion later). o If an L4S packet is scheduled, in lines 7 and 8 the packet is ECN- marked with likelihood p_L. The recur() function at the end of Figure 4 is used, which is preferred over random marking because it avoids delay due to randomization when interpreting congestion signals, but it still desynchronizes the saw-teeth of the flows. Line 6 calculates p_L as the maximum of the coupled L4S probability p_CL and the probability from the native L4S AQM p'_L. This implements the max() function shown in Figure 1 to couple the outputs of the two AQMs together. Of the two probabilities input to p_L in line 6: * p'_L is calculated per packet in line 5 by the laqm() function (see Figure 5), * Whereas p_CL is maintained by the dualpi2_update() function which runs every Tupdate (Tupdate is set in line 13 of Figure 2. It defaults to 16 ms in the reference Linux implementation because it has to be rounded to a multiple of 4 ms). o If a Classic packet is scheduled, lines 10 to 17 drop or mark the packet with probability p_C. De Schepper, et al. Expires November 22, 2021 [Page 35] Internet-Draft DualQ Coupled AQMs May 2021 The Native L4S AQM algorithm (Figure 5) is a ramp function, similar to the RED algorithm, but simplified as follows: o The extent of the ramp is defined in units of queuing delay, not bytes, so that configuration remains invariant as the queue departure rate varies. o It uses instantaneous queueing delay, which avoids the complexity of smoothing, but also avoids embedding a worst-case RTT of smoothing delay in the network (see Section 2.1). o The ramp rises linearly directly from 0 to 1, not to an intermediate value of p'_L as RED would, because there is no need to keep ECN marking probability low. o Marking does not have to be randomized. Determinism is used instead of randomness; to reduce the delay necessary to smooth out the noise of randomness from the signal. The ramp function requires two configuration parameters, the minimum threshold (minTh) and the width of the ramp (range), both in units of queuing time), as shown in lines 18 & 19 of the initialization function in Figure 2. The ramp function can be configured as a step (see Note c). Although the DCTCP paper [Alizadeh-stability] recommends an ECN marking threshold of 0.17*RTT_typ, it also shows that the threshold can be much shallower with hardly any worse under-utilization of the link (because the amplitude of DCTCP's sawteeth is so small). Based on extensive experiments, for the public Internet the default minimum ECN marking threshold in Figure 2 is considered a good compromise, even though it is significantly smaller fraction of RTT_typ. A minimum marking threshold parameter (Th_len) in transmission units (default 2 MTU) is also necessary to ensure that the ramp does not trigger excessive marking on slow links. The code in lines 24-27 of the initialization function (Figure 2) converts 2 MTU into time units and shifts the ramp so that the min threshold is no shallower than this floor. De Schepper, et al. Expires November 22, 2021 [Page 36] Internet-Draft DualQ Coupled AQMs May 2021 1: laqm(qdelay) { % Returns native L4S AQM probability 2: if (qdelay >= maxTh) 3: return 1 4: else if (qdelay > minTh) 5: return (qdelay - minTh)/range % Divide could use a bit-shift 6: else 7: return 0 8: } Figure 5: Example Pseudocode for the Native L4S AQM 1: dualpi2_update(lq, cq) { % Update p' every Tupdate 2: curq = cq.time() % use queuing time of first-in Classic packet 3: p' = p' + alpha * (curq - target) + beta * (curq - prevq) 4: p_CL = k * p' % Coupled L4S prob = base prob * coupling factor 5: p_C = p'^2 % Classic prob = (base prob)^2 6: prevq = curq 7: } (Clamping p' within the range [0,1] omitted for clarity - see text) Figure 6: Example PI-Update Pseudocode for DualQ Coupled PI2 AQM The coupled marking probability, p_CL depends on the base probability (p'), which is kept up to date by the core PI algorithm in Figure 6 executed every Tupdate. Note that p' solely depends on the queuing time in the Classic queue. In line 2, the current queuing delay (curq) is evaluated from how long the head packet was in the Classic queue (cq). The function cq.time() (not shown) subtracts the time stamped at enqueue from the current time (see Note a) and implicitly takes the current queuing delay as 0 if the queue is empty. The algorithm centres on line 3, which is a classical Proportional- Integral (PI) controller that alters p' dependent on: a) the error between the current queuing delay (curq) and the target queuing delay ('target' - see [RFC8033]); and b) the change in queuing delay since the last sample. The name 'PI' represents the fact that the second factor (how fast the queue is growing) is _P_roportional to load while the first is the _I_ntegral of the load (so it removes any standing queue in excess of the target). The two 'gain factors' in line 3, alpha and beta, respectively weight how strongly each of these elements ((a) and (b)) alters p'. They are in units of 'per second of delay' or Hz, because they transform differences in queueing delay into changes in probability (assuming probability has a value from 0 to 1). De Schepper, et al. Expires November 22, 2021 [Page 37] Internet-Draft DualQ Coupled AQMs May 2021 alpha and beta determine how much p' ought to change after each update interval (Tupdate). For smaller Tupdate, p' should change by the same amount per second, but in finer more frequent steps. So alpha depends on Tupdate (see line 14 of the initialization function in Figure 2). It is best to update p' as frequently as possible, but Tupdate will probably be constrained by hardware performance. As shown in line 13, the update interval should be at least as frequent as once per the RTT of a typical flow (RTT_typ) as long as it does not exceed roughly RTT_max/3. For link rates from 4 - 200 Mb/s, a target RTT of 15ms and a maximum RTT of 100ms, it has been verified through extensive testing that Tupdate=16ms (as recommended in [RFC8033]) is sufficient. The choice of alpha and beta also determines the AQM's stable operating range. The AQM ought to change p' as fast as possible in response to changes in load without over-compensating and therefore causing oscillations in the queue. Therefore, the values of alpha and beta also depend on the RTT of the expected worst-case flow (RTT_max). Recommended derivations of the gain constants alpha and beta can be approximated for Reno over a PI2 AQM as: alpha = 0.1 * Tupdate / RTT_max^2; beta = 0.3 / RTT_max, as shown in lines 14 & 15 of Figure 2. These are derived from the stability analysis in [PI2]. For the default values of Tupdate=16 ms and RTT_max = 100 ms, they result in alpha = 0.16; beta = 3.2 (discrepancies are due to rounding). These defaults have been verified with a wide range of link rates, target delays and a range of traffic models with mixed and similar RTTs, short and long flows, etc. In corner cases, p' can overflow the range [0,1] so the resulting value of p' has to be bounded (omitted from the pseudocode). Then, as already explained, the coupled and Classic probabilities are derived from the new p' in lines 4 and 5 of Figure 6 as p_CL = k*p' and p_C = p'^2. Because the coupled L4S marking probability (p_CL) is factored up by k, the dynamic gain parameters alpha and beta are also inherently factored up by k for the L4S queue. So, the effective gain factor for the L4S queue is k*alpha (with defaults alpha = 0.16 Hz and k=2, effective L4S alpha = 0.32 Hz). Unlike in PIE [RFC8033], alpha and beta do not need to be tuned every Tupdate dependent on p'. Instead, in PI2, alpha and beta are independent of p' because the squaring applied to Classic traffic tunes them inherently. This is explained in [PI2], which also explains why this more principled approach removes the need for most of the heuristics that had to be added to PIE. De Schepper, et al. Expires November 22, 2021 [Page 38] Internet-Draft DualQ Coupled AQMs May 2021 Nonetheless, an implementer might wish to add selected heuristics to either AQM. For instance the Linux reference DualPI2 implementation includes the following: o Prior to enqueuing an L4S packet, if the L queue contains <2 packets, the packet is flagged to suppress any native L4S AQM marking at dequeue (which depends on sojourn time); o Classic and coupled marking or dropping (i.e. based on p_C and p_CL from the PI controller) is only applied to a packet if the respective queue length in bytes is > 2 MTU (prior to enqueuing the packet or after dequeuing it, depending on whether the AQM is configured to be applied at enqueue or dequeue); o In the WRR scheduler, the 'credit' indicating which queue should transmit is only changed if there are packets in both queues (i.e. if there is actual resource contention). This means that a properly paced L flow might never be delayed by the WRR. The WRR credit is reset in favour of the L queue when the link is idle. An implementer might also wish to add other heuristics, e.g. burst protection [RFC8033] or enhanced burst protection [RFC8034]. Notes: a. The drain rate of the queue can vary if it is scheduled relative to other queues, or to cater for fluctuations in a wireless medium. To auto-adjust to changes in drain rate, the queue needs to be measured in time, not bytes or packets [AQMmetrics], [CoDel]. Queuing delay could be measured directly by storing a per-packet time-stamp as each packet is enqueued, and subtracting this from the system time when the packet is dequeued. If time- stamping is not easy to introduce with certain hardware, queuing delay could be predicted indirectly by dividing the size of the queue by the predicted departure rate, which might be known precisely for some link technologies (see for example [RFC8034]). b. Line 2 of the dualpi2_enqueue() function (Figure 3) assumes an implementation where lq and cq share common buffer memory. An alternative implementation could use separate buffers for each queue, in which case the arriving packet would have to be classified first to determine which buffer to check for available space. The choice is a trade off; a shared buffer can use less memory whereas separate buffers isolate the L4S queue from tail- drop due to large bursts of Classic traffic (e.g. a Classic Reno TCP during slow-start over a long RTT). De Schepper, et al. Expires November 22, 2021 [Page 39] Internet-Draft DualQ Coupled AQMs May 2021 c. There has been some concern that using the step function of DCTCP for the Native L4S AQM requires end-systems to smooth the signal for an unnecessarily large number of round trips to ensure sufficient fidelity. A ramp is no worse than a step in initial experiments with existing DCTCP. Therefore, it is recommended that a ramp is configured in place of a step, which will allow congestion control algorithms to investigate faster smoothing algorithms. A ramp is more general that a step, because an operator can effectively turn the ramp into a step function, as used by DCTCP, by setting the range to zero. There will not be a divide by zero problem at line 5 of Figure 5 because, if minTh is equal to maxTh, the condition for this ramp calculation cannot arise. A.2. Pass #2: Overload Details Figure 7 repeats the dequeue function of Figure 4, but with overload details added. Similarly Figure 8 repeats the core PI algorithm of Figure 6 with overload details added. The initialization, enqueue, L4S AQM and recur functions are unchanged. In line 10 of the initialization function (Figure 2), the maximum Classic drop probability p_Cmax = min(1/k^2, 1) or 1/4 for the default coupling factor k=2. p_Cmax is the point at which it is deemed that the Classic queue has become persistently overloaded, so it switches to using drop, even for ECN-capable packets. ECT packets that are not dropped can still be ECN-marked. In practice, 25% has been found to be a good threshold to preserve fairness between ECN capable and non ECN capable traffic. This protects the queues against both temporary overload from responsive flows and more persistent overload from any unresponsive traffic that falsely claims to be responsive to ECN. When the Classic ECN marking probability reaches the p_Cmax threshold (1/k^2), the marking probability coupled to the L4S queue, p_CL will always be 100% for any k (by equation (1) in Section 2). So, for readability, the constant p_Lmax is defined as 1 in line 22 of the initialization function (Figure 2). This is intended to ensure that the L4S queue starts to introduce dropping once ECN-marking saturates at 100% and can rise no further. The 'Prague L4S' requirements [I-D.ietf-tsvwg-ecn-l4s-id] state that, when an L4S congestion control detects a drop, it falls back to a response that coexists with 'Classic' Reno congestion control. So it is correct that, when the L4S queue drops packets, it drops them proportional to p'^2, as if they are Classic packets. De Schepper, et al. Expires November 22, 2021 [Page 40] Internet-Draft DualQ Coupled AQMs May 2021 Both these switch-overs are triggered by the tests for overload introduced in lines 4b and 12b of the dequeue function (Figure 7). Lines 8c to 8g drop L4S packets with probability p'^2. Lines 8h to 8i mark the remaining packets with probability p_CL. Given p_Lmax = 1, all remaining packets will be marked because, to have reached the else block at line 8b, p_CL >= 1. Lines 2c to 2d in the core PI algorithm (Figure 8) deal with overload of the L4S queue when there is no Classic traffic. This is necessary, because the core PI algorithm maintains the appropriate drop probability to regulate overload, but it depends on the length of the Classic queue. If there is no Classic queue the naive PI update function in Figure 6 would drop nothing, even if the L4S queue were overloaded - so tail drop would have to take over (lines 2 and 3 of Figure 3). Instead, the test at line 2a of the full PI update function in Figure 8 keeps delay on target using drop. If the test at line 2a of Figure 8 finds that the Classic queue is empty, line 2d measures the current queue delay using the L4S queue instead. While the L4S queue is not overloaded, its delay will always be tiny compared to the target Classic queue delay. So p_CL will be driven to zero, and the L4S queue will naturally be governed solely by p'_L from the native L4S AQM (lines 5 and 6 of the dequeue algorithm in Figure 7). But, if unresponsive L4S source(s) cause overload, the DualQ transitions smoothly to L4S marking based on the PI algorithm. If overload increases further, it naturally transitions from marking to dropping by the switch-over mechanism already described. De Schepper, et al. Expires November 22, 2021 [Page 41] Internet-Draft DualQ Coupled AQMs May 2021 1: dualpi2_dequeue(lq, cq, pkt) { % Couples L4S & Classic queues 2: while ( lq.len() + cq.len() > 0 ) { 3: if ( scheduler() == lq ) { 4a: lq.dequeue(pkt) % L4S scheduled 4b: if ( p_CL < p_Lmax ) { % Check for overload saturation 5: p'_L = laqm(lq.time()) % Native L4S AQM 6: p_L = max(p'_L, p_CL) % Combining function 7: if ( recur(lq, p_L) ) % Linear marking 8a: mark(pkt) 8b: } else { % overload saturation 8c: if ( recur(lq, p_C) ) { % probability p_C = p'^2 8e: drop(pkt) % revert to Classic drop due to overload 8f: continue % continue to the top of the while loop 8g: } 8h: if ( recur(lq, p_CL) ) % probability p_CL = k * p' 8i: mark(pkt) % linear marking of remaining packets 8j: } 9: } else { 10: cq.dequeue(pkt) % Classic scheduled 11: if ( recur(cq, p_C) ) { % probability p_C = p'^2 12a: if ( (ecn(pkt) == 0) % ECN field = not-ECT 12b: OR (p_C >= p_Cmax) ) { % Overload disables ECN 13: drop(pkt) % squared drop, redo loop 14: continue % continue to the top of the while loop 15: } 16: mark(pkt) % squared mark 17: } 18: } 19: return(pkt) % return the packet and stop 20: } 21: return(NULL) % no packet to dequeue 22: } Figure 7: Example Dequeue Pseudocode for DualQ Coupled PI2 AQM (Including Overload Code) De Schepper, et al. Expires November 22, 2021 [Page 42] Internet-Draft DualQ Coupled AQMs May 2021 1: dualpi2_update(lq, cq) { % Update p' every Tupdate 2a: if ( cq.len() > 0 ) 2b: curq = cq.time() %use queuing time of first-in Classic packet 2c: else % Classic queue empty 2d: curq = lq.time() % use queuing time of first-in L4S packet 3: p' = p' + alpha * (curq - target) + beta * (curq - prevq) 4: p_CL = p' * k % Coupled L4S prob = base prob * coupling factor 5: p_C = p'^2 % Classic prob = (base prob)^2 6: prevq = curq 7: } Figure 8: Example PI-Update Pseudocode for DualQ Coupled PI2 AQM (Including Overload Code) The choice of scheduler technology is critical to overload protection (see Section 4.1). o A well-understood weighted scheduler such as weighted round robin (WRR) is recommended. As long as the scheduler weight for Classic is small (e.g. 1/16), its exact value is unimportant because it does not normally determine capacity shares. The weight is only important to prevent unresponsive L4S traffic starving Classic traffic. This is because capacity sharing between the queues is normally determined by the coupled congestion signal, which overrides the scheduler, by making L4S sources leave roughly equal per-flow capacity available for Classic flows. o Alternatively, a time-shifted FIFO (TS-FIFO) could be used. It works by selecting the head packet that has waited the longest, biased against the Classic traffic by a time-shift of tshift. To implement time-shifted FIFO, the scheduler() function in line 3 of the dequeue code would simply be implemented as the scheduler() function at the bottom of Figure 10 in Appendix B. For the public Internet a good value for tshift is 50ms. For private networks with smaller diameter, about 4*target would be reasonable. TS- FIFO is a very simple scheduler, but complexity might need to be added to address some deficiencies (which is why it is not recommended over WRR): * TS-FIFO does not fully isolate latency in the L4S queue from uncontrolled bursts in the Classic queue; * TS-FIFO is only appropriate if time-stamping of packets is feasible; * Even if time-stamping is supported, the sojourn time of the head packet is always stale. For instance, if a burst arrives at an empty queue, the sojourn time will only measure the delay De Schepper, et al. Expires November 22, 2021 [Page 43] Internet-Draft DualQ Coupled AQMs May 2021 of the burst once the burst is over, even though the queue knew about it from the start. At the cost of more operations and more storage, a 'scaled sojourn time' metric of queue delay can be used, which is the sojourn time of a packet scaled by the ratio of the queue sizes when the packet departed and arrived [SigQ-Dyn]. o A strict priority scheduler would be inappropriate, because it would starve Classic if L4S was overloaded. Appendix B. Example DualQ Coupled Curvy RED Algorithm As another example of a DualQ Coupled AQM algorithm, the pseudocode below gives the Curvy RED based algorithm. Although the AQM was designed to be efficient in integer arithmetic, to aid understanding it is first given using floating point arithmetic (Figure 10). Then, one possible optimization for integer arithmetic is given, also in pseudocode (Figure 11). To aid comparison, the line numbers are kept in step between the two by using letter suffixes where the longer code needs extra lines. B.1. Curvy RED in Pseudocode The pseudocode manipulates three main structures of variables: the packet (pkt), the L4S queue (lq) and the Classic queue (cq) and consists of the following five functions: o The initialization function cred_params_init(...) (Figure 2) that sets parameter defaults (the API for setting non-default values is omitted for brevity); o The dequeue function cred_dequeue(lq, cq, pkt) (Figure 4); o The scheduling function scheduler(), which selects between the head packets of the two queues. It also uses the following functions that are either shown elsewhere, or not shown in full here: o The enqueue function, which is identical to that used for DualPI2, dualpi2_enqueue(lq, cq, pkt) in Figure 3; o mark(pkt) and drop(pkt) for ECN-marking and dropping a packet; o cq.len() or lq.len() returns the current length (aka. backlog) of the relevant queue in bytes; De Schepper, et al. Expires November 22, 2021 [Page 44] Internet-Draft DualQ Coupled AQMs May 2021 o cq.time() or lq.time() returns the current queuing delay (aka. sojourn time or service time) of the relevant queue in units of time (see Note a in Appendix A.1). Because Curvy RED was evaluated before DualPI2, certain improvements introduced for DualPI2 were not evaluated for Curvy RED. In the pseudocode below, the straightforward improvements have been added on the assumption they will provide similar benefits, but that has not been proven experimentally. They are: i) a conditional priority scheduler instead of strict priority ii) a time-based threshold for the native L4S AQM; iii) ECN support for the Classic AQM. A recent evaluation has proved that a minimum ECN-marking threshold (minTh) greatly improves performance, so this is also included in the pseudocode. Overload protection has not been added to the Curvy RED pseudocode below so as not to detract from the main features. It would be added in exactly the same way as in Appendix A.2 for the DualPI2 pseudocode. The native L4S AQM uses a step threshold, but a ramp like that described for DualPI2 could be used instead. The scheduler uses the simple TS-FIFO algorithm, but it could be replaced with WRR. The Curvy RED algorithm has not been maintained or evaluated to the same degree as the DualPI2 algorithm. In initial experiments on broadband access links ranging from 4 Mb/s to 200 Mb/s with base RTTs from 5 ms to 100 ms, Curvy RED achieved good results with the default parameters in Figure 9. The parameters are categorised by whether they relate to the Classic AQM, the L4S AQM or the framework coupling them together. Constants and variables derived from these parameters are also included at the end of each category. These are the raw input parameters for the algorithm. A configuration front-end could accept more meaningful parameters (e.g. RTT_max and RTT_typ) and convert them into these raw parameters, as has been done for DualPI2 in Appendix A. Where necessary, parameters are explained further in the walk-through of the pseudocode below. De Schepper, et al. Expires November 22, 2021 [Page 45] Internet-Draft DualQ Coupled AQMs May 2021 1: cred_params_init(...) { % Set input parameter defaults 2: % DualQ Coupled framework parameters 3: limit = MAX_LINK_RATE * 250 ms % Dual buffer size 4: k' = 1 % Coupling factor as a power of 2 5: tshift = 50 ms % Time shift of TS-FIFO scheduler 6: % Constants derived from Classic AQM parameters 7: k = 2^k' % Coupling factor from Equation (1) 6: 7: % Classic AQM parameters 8: g_C = 5 % EWMA smoothing parameter as a power of 1/2 9: S_C = -1 % Classic ramp scaling factor as a power of 2 10: minTh = 500 ms % No Classic drop/mark below this queue delay 11: % Constants derived from Classic AQM parameters 12: gamma = 2^(-g_C) % EWMA smoothing parameter 13: range_C = 2^S_C % Range of Classic ramp 14: 15: % L4S AQM parameters 16: T = 1 ms % Queue delay threshold for native L4S AQM 17: % Constants derived from above parameters 18: S_L = S_C - k' % L4S ramp scaling factor as a power of 2 19: range_L = 2^S_L % Range of L4S ramp 20: } Figure 9: Example Header Pseudocode for DualQ Coupled Curvy RED AQM De Schepper, et al. Expires November 22, 2021 [Page 46] Internet-Draft DualQ Coupled AQMs May 2021 1: cred_dequeue(lq, cq, pkt) { % Couples L4S & Classic queues 2: while ( lq.len() + cq.len() > 0 ) { 3: if ( scheduler() == lq ) { 4: lq.dequeue(pkt) % L4S scheduled 5a: p_CL = (Q_C - minTh) / range_L 5b: if ( ( lq.time() > T ) 5c: OR ( p_CL > maxrand(U) ) ) 6: mark(pkt) 7: } else { 8: cq.dequeue(pkt) % Classic scheduled 9a: Q_C = gamma * cq.time() + (1-gamma) * Q_C % Classic Q EWMA 10a: sqrt_p_C = (Q_C - minTh) / range_C 10b: if ( sqrt_p_C > maxrand(2*U) ) { 11: if ( (ecn(pkt) == 0) { % ECN field = not-ECT 12: drop(pkt) % Squared drop, redo loop 13: continue % continue to the top of the while loop 14: } 15: mark(pkt) 16: } 17: } 18: return(pkt) % return the packet and stop here 19: } 20: return(NULL) % no packet to dequeue 21: } 22: maxrand(u) { % return the max of u random numbers 23: maxr=0 24: while (u-- > 0) 25: maxr = max(maxr, rand()) % 0 <= rand() < 1 26: return(maxr) 27: } 28: scheduler() { 29: if ( lq.time() + tshift >= cq.time() ) 30: return lq; 31: else 32: return cq; 33: } Figure 10: Example Dequeue Pseudocode for DualQ Coupled Curvy RED AQM The dequeue pseudocode (Figure 10) is repeatedly called whenever the lower layer is ready to forward a packet. It schedules one packet for dequeuing (or zero if the queue is empty) then returns control to the caller, so that it does not block while that packet is being forwarded. While making this dequeue decision, it also makes the necessary AQM decisions on dropping or marking. The alternative of applying the AQMs at enqueue would shift some processing from the De Schepper, et al. Expires November 22, 2021 [Page 47] Internet-Draft DualQ Coupled AQMs May 2021 critical time when each packet is dequeued. However, it would also add a whole queue of delay to the control signals, making the control loop very sloppy. The code is written assuming the AQMs are applied on dequeue (Note 1). All the dequeue code is contained within a large while loop so that if it decides to drop a packet, it will continue until it selects a packet to schedule. If both queues are empty, the routine returns NULL at line 20. Line 3 of the dequeue pseudocode is where the conditional priority scheduler chooses between the L4S queue (lq) and the Classic queue (cq). The time-shifted FIFO scheduler is shown at lines 28-33, which would be suitable if simplicity is paramount (see Note 2). Within each queue, the decision whether to forward, drop or mark is taken as follows (to simplify the explanation, it is assumed that U=1): L4S: If the test at line 3 determines there is an L4S packet to dequeue, the tests at lines 5b and 5c determine whether to mark it. The first is a simple test of whether the L4S queue delay (lq.time()) is greater than a step threshold T (Note 3). The second test is similar to the random ECN marking in RED, but with the following differences: i) marking depends on queuing time, not bytes, in order to scale for any link rate without being reconfigured; ii) marking of the L4S queue depends on a logical OR of two tests; one against its own queuing time and one against the queuing time of the _other_ (Classic) queue; iii) the tests are against the instantaneous queuing time of the L4S queue, but a smoothed average of the other (Classic) queue; iv) the queue is compared with the maximum of U random numbers (but if U=1, this is the same as the single random number used in RED). Specifically, in line 5a the coupled marking probability p_CL is set to the amount by which the averaged Classic queueing delay Q_C exceeds the minimum queuing delay threshold (minTh) all divided by the L4S scaling parameter range_L. range_L represents the queuing delay (in seconds) added to minTh at which marking probability would hit 100%. Then in line 5c (if U=1) the result is compared with a uniformly distributed random number between 0 and 1, which ensures that, over range_L, marking probability will linearly increase with queueing time. Classic: If the scheduler at line 3 chooses to dequeue a Classic packet and jumps to line 7, the test at line 10b determines whether to drop or mark it. But before that, line 9a updates Q_C, which is an exponentially weighted moving average (Note 4) of the queuing time of the Classic queue, where cq.time() is the current De Schepper, et al. Expires November 22, 2021 [Page 48] Internet-Draft DualQ Coupled AQMs May 2021 instantaneous queueing time of the packet at the head of the Classic queue (zero if empty) and gamma is the EWMA constant (default 1/32, see line 12 of the initialization function). Lines 10a and 10b implement the Classic AQM. In line 10a the averaged queuing time Q_C is divided by the Classic scaling parameter range_C, in the same way that queuing time was scaled for L4S marking. This scaled queuing time will be squared to compute Classic drop probability so, before it is squared, it is effectively the square root of the drop probability, hence it is given the variable name sqrt_p_C. The squaring is done by comparing it with the maximum out of two random numbers (assuming U=1). Comparing it with the maximum out of two is the same as the logical `AND' of two tests, which ensures drop probability rises with the square of queuing time. The AQM functions in each queue (lines 5c & 10b) are two cases of a new generalization of RED called Curvy RED, motivated as follows. When the performance of this AQM was compared with FQ-CoDel and PIE, their goal of holding queuing delay to a fixed target seemed misguided [CRED_Insights]. As the number of flows increases, if the AQM does not allow host congestion controllers to increase queuing delay, it has to introduce abnormally high levels of loss. Then loss rather than queuing becomes the dominant cause of delay for short flows, due to timeouts and tail losses. Curvy RED constrains delay with a softened target that allows some increase in delay as load increases. This is achieved by increasing drop probability on a convex curve relative to queue growth (the square curve in the Classic queue, if U=1). Like RED, the curve hugs the zero axis while the queue is shallow. Then, as load increases, it introduces a growing barrier to higher delay. But, unlike RED, it requires only two parameters, not three. The disadvantage of Curvy RED (compared to a PI controller for example) is that it is not adapted to a wide range of RTTs. Curvy RED can be used as is when the RTT range to be supported is limited, otherwise an adaptation mechanism is required. From our limited experiments with Curvy RED so far, recommended values of these parameters are: S_C = -1; g_C = 5; T = 5 * MTU at the link rate (about 1ms at 60Mb/s) for the range of base RTTs typical on the public Internet. [CRED_Insights] explains why these parameters are applicable whatever rate link this AQM implementation is deployed on and how the parameters would need to be adjusted for a scenario with a different range of RTTs (e.g. a data centre). The setting of k depends on policy (see Section 2.5 and Appendix C.2 respectively for its recommended setting and guidance on alternatives). De Schepper, et al. Expires November 22, 2021 [Page 49] Internet-Draft DualQ Coupled AQMs May 2021 There is also a cUrviness parameter, U, which is a small positive integer. It is likely to take the same hard-coded value for all implementations, once experiments have determined a good value. Only U=1 has been used in experiments so far, but results might be even better with U=2 or higher. Notes: 1. The alternative of applying the AQMs at enqueue would shift some processing from the critical time when each packet is dequeued. However, it would also add a whole queue of delay to the control signals, making the control loop sloppier (for a typical RTT it would double the Classic queue's feedback delay). On a platform where packet timestamping is feasible, e.g. Linux, it is also easiest to apply the AQMs at dequeue because that is where queuing time is also measured. 2. WRR better isolates the L4S queue from large delay bursts in the Classic queue, but it is slightly less simple than TS-FIFO. If WRR were used, a low default Classic weight (e.g. 1/16) would need to be configured in place of the time shift in line 5 of the initialization function (Figure 9). 3. A step function is shown for simplicity. A ramp function (see Figure 5 and the discussion around it in Appendix A.1) is recommended, because it is more general than a step and has the potential to enable L4S congestion controls to converge more rapidly. 4. An EWMA is only one possible way to filter bursts; other more adaptive smoothing methods could be valid and it might be appropriate to decrease the EWMA faster than it increases, e.g. by using the minimum of the smoothed and instantaneous queue delays, min(Q_C, qc.time()). B.2. Efficient Implementation of Curvy RED Although code optimization depends on the platform, the following notes explain where the design of Curvy RED was particularly motivated by efficient implementation. The Classic AQM at line 10b calls maxrand(2*U), which gives twice as much curviness as the call to maxrand(U) in the marking function at line 5c. This is the trick that implements the square rule in equation (1) (Section 2.1). This is based on the fact that, given a number X from 1 to 6, the probability that two dice throws will both be less than X is the square of the probability that one throw will be less than X. So, when U=1, the L4S marking function is linear and De Schepper, et al. Expires November 22, 2021 [Page 50] Internet-Draft DualQ Coupled AQMs May 2021 the Classic dropping function is squared. If U=2, L4S would be a square function and Classic would be quartic. And so on. The maxrand(u) function in lines 16-21 simply generates u random numbers and returns the maximum. Typically, maxrand(u) could be run in parallel out of band. For instance, if U=1, the Classic queue would require the maximum of two random numbers. So, instead of calling maxrand(2*U) in-band, the maximum of every pair of values from a pseudorandom number generator could be generated out-of-band, and held in a buffer ready for the Classic queue to consume. 1: cred_dequeue(lq, cq, pkt) { % Couples L4S & Classic queues 2: while ( lq.len() + cq.len() > 0 ) { 3: if ( scheduler() == lq ) { 4: lq.dequeue(pkt) % L4S scheduled 5: if ((lq.time() > T) OR (Q_C >> (S_L-2) > maxrand(U))) 6: mark(pkt) 7: } else { 8: cq.dequeue(pkt) % Classic scheduled 9: Q_C += (qc.ns() - Q_C) >> g_C % Classic Q EWMA 10: if ( (Q_C >> (S_C-2) ) > maxrand(2*U) ) { 11: if ( (ecn(pkt) == 0) { % ECN field = not-ECT 12: drop(pkt) % Squared drop, redo loop 13: continue % continue to the top of the while loop 14: } 15: mark(pkt) 16: } 17: } 18: return(pkt) % return the packet and stop here 19: } 20: return(NULL) % no packet to dequeue 21: } Figure 11: Optimised Example Dequeue Pseudocode for Coupled DualQ AQM using Integer Arithmetic The two ranges, range_L and range_C are expressed as powers of 2 so that division can be implemented as a right bit-shift (>>) in lines 5 and 10 of the integer variant of the pseudocode (Figure 11). For the integer variant of the pseudocode, an integer version of the rand() function used at line 25 of the maxrand(function) in Figure 10 would be arranged to return an integer in the range 0 <= maxrand() < 2^32 (not shown). This would scale up all the floating point probabilities in the range [0,1] by 2^32. Queuing delays are also scaled up by 2^32, but in two stages: i) In line 9 queuing time qc.ns() is returned in integer nanoseconds, De Schepper, et al. Expires November 22, 2021 [Page 51] Internet-Draft DualQ Coupled AQMs May 2021 making the value about 2^30 times larger than when the units were seconds, ii) then in lines 5 and 10 an adjustment of -2 to the right bit-shift multiplies the result by 2^2, to complete the scaling by 2^32. In line 8 of the initialization function, the EWMA constant gamma is represented as an integer power of 2, g_C, so that in line 9 of the integer code the division needed to weight the moving average can be implemented by a right bit-shift (>> g_C). Appendix C. Choice of Coupling Factor, k C.1. RTT-Dependence Where Classic flows compete for the same capacity, their relative flow rates depend not only on the congestion probability, but also on their end-to-end RTT (= base RTT + queue delay). The rates of competing Reno [RFC5681] flows are roughly inversely proportional to their RTTs. Cubic exhibits similar RTT-dependence when in Reno- compatibility mode, but is less RTT-dependent otherwise. Until the early experiments with the DualQ Coupled AQM, the importance of the reasonably large Classic queue in mitigating RTT- dependence had not been appreciated. Appendix A.1.6 of [I-D.ietf-tsvwg-ecn-l4s-id] uses numerical examples to explain why bloated buffers had concealed the RTT-dependence of Classic congestion controls before that time. Then it explains why, the more that queuing delays have reduced, the more that RTT-dependence has surfaced as a potential starvation problem for long RTT flows. Given that congestion control on end-systems is voluntary, there is no reason why it has to be voluntarily RTT-dependent. Therefore [I-D.ietf-tsvwg-ecn-l4s-id] requires L4S congestion controls to be significantly less RTT-dependent than the standard Reno congestion control [RFC5681]. Following this approach means there is no need for network devices to address RTT-dependence, although there would be no harm if they did, which per-flow queuing inherently does. At the time of writing, the range of approaches to RTT-dependence in L4S congestion controls has not settled. Therefore, the guidance on the choice of the coupling factor in Appendix C.2 is given against DCTCP [RFC8257], which has well-understood RTT-dependence. The guidance is given for various RTT ratios, so that it can be adapted to future circumstances. De Schepper, et al. Expires November 22, 2021 [Page 52] Internet-Draft DualQ Coupled AQMs May 2021 C.2. Guidance on Controlling Throughput Equivalence +---------------+------+-------+ | RTT_C / RTT_L | Reno | Cubic | +---------------+------+-------+ | 1 | k'=1 | k'=0 | | 2 | k'=2 | k'=1 | | 3 | k'=2 | k'=2 | | 4 | k'=3 | k'=2 | | 5 | k'=3 | k'=3 | +---------------+------+-------+ Table 1: Value of k' for which DCTCP throughput is roughly the same as Reno or Cubic, for some example RTT ratios In the above appendices that give example DualQ Coupled algorithms, to aid efficient implementation, a coupling factor that is an integer power of 2 is always used. k' is always used to denote the power. k' is related to the coupling factor k in Equation (1) (Section 2.1) by k=2^k'. To determine the appropriate coupling factor policy, the operator first has to judge whether it wants DCTCP flows to have roughly equal throughput with Reno or with Cubic (because, even in its Reno- compatibility mode, Cubic is about 1.4 times more aggressive than Reno). Then the operator needs to decide at what ratio of RTTs it wants DCTCP and Classic flows to have roughly equal throughput. For example choosing k'=0 (equivalent to k=1) will make DCTCP throughput roughly the same as Cubic, _if their RTTs are the same_. However, even if the base RTTs are the same, the actual RTTs are unlikely to be the same, because Classic (Cubic or Reno) traffic needs roughly a typical base round trip of queue to avoid under- utilization and excess drop. Whereas L4S (DCTCP) does not. The operator might still choose this policy if it judges that DCTCP throughput should be rewarded for keeping its own queue short. On the other hand, the operator will choose one of the higher values for k', if it wants to slow DCTCP down to roughly the same throughput as Classic flows, to compensate for Classic flows slowing themselves down by causing themselves extra queuing delay. The values for k' in the table are derived from the formulae below, which were developed in [DCttH15]: 2^k' = 1.64 (RTT_reno / RTT_dc) (5) 2^k' = 1.19 (RTT_cubic / RTT_dc ) (6) De Schepper, et al. Expires November 22, 2021 [Page 53] Internet-Draft DualQ Coupled AQMs May 2021 For localized traffic from a particular ISP's data centre, using the measured RTTs, it was calculated that a value of k'=3 (equivalent to k=8) would achieve throughput equivalence, and experiments verified the formula very closely. For a typical mix of RTTs from local data centres and across the general Internet, a value of k'=1 (equivalent to k=2) is recommended as a good workable compromise. Authors' Addresses Koen De Schepper Nokia Bell Labs Antwerp Belgium Email: koen.de_schepper@nokia.com URI: https://www.bell-labs.com/usr/koen.de_schepper Bob Briscoe (editor) Independent UK Email: ietf@bobbriscoe.net URI: http://bobbriscoe.net/ Greg White CableLabs Louisville, CO US Email: G.White@CableLabs.com De Schepper, et al. Expires November 22, 2021 [Page 54]