idnits 2.17.1 draft-ietf-quic-recovery-00.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 : ---------------------------------------------------------------------------- ** The document seems to lack a Security Considerations section. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to lack the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. (The document does seem to have the reference to RFC 2119 which the ID-Checklist requires). -- The document date (November 28, 2016) is 2706 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Unused Reference: 'QUIC-TLS' is defined on line 459, but no explicit reference was found in the text -- Possible downref: Non-RFC (?) normative reference: ref. 'QUIC-TLS' -- Possible downref: Non-RFC (?) normative reference: ref. 'QUIC-TRANSPORT' Summary: 1 error (**), 0 flaws (~~), 3 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 QUIC J. Iyengar, Ed. 3 Internet-Draft I. Swett, Ed. 4 Intended status: Standards Track Google 5 Expires: June 1, 2017 November 28, 2016 7 QUIC Loss Detection and Congestion Control 8 draft-ietf-quic-recovery-00 10 Abstract 12 QUIC is a new multiplexed and secure transport atop UDP. QUIC builds 13 on decades of transport and security experience, and implements 14 mechanisms that make it attractive as a modern general-purpose 15 transport. QUIC implements the spirit of known TCP loss detection 16 mechanisms, described in RFCs, various Internet-drafts, and also 17 those prevalent in the Linux TCP implementation. This document 18 describes QUIC loss detection and congestion control, and attributes 19 the TCP equivalent in RFCs, Internet-drafts, academic papers, and TCP 20 implementations. 22 Status of This Memo 24 This Internet-Draft is submitted in full conformance with the 25 provisions of BCP 78 and BCP 79. 27 Internet-Drafts are working documents of the Internet Engineering 28 Task Force (IETF). Note that other groups may also distribute 29 working documents as Internet-Drafts. The list of current Internet- 30 Drafts is at http://datatracker.ietf.org/drafts/current/. 32 Internet-Drafts are draft documents valid for a maximum of six months 33 and may be updated, replaced, or obsoleted by other documents at any 34 time. It is inappropriate to use Internet-Drafts as reference 35 material or to cite them other than as "work in progress." 37 This Internet-Draft will expire on June 1, 2017. 39 Copyright Notice 41 Copyright (c) 2016 IETF Trust and the persons identified as the 42 document authors. All rights reserved. 44 This document is subject to BCP 78 and the IETF Trust's Legal 45 Provisions Relating to IETF Documents 46 (http://trustee.ietf.org/license-info) in effect on the date of 47 publication of this document. Please review these documents 48 carefully, as they describe your rights and restrictions with respect 49 to this document. Code Components extracted from this document must 50 include Simplified BSD License text as described in Section 4.e of 51 the Trust Legal Provisions and are provided without warranty as 52 described in the Simplified BSD License. 54 Table of Contents 56 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 57 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 3 58 2. Design of the QUIC Transmission Machinery . . . . . . . . . . 3 59 2.1. Relevant Differences Between QUIC and TCP . . . . . . . . 4 60 2.1.1. Monotonically Increasing Packet Numbers . . . . . . . 4 61 2.1.2. No Reneging . . . . . . . . . . . . . . . . . . . . . 4 62 2.1.3. More ACK Ranges . . . . . . . . . . . . . . . . . . . 4 63 2.1.4. Explicit Correction For Delayed Acks . . . . . . . . 5 64 3. Loss Detection . . . . . . . . . . . . . . . . . . . . . . . 5 65 3.1. Variables of interest . . . . . . . . . . . . . . . . . . 5 66 3.2. Initialization . . . . . . . . . . . . . . . . . . . . . 6 67 3.3. Setting the Loss Detection Alarm . . . . . . . . . . . . 6 68 3.4. On Sending a Packet . . . . . . . . . . . . . . . . . . . 7 69 3.5. On Packet Acknowledgment . . . . . . . . . . . . . . . . 7 70 3.6. On Alarm Firing . . . . . . . . . . . . . . . . . . . . . 7 71 3.7. Detecting Lost Packets . . . . . . . . . . . . . . . . . 8 72 4. Congestion Control . . . . . . . . . . . . . . . . . . . . . 8 73 5. TCP mechanisms in QUIC . . . . . . . . . . . . . . . . . . . 8 74 5.1. RFC 6298 (RTO computation) . . . . . . . . . . . . . . . 8 75 5.2. FACK Loss Recovery (paper) . . . . . . . . . . . . . . . 9 76 5.3. RFC 3782, RFC 6582 (NewReno Fast Recovery) . . . . . . . 9 77 5.4. TLP (draft) . . . . . . . . . . . . . . . . . . . . . . . 9 78 5.5. RFC 5827 (Early Retransmit) with Delay Timer . . . . . . 9 79 5.6. RFC 5827 (F-RTO) . . . . . . . . . . . . . . . . . . . . 9 80 5.7. RFC 6937 (Proportional Rate Reduction) . . . . . . . . . 10 81 5.8. TCP Cubic (draft) with optional RFC 5681 (Reno) . . . . . 10 82 5.9. Hybrid Slow Start (paper) . . . . . . . . . . . . . . . . 10 83 5.10. RACK (draft) . . . . . . . . . . . . . . . . . . . . . . 10 84 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 10 85 7. Normative References . . . . . . . . . . . . . . . . . . . . 10 86 Appendix A. Acknowledgments . . . . . . . . . . . . . . . . . . 11 87 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 11 89 1. Introduction 91 QUIC is a new multiplexed and secure transport atop UDP. QUIC builds 92 on decades of transport and security experience, and implements 93 mechanisms that make it attractive as a modern general-purpose 94 transport. The QUIC protocol is described in [QUIC-TRANSPORT]. 96 QUIC implements the spirit of known TCP loss recovery mechanisms, 97 described in RFCs, various Internet-drafts, and also those prevalent 98 in the Linux TCP implementation. This document describes QUIC 99 congestion control and loss recovery, and where applicable, 100 attributes the TCP equivalent in RFCs, Internet-drafts, academic 101 papers, and/or TCP implementations. 103 This document first describes pre-requisite parts of the QUIC 104 transmission machinery, then discusses QUIC's default congestion 105 control and loss detection mechanisms, and finally lists the various 106 TCP mechanisms that QUIC loss detection implements (in spirit.) 108 1.1. Notational Conventions 110 The words "MUST", "MUST NOT", "SHOULD", and "MAY" are used in this 111 document. It's not shouting; when they are capitalized, they have 112 the special meaning defined in [RFC2119]. 114 2. Design of the QUIC Transmission Machinery 116 All transmissions in QUIC are sent with a packet-level header, which 117 includes a packet sequence number (referred to below as a packet 118 number). These packet numbers never repeat in the lifetime of a 119 connection, and are monotonically increasing, which makes duplicate 120 detection trivial. This fundamental design decision obviates the 121 need for disambiguating between transmissions and retransmissions and 122 eliminates significant complexity from QUIC's interpretation of TCP 123 loss detection mechanisms. 125 Every packet may contain several frames. We outline the frames that 126 are important to the loss detection and congestion control machinery 127 below. 129 o Retransmittable frames are frames requiring reliable delivery. 130 The most common are STREAM frames, which typically contain 131 application data. 133 o Crypto handshake data is also sent as STREAM data, and uses the 134 reliability machinery of QUIC underneath. 136 o ACK frames contain acknowledgment information. QUIC uses a SACK- 137 based scheme, where acks express up to 256 ranges. The ACK frame 138 also includes a receive timestamp for each packet newly acked. 140 2.1. Relevant Differences Between QUIC and TCP 142 There are some notable differences between QUIC and TCP which are 143 important for reasoning about the differences between the loss 144 recovery mechanisms employed by the two protocols. We briefly 145 describe these differences below. 147 2.1.1. Monotonically Increasing Packet Numbers 149 TCP conflates transmission sequence number at the sender with 150 delivery sequence number at the receiver, which results in 151 retransmissions of the same data carrying the same sequence number, 152 and consequently to problems caused by "retransmission ambiguity". 153 QUIC separates the two: QUIC uses a packet sequence number (referred 154 to as the "packet number") for transmissions, and any data that is to 155 be delivered to the receiving application(s) is sent in one or more 156 streams, with stream offsets encoded within STREAM frames inside of 157 packets that determine delivery order. 159 QUIC's packet number is strictly increasing, and directly encodes 160 transmission order. A higher QUIC packet number signifies that the 161 packet was sent later, and a lower QUIC packet number signifies that 162 the packet was sent earlier. When a packet containing frames is 163 deemed lost, QUIC rebundles necessary frames in a new packet with a 164 new packet number, removing ambiguity about which packet is 165 acknowledged when an ACK is received. Consequently, more accurate 166 RTT measurements can be made, spurious retransmissions are trivially 167 detected, and mechanisms such as Fast Retransmit can be applied 168 universally, based only on packet number. 170 This design point significantly simplifies loss detection mechanisms 171 for QUIC. Most TCP mechanisms implicitly attempt to infer 172 transmission ordering based on TCP sequence numbers - a non-trivial 173 task, especially when TCP timestamps are not available. 175 2.1.2. No Reneging 177 QUIC ACKs contain information that is equivalent to TCP SACK, but 178 QUIC does not allow any acked packet to be reneged, greatly 179 simplifying implementations on both sides and reducing memory 180 pressure on the sender. 182 2.1.3. More ACK Ranges 184 QUIC supports up to 256 ACK ranges, opposed to TCP's 3 SACK ranges. 185 In high loss environments, this speeds recovery. 187 2.1.4. Explicit Correction For Delayed Acks 189 QUIC ACKs explicitly encode the delay incurred at the receiver 190 between when a packet is received and when the corresponding ACK is 191 sent. This allows the receiver of the ACK to adjust for receiver 192 delays, specifically the delayed ack timer, when estimating the path 193 RTT. This mechanism also allows a receiver to measure and report the 194 delay from when a packet was received by the OS kernel, which is 195 useful in receivers which may incur delays such as context-switch 196 latency before a userspace QUIC receiver processes a received packet. 198 3. Loss Detection 200 We now describe QUIC's loss detection as functions that should be 201 called on packet transmission, when a packet is acked, and timer 202 expiration events. 204 3.1. Variables of interest 206 We first describe the variables required to implement the loss 207 detection mechanisms described in this section. 209 o loss_detection_alarm: Multi-modal alarm used for loss detection. 211 o alarm_mode: QUIC maintains a single loss detection alarm, which 212 switches between various modes. This mode is used to determine 213 the duration of the alarm. 215 o handshake_count: The number of times the handshake packets have 216 been retransmitted without receiving an ack. 218 o tlp_count: The number of times a tail loss probe has been sent 219 without receiving an ack. 221 o rto_count: The number of times an rto has been sent without 222 receiving an ack. 224 o smoothed_rtt: The smoothed RTT of the connection, computed as 225 described in [RFC6298]. TODO: Describe RTT computations. 227 o reordering_threshold: The largest delta between the largest acked 228 retransmittable packet and a packet containing retransmittable 229 frames before it's declared lost. 231 o time_loss: When true, loss detection operates solely based on 232 reordering threshold in time, rather than in packet number gaps. 234 3.2. Initialization 236 At the beginning of the connection, initialize the loss detection 237 variables as follows: 239 loss_detection_alarm.reset(); 240 handshake_count = 0; 241 tlp_count = 0; 242 rto_count = 0; 243 smoothed_rtt = 0; 244 reordering_threshold = 3; 245 time_loss = false; 247 3.3. Setting the Loss Detection Alarm 249 QUIC loss detection uses a single alarm for all timer-based loss 250 detection. The duration of the alarm is based on the alarm's mode, 251 which is set in the packet and timer events further below. The 252 function SetLossDetectionAlarm defined below shows how the single 253 timer is set based on the alarm mode. 255 Pseudocode for SetLossDetectionAlarm follows: 257 SetLossDetectionAlarm(): 258 if (retransmittable packets are not outstanding): 259 loss_detection_alarm.cancel(); 260 return; 261 if (handshake packets are outstanding): 262 alarm_duration = max(1.5 * smoothed_rtt, 10ms) << handshake_count; 263 handshake_count++; 264 else if (largest sent packet is acked): 265 // Set alarm based on short timer for early retransmit. 266 alarm_duration = 0.25 x smoothed_rtt; 267 else if (tlp_count < 2): 268 if (retransmittable_packets_outstanding = 1): 269 alarm_duration = max(1.5 x smoothed_rtt + delayed_ack_timer, 270 2 x smoothed_rtt); 271 else: 272 alarm_duration = max (10ms, 2 x smoothed_rtt); 273 tlp_count++; 274 else: 275 if (rto_count = 0): 276 alarm_duration = max(200ms, smoothed_rtt + 4 x rttvar); 277 else: 278 alarm_duration = loss_detection_alarm.get_delay() << 1; 279 rto_count++; 281 loss_detection_alarm.set(now + alarm_duration); 283 3.4. On Sending a Packet 285 After any packet is sent, be it a new transmission or a rebundled 286 transmission, the following OnPacketSent function is called. The 287 parameters to OnPacketSent are as follows: 289 o packet_number: The packet number of the sent packet. 291 o is_retransmittble: A boolean that indicates whether the packet 292 contains at least one frame requiring reliable deliver. The 293 retransmittability of various QUIC frames is described in 294 [QUIC-TRANSPORT]. If false, it is still acceptable for an ack to 295 be received for this packet. However, a caller MUST NOT set 296 is_retransmittable to true if an ack is not expected. 298 Pseudocode for OnPacketSent follows: 300 OnPacketSent(packet_number, is_retransmittable): 301 if is_retransmittable: 302 SetLossDetectionAlarm() 304 3.5. On Packet Acknowledgment 306 When a packet is acked for the first time, the following 307 OnPacketAcked function is called. Note that a single ACK frame may 308 newly acknowledge several packets. OnPacketAcked must be called once 309 for each of these newly acked packets. 311 OnPacketAcked takes one parameter, acked_packet, which is the packet 312 number of the newly acked packet, and returns a list of packet 313 numbers that are detected as lost. 315 Pseudocode for OnPacketAcked follows: 317 OnPacketAcked(acked_packet): 318 handshake_count = 0; 319 tlp_count = 0; 320 rto_count = 0; 321 UpdateRtt(); // TODO: document RTT estimator. 322 DetectLostPackets(acked_packet); 323 SetLossDetectionAlarm(); 325 3.6. On Alarm Firing 327 QUIC uses one loss recovery alarm, which when set, can be in one of 328 several modes. When the alarm fires, the mode determines the action 329 to be performed. OnAlarm returns a list of packet numbers that are 330 detected as lost. 332 Pseudocode for OnAlarm follows: 334 OnAlarm(acked_packet): 335 lost_packets = DetectLostPackets(acked_packet); 336 MaybeRetransmitLostPackets(); 337 SetLossDetectionAlarm(); 339 3.7. Detecting Lost Packets 341 Packets in QUIC are only considered lost once a larger packet number 342 is acknowledged. DetectLostPackets is called every time there is a 343 new largest packet or if the loss detection alarm fires the previous 344 largest acked packet is supplied. 346 DetectLostPackets takes one parameter, acked_packet, which is the 347 packet number of the largest acked packet, and returns a list of 348 packet numbers detected as lost. 350 Pseudocode for DetectLostPackets follows: 352 DetectLostPackets(acked_packet): 353 lost_packets = {}; 354 foreach (unacked_packet less than acked_packet): 355 if (unacked_packet.time_sent < 356 acked_packet.time_sent - 1/8 * smoothed_rtt): 357 lost_packets.insert(unacked_packet.packet_number); 358 else if (unacked_packet.packet_number < 359 acked_packet.packet_number - reordering_threshold) 360 lost_packets.insert(unacked_packet.packet_number); 361 return lost_packets; 363 4. Congestion Control 365 (describe NewReno-style congestion control for QUIC.) 367 5. TCP mechanisms in QUIC 369 QUIC implements the spirit of a variety of RFCs, Internet drafts, and 370 other well-known TCP loss recovery mechanisms, though the 371 implementation details differ from the TCP implementations. 373 5.1. RFC 6298 (RTO computation) 375 QUIC calculates SRTT and RTTVAR according to the standard formulas. 376 An RTT sample is only taken if the delayed ack correction is smaller 377 than the measured RTT (otherwise a negative RTT would result), and 378 the ack's contains a new, larger largest observed packet number. 380 min_rtt is only based on the observed RTT, but SRTT uses the delayed 381 ack correction delta. 383 As described above, QUIC implements RTO with the standard timeout and 384 CWND reduction. However, QUIC retransmits the earliest outstanding 385 packets rather than the latest, because QUIC doesn't have 386 retransmission ambiguity. QUIC uses the commonly accepted min RTO of 387 200ms instead of the 1s the RFC specifies. 389 5.2. FACK Loss Recovery (paper) 391 QUIC implements the algorithm for early loss recovery described in 392 the FACK paper (and implemented in the Linux kernel.) QUIC uses the 393 packet number to measure the FACK reordering threshold. Currently 394 QUIC does not implement an adaptive threshold as many TCP 395 implementations (i.e., the Linux kernel) do. 397 5.3. RFC 3782, RFC 6582 (NewReno Fast Recovery) 399 QUIC only reduces its CWND once per congestion window, in keeping 400 with the NewReno RFC. It tracks the largest outstanding packet at 401 the time the loss is declared and any losses which occur before that 402 packet number are considered part of the same loss event. It's worth 403 noting that some TCP implementations may do this on a sequence number 404 basis, and hence consider multiple losses of the same packet a single 405 loss event. 407 5.4. TLP (draft) 409 QUIC always sends two tail loss probes before RTO is triggered. QUIC 410 invokes tail loss probe even when a loss is outstanding, which is 411 different than some TCP implementations. 413 5.5. RFC 5827 (Early Retransmit) with Delay Timer 415 QUIC implements early retransmit with a timer in order to minimize 416 spurious retransmits. The timer is set to 1/4 SRTT after the final 417 outstanding packet is acked. 419 5.6. RFC 5827 (F-RTO) 421 QUIC implements F-RTO by not reducing the CWND and SSThresh until a 422 subsequent ack is received and it's sure the RTO was not spurious. 423 Conceptually this is similar, but it makes for a much cleaner 424 implementation with fewer edge cases. 426 5.7. RFC 6937 (Proportional Rate Reduction) 428 PRR-SSRB is implemented by QUIC in the epoch when recovering from a 429 loss. 431 5.8. TCP Cubic (draft) with optional RFC 5681 (Reno) 433 TCP Cubic is the default congestion control algorithm in QUIC. Reno 434 is also an easily available option which may be requested via 435 connection options and is fully implemented. 437 5.9. Hybrid Slow Start (paper) 439 QUIC implements hybrid slow start, but disables ack train detection, 440 because it has shown to falsely trigger when coupled with packet 441 pacing, which is also on by default in QUIC. Currently the minimum 442 delay increase is 4ms, the maximum is 16ms, and within that range 443 QUIC exits slow start if the min_rtt within a round increases by more 444 than one eighth of the connection mi 446 5.10. RACK (draft) 448 QUIC's loss detection is by it's time-ordered nature, very similar to 449 RACK. Though QUIC defaults to loss detection based on reordering 450 threshold in packets, it could just as easily be based on fractions 451 of an rtt, as RACK does. 453 6. IANA Considerations 455 This document has no IANA actions. Yet. 457 7. Normative References 459 [QUIC-TLS] 460 Thomson, M., Ed. and S. Turner, Ed, Ed., "Using Transport 461 Layer Security (TLS) to Secure QUIC", November 2016. 463 [QUIC-TRANSPORT] 464 Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based 465 Multiplexed and Secure Transport", November 2016. 467 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 468 Requirement Levels", BCP 14, RFC 2119, 469 DOI 10.17487/RFC2119, March 1997, 470 . 472 [RFC6298] Paxson, V., Allman, M., Chu, J., and M. Sargent, 473 "Computing TCP's Retransmission Timer", RFC 6298, 474 DOI 10.17487/RFC6298, June 2011, 475 . 477 Appendix A. Acknowledgments 479 Authors' Addresses 481 Jana Iyengar (editor) 482 Google 484 Email: jri@google.com 486 Ian Swett (editor) 487 Google 489 Email: ianswett@google.com