idnits 2.17.1 draft-ietf-tcpm-rack-11.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 : ---------------------------------------------------------------------------- ** There is 1 instance of too long lines in the document, the longest one being 2 characters in excess of 72. ** The abstract seems to contain references ([RFC2018], [RFC5681], [RFC6675]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (September 30, 2020) is 1304 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'RFC8174' is mentioned on line 116, but not defined == Missing Reference: 'RFC3522' is mentioned on line 1202, but not defined == Missing Reference: 'RACK-TCPM97' is mentioned on line 459, but not defined == Missing Reference: 'DMCG11' is mentioned on line 733, but not defined == Missing Reference: 'RFC3042' is mentioned on line 917, but not defined ** Obsolete normative reference: RFC 793 (Obsoleted by RFC 9293) -- No information found for draft-ietf-quic-recovery-latest - is the name correct? Summary: 3 errors (**), 0 flaws (~~), 6 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 TCP Maintenance Working Group Y. Cheng 3 Internet-Draft N. Cardwell 4 Intended status: Standards Track N. Dukkipati 5 Expires: April 3, 2021 P. Jha 6 Google, Inc 7 September 30, 2020 9 The RACK-TLP loss detection algorithm for TCP 10 draft-ietf-tcpm-rack-11 12 Abstract 14 This document presents the RACK-TLP loss detection algorithm for TCP. 15 RACK-TLP uses per-segment transmit timestamps and selective 16 acknowledgements (SACK) [RFC2018] and has two parts: RACK ("Recent 17 ACKnowledgment") starts fast recovery quickly using time-based 18 inferences derived from ACK feedback. TLP ("Tail Loss Probe") 19 leverages RACK and sends a probe packet to trigger ACK feedback to 20 avoid retransmission timeout (RTO) events. Compared to the widely 21 used DUPACK threshold approach, RACK-TLP detects losses more 22 efficiently when there are application-limited flights of data, lost 23 retransmissions, or data packet reordering events. It is intended to 24 be an alternative to the DUPACK threshold approach in 25 [RFC5681][RFC6675]. 27 Status of This Memo 29 This Internet-Draft is submitted in full conformance with the 30 provisions of BCP 78 and BCP 79. 32 Internet-Drafts are working documents of the Internet Engineering 33 Task Force (IETF). Note that other groups may also distribute 34 working documents as Internet-Drafts. The list of current Internet- 35 Drafts is at https://datatracker.ietf.org/drafts/current/. 37 Internet-Drafts are draft documents valid for a maximum of six months 38 and may be updated, replaced, or obsoleted by other documents at any 39 time. It is inappropriate to use Internet-Drafts as reference 40 material or to cite them other than as "work in progress." 42 This Internet-Draft will expire on April 3, 2021. 44 Copyright Notice 46 Copyright (c) 2020 IETF Trust and the persons identified as the 47 document authors. All rights reserved. 49 This document is subject to BCP 78 and the IETF Trust's Legal 50 Provisions Relating to IETF Documents 51 (https://trustee.ietf.org/license-info) in effect on the date of 52 publication of this document. Please review these documents 53 carefully, as they describe your rights and restrictions with respect 54 to this document. Code Components extracted from this document must 55 include Simplified BSD License text as described in Section 4.e of 56 the Trust Legal Provisions and are provided without warranty as 57 described in the Simplified BSD License. 59 Table of Contents 61 1. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 62 2. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 63 2.1. Background . . . . . . . . . . . . . . . . . . . . . . . 3 64 2.2. Motivation . . . . . . . . . . . . . . . . . . . . . . . 4 65 3. RACK-TLP high-level design . . . . . . . . . . . . . . . . . 5 66 3.1. RACK: time-based loss inferences from ACKs . . . . . . . 5 67 3.2. TLP: sending one segment to probe losses quickly with 68 RACK . . . . . . . . . . . . . . . . . . . . . . . . . . 6 69 3.3. RACK-TLP: reordering resilience with a time threshold . . 6 70 3.3.1. Reordering design rationale . . . . . . . . . . . . . 6 71 3.3.2. Reordering window adaptation . . . . . . . . . . . . 8 72 3.4. An Example of RACK-TLP in Action: fast recovery . . . . . 9 73 3.5. An Example of RACK-TLP in Action: RTO . . . . . . . . . . 10 74 3.6. Design Summary . . . . . . . . . . . . . . . . . . . . . 10 75 4. Requirements . . . . . . . . . . . . . . . . . . . . . . . . 11 76 5. Definitions . . . . . . . . . . . . . . . . . . . . . . . . . 11 77 5.1. Per-segment variables . . . . . . . . . . . . . . . . . . 11 78 5.2. Per-connection variables . . . . . . . . . . . . . . . . 12 79 6. RACK Algorithm Details . . . . . . . . . . . . . . . . . . . 13 80 6.1. Upon transmitting a data segment . . . . . . . . . . . . 13 81 6.2. Upon receiving an ACK . . . . . . . . . . . . . . . . . . 14 82 6.3. Upon RTO expiration . . . . . . . . . . . . . . . . . . . 19 83 7. TLP Algorithm Details . . . . . . . . . . . . . . . . . . . . 20 84 7.1. Initializing state . . . . . . . . . . . . . . . . . . . 20 85 7.2. Scheduling a loss probe . . . . . . . . . . . . . . . . . 20 86 7.3. Sending a loss probe upon PTO expiration . . . . . . . . 21 87 7.4. Detecting losses using the ACK of the loss probe . . . . 22 88 7.4.1. General case: detecting packet losses using RACK . . 22 89 7.4.2. Special case: detecting a single loss repaired by the 90 loss probe . . . . . . . . . . . . . . . . . . . . . 23 91 8. Managing RACK-TLP timers . . . . . . . . . . . . . . . . . . 24 92 9. Discussion . . . . . . . . . . . . . . . . . . . . . . . . . 24 93 9.1. Advantages and disadvantages . . . . . . . . . . . . . . 24 94 9.2. Relationships with other loss recovery algorithms . . . . 26 95 9.3. Interaction with congestion control . . . . . . . . . . . 26 96 9.4. TLP recovery detection with delayed ACKs . . . . . . . . 27 97 9.5. RACK for other transport protocols . . . . . . . . . . . 28 98 10. Security Considerations . . . . . . . . . . . . . . . . . . . 28 99 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 28 100 12. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 28 101 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 29 102 13.1. Normative References . . . . . . . . . . . . . . . . . . 29 103 13.2. Informative References . . . . . . . . . . . . . . . . . 29 104 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 30 106 1. Terminology 108 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 109 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 110 "OPTIONAL" in this document are to be interpreted as described in BCP 111 14 [RFC2119] [RFC8174] when, and only when, they appear in all 112 capitals, as shown here. In this document, these words will appear 113 with that interpretation only when in UPPER CASE. Lower case uses of 114 these words are not to be interpreted as carrying [RFC2119] 115 significance. 117 2. Introduction 119 This document presents RACK-TLP, a TCP loss detection algorithm that 120 improves upon the widely implemented DUPACK counting approach in 121 [RFC5681][RFC6675], and that is RECOMMENDED to be used as an 122 alternative to that earlier approach. RACK-TLP has two parts: RACK 123 ("Recent ACKnowledgment") detects losses quickly using time-based 124 inferences derived from ACK feedback. TLP ("Tail Loss Probe") 125 triggers ACK feedback by quickly sending a probe segment, to avoid 126 retransmission timeout (RTO) events. 128 2.1. Background 130 In traditional TCP loss recovery algorithms [RFC5681][RFC6675], a 131 sender starts fast recovery when the number of DUPACKs received 132 reaches a threshold (DupThresh) that defaults to 3 (this approach is 133 referred to as DUPACK-counting in the rest of the document). The 134 sender also halves the congestion window during the recovery. The 135 rationale behind the partial window reduction is that congestion does 136 not seem severe since ACK clocking is still maintained. The time 137 elapsed in fast recovery can be just one round-trip, e.g. if the 138 sender uses SACK-based recovery [RFC6675] and the number of lost 139 segments is small. 141 If fast recovery is not triggered, or triggers but fails to repair 142 all the losses, then the sender resorts to RTO recovery. The RTO 143 timer interval is conservatively the smoothed RTT (SRTT) plus four 144 times the RTT variation, and is lower bounded to 1 second [RFC6298]. 146 Upon RTO timer expiration, the sender retransmits the first 147 unacknowledged segment and resets the congestion window to the LOSS 148 WINDOW value (by default 1 full-size segment [RFC5681]). The 149 rationale behind the congestion window reset is that an entire flight 150 of data was lost, and the ACK clock was lost, so this deserves a 151 cautious response. The sender then retransmits the rest of the data 152 following the slow start algorithm [RFC5681]. The time elapsed in 153 RTO recovery is one RTO interval plus the number of round-trips 154 needed to repair all the losses. 156 2.2. Motivation 158 Fast Recovery is the preferred form of loss recovery because it can 159 potentially recover all losses in the time scale of a single round 160 trip, with only a fractional congestion window reduction. RTO 161 recovery and congestion window reset should ideally be the last 162 resort, only used when the entire flight is lost. However, in 163 addition to losing an entire flight of data, the following situations 164 can unnecessarily resort to RTO recovery with traditional TCP loss 165 recovery algorithms [RFC5681][RFC6675]: 167 1. Packet drops for short flows or at the end of an application data 168 flight. When the sender is limited by the application (e.g. 169 structured request/response traffic), segments lost at the end of 170 the application data transfer often can only be recovered by RTO. 171 Consider an example of losing only the last segment in a flight 172 of 100 segments. Lacking any DUPACK, the sender RTO expires and 173 reduces the congestion window to 1, and raises the congestion 174 window to just 2 after the loss repair is acknowledged. In 175 contrast, any single segment loss occurring between the first and 176 the 97th segment would result in fast recovery, which would only 177 cut the window in half. 179 2. Lost retransmissions. Heavy congestion or traffic policers can 180 cause retransmissions to be lost. Lost retransmissions cause a 181 resort to RTO recovery, since DUPACK-counting does not detect the 182 loss of the retransmissions. Then the slow start after RTO 183 recovery could cause burst losses again that severely degrades 184 performance [POLICER16]. 186 3. Packet reordering. Link-layer protocols (e.g., 802.11 block 187 ACK), link bonding, or routers' internal load-balancing (e.g., 188 ECMP) can deliver TCP segments out of order. The degree of such 189 reordering is usually within the order of the path round trip 190 time. If the reordering degree is beyond DupThresh, the DUPACK- 191 counting can cause a spurious fast recovery and unnecessary 192 congestion window reduction. To mitigate the issue, [RFC4653] 193 adjusts DupThresh to half of the inflight size to tolerate the 194 higher degree of reordering. However if more than half of the 195 inflight is lost, then the sender has to resort to RTO recovery. 197 3. RACK-TLP high-level design 199 RACK-TLP allows senders to recover losses more effectively in all 200 three scenarios described in the previous section. There are two 201 design principles behind RACK-TLP. The first principle is to detect 202 losses via ACK events as much as possible, to repair losses at round- 203 trip time-scales. The second principle is to gently probe the 204 network to solicit additional ACK feedback, to avoid RTO expiration 205 and subsequent congestion window reset. At a high level, the two 206 principles are implemented in RACK and TLP, respectively. 208 3.1. RACK: time-based loss inferences from ACKs 210 The rationale behind RACK is that if a segment is delivered out of 211 order, then the segments sent chronologically before that were either 212 lost or reordered. This concept is not fundamentally different from 213 [RFC5681][RFC6675][FACK]. RACK's key innovation is using per-segment 214 transmission timestamps and widely-deployed SACK [RFC2018] options to 215 conduct time-based inferences, instead of inferring losses by 216 counting ACKs or SACKed sequences. Time-based inferences are more 217 robust than DUPACK-counting approaches because they have no 218 dependence on flight size, and thus are effective for application- 219 limited traffic. 221 Conceptually, RACK puts a virtual timer for every data segment sent 222 (including retransmissions). Each timer expires dynamically based on 223 the latest RTT measurements plus an additional delay budget to 224 accommodate potential packet reordering (called the reordering 225 window). When a segment's timer expires, RACK marks the 226 corresponding segment lost for retransmission. 228 In reality, as an algorithm, RACK does not arm a timer for every 229 segment sent because it's not necessary. Instead the sender records 230 the most recent transmission time of every data segment sent, 231 including retransmissions. For each ACK received, the sender 232 calculates the latest RTT measurement (if eligible) and adjusts the 233 expiration time of every segment sent but not yet delivered. If a 234 segment has expired, RACK marks it lost. 236 Since the time-based logic of RACK applies equally to retransmissions 237 and original transmissions, it can detect lost retransmissions as 238 well. If a segment has been retransmitted but its most recent 239 (re)transmission timestamp has expired, then after a reordering 240 window it's marked lost. 242 3.2. TLP: sending one segment to probe losses quickly with RACK 244 RACK infers losses from ACK feedback; however, in some cases ACKs are 245 sparse, particularly when the inflight is small or when the losses 246 are high. In some challenging cases the last few segments in a 247 flight are lost. With [RFC5681] or [RFC6675] the sender's RTO would 248 expire and reset the congestion window, when in reality most of the 249 flight has been delivered. 251 Consider an example where a sender with a large congestion window 252 transmits 100 new data segments after an application write, and only 253 the last three segments are lost. Without RACK-TLP, the RTO expires, 254 the sender retransmits the first unacknowledged segment, and the 255 congestion window slow-starts from 1. After all the retransmits are 256 acknowledged the congestion window has been increased to 4. The 257 total delivery time for this application transfer is three RTTs plus 258 one RTO, a steep cost given that only a tiny fraction of the flight 259 was lost. If instead the losses had occurred three segments sooner 260 in the flight, then fast recovery would have recovered all losses 261 within one round-trip and would have avoided resetting the congestion 262 window. 264 Fast Recovery would be preferable in such scenarios; TLP is designed 265 to trigger the feedback RACK needed to enable that. After the last 266 (100th) segment was originally sent, TLP sends the next available 267 (new) segment or retransmits the last (highest-sequenced) segment in 268 two round-trips to probe the network, hence the name "Tail Loss 269 Probe". The successful delivery of the probe would solicit an ACK. 270 RACK uses this ACK to detect that the 98th and 99th segments were 271 lost, trigger fast recovery, and retransmit both successfully. The 272 total recovery time is four RTTs, and the congestion window is only 273 partially reduced instead of being fully reset. If the probe was 274 also lost then the sender would invoke RTO recovery resetting the 275 congestion window. 277 3.3. RACK-TLP: reordering resilience with a time threshold 279 3.3.1. Reordering design rationale 281 Upon receiving an ACK indicating an out-of-order data delivery, a 282 sender cannot tell immediately whether that out-of-order delivery was 283 a result of reordering or loss. It can only distinguish between the 284 two in hindsight if the missing sequence ranges are filled in later 285 without retransmission. Thus a loss detection algorithm needs to 286 budget some wait time -- a reordering window -- to try to 287 disambiguate packet reordering from packet loss. 289 The reordering window in the DUPACK-counting approach is implicitly 290 defined as the elapsed time to receive acknowledgements for 291 DupThresh-worth of out-of-order deliveries. This approach is 292 effective if the network reordering degree (in sequence distance) is 293 smaller than DupThresh and at least DupThresh segments after the loss 294 are acknowledged. For cases where the reordering degree is larger 295 than the default DupThresh of 3 packets, one alternative is to 296 dynamically adapt DupThresh based on the FlightSize (e.g., the sender 297 adjusts the DUPTRESH to half of the FlightSize). However, this does 298 not work well with the following two types of reordering: 300 1. Application-limited flights where the last non-full-sized segment 301 is delivered first and then the remaining full-sized segments in 302 the flight are delivered in order. This reordering pattern can 303 occur when segments traverse parallel forwarding paths. In such 304 scenarios the degree of reordering in packet distance is one 305 segment less than the flight size. 307 2. A flight of segments that are delivered partially out of order. 308 One cause for this pattern is wireless link-layer retransmissions 309 with an inadequate reordering buffer at the receiver. In such 310 scenarios, the wireless sender sends the data packets in order 311 initially, but some are lost and then recovered by link-layer 312 retransmissions; the wireless receiver delivers the TCP data 313 packets in the order they are received, due to the inadequate 314 reordering buffer. The random wireless transmission errors in 315 such scenarios cause the reordering degree, expressed in packet 316 distance, to have highly variable values up to the flight size. 318 In the above two cases the degree of reordering in packet distance is 319 highly variable, making DUPACK-counting approach ineffective 320 including dynamic adaptation variants like [RFC4653]. Instead the 321 degree of reordering in time difference in such cases is usually 322 within a single round-trip time. This is because the packets either 323 traverse slightly disjoint paths with similar propagation delays or 324 are repaired quickly by the local access technology. Hence, using a 325 time threshold instead of packet threshold strikes a middle ground, 326 allowing a bounded degree of reordering resilience while still 327 allowing fast recovery. This is the rationale behind the RACK-TLP 328 reordering resilience design. 330 Specifically, RACK-TLP introduces a new dynamic reordering window 331 parameter in time units, and the sender considers a data segment S 332 lost if both conditions are met: 334 1. Another data segment sent later than S has been delivered 335 2. S has not been delivered after the estimated round-trip time plus 336 the reordering window 338 Note that condition (1) implies at least one round-trip of time has 339 elapsed since S has been sent. 341 3.3.2. Reordering window adaptation 343 The RACK reordering window adapts to the measured duration of 344 reordering events, within reasonable and specific bounds to 345 disincentivize excessive reordering. More specifically, the sender 346 sets the reordering window as follows: 348 1. The reordering window SHOULD be set to zero if no reordering has 349 been observed on the connection so far, and either (a) three 350 segments have been delivered out of order since the last recovery 351 or (b) the sender is already in fast or RTO recovery. Otherwise, 352 the reordering window SHOULD start from a small fraction of the 353 round trip time, or zero if no round trip time estimate is 354 available. 356 2. The RACK reordering window SHOULD adaptively increase (using the 357 algorithm in "Step 4: Update RACK reordering window", below) if 358 the sender receives a Duplicate Selective Acknowledgement (DSACK) 359 option [RFC2883]. Receiving a DSACK suggests the sender made a 360 spurious retransmission, which may have been due to the 361 reordering window being too small. 363 3. The RACK reordering window MUST be bounded and this bound SHOULD 364 be SRTT. 366 Rules 2 and 3 are required to adapt to reordering caused by dynamics 367 such as the prolonged link-layer loss recovery episodes described 368 earlier. Each increase in the reordering window requires a new round 369 trip where the sender receives a DSACK; thus, depending on the extent 370 of reordering, it may take multiple round trips to fully adapt. 372 For short flows, the low initial reordering window helps recover 373 losses quickly, at the risk of spurious retransmissions. The 374 rationale is that spurious retransmissions for short flows are not 375 expected to produce excessive additional network traffic. For long 376 flows the design tolerates reordering within a round trip. This 377 handles reordering in small time scales (reordering within the round- 378 trip time of the shortest path). 380 However, the fact that the initial reordering window is low, and the 381 reordering window's adaptive growth is bounded, means that there will 382 continue to be a cost to reordering that disincentivizes excessive 383 reordering. 385 3.4. An Example of RACK-TLP in Action: fast recovery 387 The following example in figure 1 illustrates the RACK-TLP algorithm 388 in action: 390 Event TCP DATA SENDER TCP DATA RECEIVER 391 _____ ____________________________________________________________ 392 1. Send P0, P1, P2, P3 --> 393 [P1, P2, P3 dropped by network] 395 2. <-- Receive P0, ACK P0 397 3a. 2RTTs after (2), TLP timer fires 398 3b. TLP: retransmits P3 --> 400 4. <-- Receive P3, SACK P3 402 5a. Receive SACK for P3 403 5b. RACK: marks P1, P2 lost 404 5c. Retransmit P1, P2 --> 405 [P1 retransmission dropped by network] 407 6. <-- Receive P2, SACK P2 & P3 409 7a. RACK: marks P1 retransmission lost 410 7b. Retransmit P1 --> 412 8. <-- Receive P1, ACK P3 414 Figure 1. RACK-TLP protocol example 416 Figure 1, above, illustrates a sender sending four segments (P1, P2, 417 P3, P4) and losing the last three segments. After two round-trips, 418 TLP sends a loss probe, retransmitting the last segment, P3, to 419 solicit SACK feedback and restore the ACK clock (event 3). The 420 delivery of P3 enables RACK to infer (event 5b) that P1 and P2 were 421 likely lost, because they were sent before P3. The sender then 422 retransmits P1 and P2. Unfortunately, the retransmission of P1 is 423 lost again. However, the delivery of the retransmission of P2 allows 424 RACK to infer that the retransmission of P1 was likely lost (event 425 7a), and hence P1 should be retransmitted (event 7b). 427 3.5. An Example of RACK-TLP in Action: RTO 429 In addition to enhancing fast recovery, RACK improves the accuracy of 430 RTO recovery by reducing spurious retransmissions. 432 Without RACK, upon RTO timer expiration the sender marks all the 433 unacknowledged segments lost. This approach can lead to spurious 434 retransmissions. For example, consider a simple case where one 435 segment was sent with an RTO of 1 second, and then the application 436 writes more data, causing a second and third segment to be sent right 437 before the RTO of the first segment expires. Suppose only the first 438 segment is lost. Without RACK, upon RTO expiration the sender marks 439 all three segments as lost and retransmits the first segment. When 440 the sender receives the ACK that selectively acknowledges the second 441 segment, the sender spuriously retransmits the third segment. 443 With RACK, upon RTO timer expiration the only segment automatically 444 marked lost is the first segment (since it was sent an RTO ago); for 445 all the other segments RACK only marks the segment lost if at least 446 one round trip has elapsed since the segment was transmitted. 447 Consider the previous example scenario, this time with RACK. With 448 RACK, when the RTO expires the sender only marks the first segment as 449 lost, and retransmits that segment. The other two very recently sent 450 segments are not marked lost, because they were sent less than one 451 round trip ago and there were no ACKs providing evidence that they 452 were lost. When the sender receives the ACK that selectively 453 acknowledges the second segment, the sender would not retransmit the 454 third segment but rather would send any new segments (if allowed by 455 congestion window and receive window). 457 In the above example, if the sender were to send a large burst of 458 segments instead of two segments right before RTO, without RACK the 459 sender may spuriously retransmit almost the entire flight [RACK- 460 TCPM97]. Note that the Eifel protocol [RFC3522] cannot prevent this 461 issue because it can only detect spurious RTO episodes. In this 462 example the RTO itself was not spurious. 464 3.6. Design Summary 466 To summarize, RACK-TLP aims to adapt to small time-varying degrees of 467 reordering, quickly recover most losses within one to two round 468 trips, and avoid costly RTO recoveries. In the presence of 469 reordering, the adaptation algorithm can impose sometimes-needless 470 delays when it waits to disambiguate loss from reordering, but the 471 penalty for waiting is bounded to one round trip and such delays are 472 confined to flows long enough to have observed reordering. 474 4. Requirements 476 The reader is expected to be familiar with the definitions given in 477 the TCP congestion control [RFC5681] and selective acknowledgment 478 [RFC2018][RFC6675] RFCs. RACK-TLP has the following requirements: 480 1. The connection MUST use selective acknowledgment (SACK) options 481 [RFC2018], and the sender MUST keep SACK scoreboard information 482 on a per-connection basis ("SACK scoreboard" has the same meaning 483 here as in [RFC6675] section 3). 485 2. For each data segment sent, the sender MUST store its most recent 486 transmission time with a timestamp whose granularity that is 487 finer than 1/4 of the minimum RTT of the connection. At the time 488 of writing, microsecond resolution is suitable for intra- 489 datacenter traffic and millisecond granularity or finer is 490 suitable for the Internet. Note that RACK-TLP can be implemented 491 with TSO (TCP Segmentation Offload) support by having multiple 492 segments in a TSO aggregate share the same timestamp. 494 3. RACK DSACK-based reordering window adaptation is RECOMMENDED but 495 is not required. 497 4. TLP requires RACK. 499 5. Definitions 501 The reader is expected to be familiar with the variables of SND.UNA, 502 SND.NXT, SEG.ACK, and SEG.SEQ in [RFC793], SMSS, FlightSize in 503 [RFC5681], DupThresh in [RFC6675], RTO and SRTT in [RFC6298]. A 504 RACK-TLP implementation needs to store new per-segment and per- 505 connection state, described below. 507 5.1. Per-segment variables 509 Theses variables indicate the status of the most recent transmission 510 of a data segment: 512 "Segment.lost" is true if the most recent (re)transmission of the 513 segment has been marked lost and needs to be retransmitted. False 514 otherwise. 516 "Segment.retransmitted" is true if the segment has ever been 517 retransmitted. False otherwise. 519 "Segment.xmit_ts" is the time of the last transmission of a data 520 segment, including retransmissions, if any, with a clock granularity 521 specified in the Requirements section. A maximum value INFINITE_TS 522 indicates an invalid timestamp that represents that the Segment is 523 not currently in flight. 525 "Segment.end_seq" is the next sequence number after the last sequence 526 number of the data segment. 528 5.2. Per-connection variables 530 "RACK.segment". Among all the segments that have been either 531 selectively or cumulatively acknowledged, RACK.segment is the one 532 that was sent most recently (including retransmissions). 534 "RACK.xmit_ts" is the latest transmission timestamp of RACK.segment. 536 "RACK.end_seq" is the Segment.end_seq of RACK.segment. 538 "RACK.ack_ts" is the time when the full sequence range of 539 RACK.segment was selectively or cumulatively acknowledged. 541 "RACK.segs_sacked" returns the total number of segments selectively 542 acknowledged in the SACK scoreboard. 544 "RACK.fack" is the highest selectively or cumulatively acknowledged 545 sequence (i.e. forward acknowledgement). 547 "RACK.min_RTT" is the estimated minimum round-trip time (RTT) of the 548 connection. 550 "RACK.rtt" is the RTT of the most recently delivered segment on the 551 connection (either cumulatively acknowledged or selectively 552 acknowledged) that was not marked invalid as a possible spurious 553 retransmission. 555 "RACK.reordering_seen" indicates whether the sender has detected data 556 segment reordering event(s). 558 "RACK.reo_wnd" is a reordering window computed in the unit of time 559 used for recording segment transmission times. It is used to defer 560 the moment at which RACK marks a segment lost. 562 "RACK.dsack" indicates if a DSACK option has been received since the 563 last RACK.reo_wnd change. 565 "RACK.reo_wnd_mult" is the multiplier applied to adjust RACK.reo_wnd. 567 "RACK.reo_wnd_persist" is the number of loss recoveries before 568 resetting RACK.reo_wnd. 570 "RACK.rtt_seq" is the SND.NXT when RACK.rtt is updated. 572 "TLP.is_retrans": a boolean indicating whether there is an 573 unacknowledged TLP retransmission. 575 "TLP.end_seq": the value of SND.NXT at the time of sending a TLP 576 retransmission. 578 "TLP.max_ack_delay": sender's maximum delayed ACK timer budget. 580 Per-connection timers 582 "RACK reordering timer": a timer that allows RACK to wait for 583 reordering to resolve, to try to disambiguate reordering from loss, 584 when some out-of-order segments are marked as SACKed. 586 "TLP PTO": a timer event indicating that an ACK is overdue and the 587 sender should transmit a TLP segment, to solicit SACK or ACK 588 feedback. 590 These timers augment the existing timers maintained by a sender, 591 including the RTO timer [RFC6298]. A RACK-TLP sender arms one of 592 these three timers -- RACK reordering timer, TLP PTO timer, or RTO 593 timer -- when it has unacknowledged segments in flight. The 594 implementation can simplify managing all three timers by multiplexing 595 a single timer among them with an additional variable to indicate the 596 event to invoke upon the next timer expiration. 598 6. RACK Algorithm Details 600 6.1. Upon transmitting a data segment 602 Upon transmitting a new segment or retransmitting an old segment, 603 record the time in Segment.xmit_ts and set Segment.lost to FALSE. 604 Upon retransmitting a segment, set Segment.retransmitted to TRUE. 606 RACK_transmit_new_data(Segment): 607 Segment.xmit_ts = Now() 608 Segment.lost = FALSE 610 RACK_retransmit_data(Segment): 611 Segment.retransmitted = TRUE 612 Segment.xmit_ts = Now() 613 Segment.lost = FALSE 615 6.2. Upon receiving an ACK 617 Step 1: Update RACK.min_RTT. 619 Use the RTT measurements obtained via [RFC6298] or [RFC7323] to 620 update the estimated minimum RTT in RACK.min_RTT. The sender SHOULD 621 track a windowed min-filtered estimate of recent RTT measurements 622 that can adapt when migrating to significantly longer paths, rather 623 than a simple global minimum of all RTT measurements. 625 Step 2: Update state for most recently sent segment that has been 626 delivered 628 In this step, RACK updates the states that track the most recently 629 sent segment that has been delivered: RACK.segment; RACK maintains 630 its latest transmission timestamp in RACK.xmit_ts and its highest 631 sequence number in RACK.end_seq. These two variables are used, in 632 later steps, to estimate if some segments not yet delivered were 633 likely lost. Given the information provided in an ACK, each segment 634 cumulatively ACKed or SACKed is marked as delivered in the 635 scoreboard. Since an ACK can also acknowledge retransmitted data 636 segments, and retransmissions can be spurious, the sender needs to 637 take care to avoid spurious inferences. For example, if the sender 638 were to use timing information from a spurious retransmission, the 639 RACK.rtt could be vastly underestimated. 641 To avoid spurious inferences, ignore a segment as invalid if any of 642 its sequence range has been retransmitted before and either of two 643 conditions is true: 645 1. The Timestamp Echo Reply field (TSecr) of the ACK's timestamp 646 option [RFC7323], if available, indicates the ACK was not 647 acknowledging the last retransmission of the segment. 649 2. The segment was last retransmitted less than RACK.min_rtt ago. 651 The second check is a heuristic when the TCP Timestamp option is not 652 available, or when the round trip time is less than the TCP Timestamp 653 clock granularity. 655 Among all the segments newly ACKed or SACKed by this ACK that pass 656 the checks above, update the RACK.rtt to be the RTT sample calculated 657 using this ACK. Furthermore, record the most recent Segment.xmit_ts 658 in RACK.xmit_ts if it is ahead of RACK.xmit_ts. If Segment.xmit_ts 659 equals RACK.xmit_ts (e.g. due to clock granularity limits) then 660 compare Segment.end_seq and RACK.end_seq to break the tie. 662 Step 2 may be summarized in pseudocode as: 664 RACK_sent_after(t1, seq1, t2, seq2): 665 If t1 > t2: 666 Return true 667 Else if t1 == t2 AND seq1 > seq2: 668 Return true 669 Else: 670 Return false 672 RACK_update(): 673 For each Segment newly acknowledged cumulatively or selectively: 674 rtt = Now() - Segment.xmit_ts 675 If Segment.retransmitted is TRUE: 676 If ACK.ts_option.echo_reply < Segment.xmit_ts: 677 Return 678 If rtt < RACK.min_rtt: 679 Return 681 RACK.rtt = rtt 682 If RACK_sent_after(Segment.xmit_ts, Segment.end_seq 683 RACK.xmit_ts, RACK.end_seq): 684 RACK.xmit_ts = Segment.xmit_ts 686 Step 3: Detect data segment reordering 688 To detect reordering, the sender looks for original data segments 689 being delivered out of order. To detect such cases, the sender 690 tracks the highest sequence selectively or cumulatively acknowledged 691 in the RACK.fack variable. The name "fack" stands for the most 692 "Forward ACK" (this term is adopted from [FACK]). If a never- 693 retransmitted segment that's below RACK.fack is (selectively or 694 cumulatively) acknowledged, it has been delivered out of order. The 695 sender sets RACK.reordering_seen to TRUE if such segment is 696 identified. 698 RACK_detect_reordering(): 699 For each Segment newly acknowledged cumulatively or selectively: 700 If Segment.end_seq > RACK.fack: 701 RACK.fack = Segment.end_seq 702 Else if Segment.end_seq < RACK.fack AND 703 Segment.retransmitted is FALSE: 704 RACK.reordering_seen = TRUE 706 Step 4: Update RACK reordering window 708 The RACK reordering window, RACK.reo_wnd, serves as an adaptive 709 allowance for settling time before marking a segment lost. This step 710 documents a detailed algorithm that follows the principles outlined 711 in the ``Reordering window adaptation'' section. 713 If no reordering has been observed, based on the previous step, then 714 one way the sender can enter Fast Recovery is when the number of 715 SACKed segments matches or exceeds DupThresh (similar to RFC6675). 716 Furthermore, when no reordering has been observed the RACK.reo_wnd is 717 set to 0 both upon entering and during Fast Recovery or RTO recovery. 719 Otherwise, if some reordering has been observed, then RACK does not 720 trigger Fast Recovery based on DupThresh. 722 Whether or not reordering has been observed, RACK uses the reordering 723 window to assess whether any segments can be marked lost. As a 724 consequence, the sender also enters Fast Recovery when there are any 725 number of SACKed segments as long as the reorder window has passed 726 for some non-SACKed segments. 728 When the reordering window is not set to 0, it starts with a 729 conservative RACK.reo_wnd of RACK.min_RTT/4. This value was chosen 730 because Linux TCP used the same factor in its implementation to delay 731 Early Retransmit [RFC5827] to reduce spurious loss detections in the 732 presence of reordering, and experience showed this worked reasonably 733 well [DMCG11]. 735 However, the reordering detection in the previous step, Step 3, has a 736 self-reinforcing drawback when the reordering window is too small to 737 cope with the actual reordering. When that happens, RACK could 738 spuriously mark reordered segments lost, causing them to be 739 retransmitted. In turn, the retransmissions can prevent the 740 necessary conditions for Step 3 to detect reordering, since this 741 mechanism requires ACKs or SACKs for only segments that have never 742 been retransmitted. In some cases such scenarios can persist, 743 causing RACK to continue to spuriously mark segments lost without 744 realizing the reordering window is too small. 746 To avoid the issue above, RACK dynamically adapts to higher degrees 747 of reordering using DSACK options from the receiver. Receiving an 748 ACK with a DSACK option indicates a possible spurious retransmission, 749 suggesting that RACK.reo_wnd may be too small. The RACK.reo_wnd 750 increases linearly for every round trip in which the sender receives 751 some DSACK option, so that after N distinct round trips in which a 752 DSACK is received, the RACK.reo_wnd becomes (N+1) * min_RTT / 4, with 753 an upper-bound of SRTT. 755 If the reordering is temporary then a large adapted reordering window 756 would unnecessarily delay loss recovery later. Therefore, RACK 757 persists using the inflated RACK.reo_wnd for up to 16 loss 758 recoveries, after which it resets RACK.reo_wnd to its starting value, 759 min_RTT / 4. The downside of resetting the reordering window is the 760 risk of triggering spurious fast recovery episodes if the reordering 761 remains high. The rationale for this approach is to bound such 762 spurious recoveries to approximately once every 16 recoveries (less 763 than 7%). 765 To track the linear scaling factor for the adaptive reordering 766 window, RACK uses the variable RACK.reo_wnd_mult, which is 767 initialized to 1 and adapts with observed reordering. 769 The following pseudocode implements the above algorithm for updating 770 the RACK reordering window: 772 RACK_update_reo_wnd(): 774 /* DSACK-based reordering window adaptation */ 775 If RACK.dsack_round is not None AND 776 SND.UNA >= RACK.dsack_round: 777 RACK.dsack_round = None 778 /* Grow the reordering window per round that sees DSACK. 779 Reset the window after 16 DSACK-free recoveries */ 780 If RACK.dsack_round is None AND 781 any DSACK option is present on latest received ACK: 782 RACK.dsack_round = SND.NXT 783 RACK.reo_wnd_mult += 1 784 RACK.reo_wnd_persist = 16 785 Else if exiting Fast or RTO recovery: 786 RACK.reo_wnd_persist -= 1 787 If RACK.reo_wnd_persist <= 0: 788 RACK.reo_wnd_mult = 1 790 If RACK.reordering_seen is FALSE: 791 If in Fast or RTO recovery: 792 Return 0 793 Else if RACK.segs_sacked >= DupThresh: 794 Return 0 795 Return min(RACK.min_RTT / 4 * RACK.reo_wnd_mult, SRTT) 797 Step 5: Detect losses. 799 For each segment that has not been SACKed, RACK considers that 800 segment lost if another segment that was sent later has been 801 delivered, and the reordering window has passed. RACK considers the 802 reordering window to have passed if the RACK.segment was sent 803 sufficiently after the segment in question, or a sufficient time has 804 elapsed since the RACK.segment was S/ACKed, or some combination of 805 the two. More precisely, RACK marks a segment lost if: 807 RACK.xmit_ts >= Segment.xmit_ts 808 AND 809 (RACK.xmit_ts - Segment.xmit_ts) + (now - RACK.ack_ts) >= RACK.reo_wnd 811 Solving this second condition for "now", the moment at which a 812 segment is marked lost, yields: 814 now >= Segment.xmit_ts + RACK.reo_wnd + (RACK.ack_ts - RACK.xmit_ts) 816 Then (RACK.ack_ts - RACK.xmit_ts) is the round trip time of the most 817 recently (re)transmitted segment that's been delivered. When 818 segments are delivered in order, the most recently (re)transmitted 819 segment that's been delivered is also the most recently delivered, 820 hence RACK.rtt == RACK.ack_ts - RACK.xmit_ts. But if segments were 821 reordered, then the segment delivered most recently was sent before 822 the most recently (re)transmitted segment. Hence RACK.rtt > 823 (RACK.ack_ts - RACK.xmit_ts). 825 Since RACK.RTT >= (RACK.ack_ts - RACK.xmit_ts), the previous equation 826 reduces to saying that the sender can declare a segment lost when: 828 now >= Segment.xmit_ts + RACK.reo_wnd + RACK.rtt 830 In turn, that is equivalent to stating that a RACK sender should 831 declare a segment lost when: 833 Segment.xmit_ts + RACK.rtt + RACK.reo_wnd - now <= 0 835 Note that if the value on the left hand side is positive, it 836 represents the remaining wait time before the segment is deemed lost. 837 But this risks a timeout (RTO) if no more ACKs come back (e.g., due 838 to losses or application-limited transmissions) to trigger the 839 marking. For timely loss detection, the sender is RECOMMENDED to 840 install a reordering timer. This timer expires at the earliest 841 moment when RACK would conclude that all the unacknowledged segments 842 within the reordering window were lost. 844 The following pseudocode implements the algorithm above. When an ACK 845 is received or the RACK reordering timer expires, call 846 RACK_detect_loss_and_arm_timer(). The algorithm breaks timestamp 847 ties by using the TCP sequence space, since high-speed networks often 848 have multiple segments with identical timestamps. 850 RACK_detect_loss(): 851 timeout = 0 852 RACK.reo_wnd = RACK_update_reo_wnd() 853 For each segment, Segment, not acknowledged yet: 854 If RACK_sent_after(RACK.xmit_ts, RACK.end_seq, 855 Segment.xmit_ts, Segment.end_seq): 856 remaining = Segment.xmit_ts + RACK.rtt + 857 RACK.reo_wnd - Now() 858 If remaining <= 0: 859 Segment.lost = TRUE 860 Segment.xmit_ts = INFINITE_TS 861 Else: 862 timeout = max(remaining, timeout) 863 Return timeout 865 RACK_detect_loss_and_arm_timer(): 866 timeout = RACK_detect_loss() 867 If timeout != 0 868 Arm the RACK timer to call 869 RACK_detect_loss_and_arm_timer() after timeout 871 As an optimization, an implementation can choose to check only 872 segments that have been sent before RACK.xmit_ts. This can be more 873 efficient than scanning the entire SACK scoreboard, especially when 874 there are many segments in flight. The implementation can use a 875 separate doubly-linked list ordered by Segment.xmit_ts and inserts a 876 segment at the tail of the list when it is (re)transmitted, and 877 removes a segment from the list when it is delivered or marked lost. 878 In Linux TCP this optimization improved CPU usage by orders of 879 magnitude during some fast recovery episodes on high-speed WAN 880 networks. 882 6.3. Upon RTO expiration 884 Upon RTO timer expiration, RACK marks the first outstanding segment 885 as lost (since it was sent an RTO ago); for all the other segments 886 RACK only marks the segment lost if the time elapsed since the 887 segment was transmitted is at least the sum of the recent RTT and the 888 reordering window. 890 RACK_mark_losses_on_RTO(): 891 For each segment, Segment, not acknowledged yet: 892 If SEG.SEQ == SND.UNA OR 893 Segment.xmit_ts + RACK.rtt + RACK.reo_wnd - Now() <= 0: 894 Segment.lost = TRUE 896 7. TLP Algorithm Details 898 7.1. Initializing state 900 Reset TLP.is_retrans and TLP.end_seq when initiating a connection, 901 fast recovery, or RTO recovery. 903 TLP_init(): 904 TLP.end_seq = None 905 TLP.is_retrans = false 907 7.2. Scheduling a loss probe 909 The sender schedules a loss probe timeout (PTO) to transmit a segment 910 during the normal transmission process. The sender SHOULD start or 911 restart a loss probe PTO timer after transmitting new data (that was 912 not itself a loss probe) or upon receiving an ACK that cumulatively 913 acknowledges new data, unless it is already in fast recovery, RTO 914 recovery, or the sender has segments delivered out-of-order (i.e. 915 RACK.segs_sacked is not zero). These conditions are excluded because 916 they are addressed by similar mechanisms, like Limited Transmit 917 [RFC3042], the RACK reordering timer, and F-RTO [RFC5682]. 919 The sender calculates the PTO interval by taking into account a 920 number of factors. 922 First, the default PTO interval is 2*SRTT. By that time, it is 923 prudent to declare that an ACK is overdue, since under normal 924 circumstances, i.e. no losses, an ACK typically arrives in one SRTT. 925 Choosing PTO to be exactly an SRTT would risk causing spurious 926 probes, given that network and end-host delay variance can cause an 927 ACK to be delayed beyond SRTT. Hence the PTO is conservatively 928 chosen to be the next integral multiple of SRTT. 930 Second, when there is no SRTT estimate available, the PTO SHOULD be 1 931 second. This conservative value corresponds to the RTO value when no 932 SRTT is available, per [RFC6298]. 934 Third, when FlightSize is one segment, the sender MAY inflate PTO by 935 TLP.max_ack_delay to accommodate a potential delayed acknowledgment 936 and reduce the risk of spurious retransmissions. The actual value of 937 TLP.max_ack_delay is implementation-specific. 939 Finally, if the time at which an RTO would fire (here denoted 940 "TCP_RTO_expiration()") is sooner than the computed time for the PTO, 941 then the sender schedules a TLP to be sent at that RTO time. 943 Summarizing these considerations in pseudocode form, a sender SHOULD 944 use the following logic to select the duration of a PTO: 946 TLP_calc_PTO(): 947 If SRTT is available: 948 PTO = 2 * SRTT 949 If FlightSize is one segment: 950 PTO += TLP.max_ack_delay 951 Else: 952 PTO = 1 sec 954 If Now() + PTO > TCP_RTO_expiration(): 955 PTO = TCP_RTO_expiration() - Now() 957 7.3. Sending a loss probe upon PTO expiration 959 When the PTO timer expires, the sender SHOULD transmit a previously 960 unsent data segment, if the receive window allows, and increment the 961 FlightSize accordingly. Note that FlightSize could be one packet 962 greater than the congestion window temporarily until the next ACK 963 arrives. 965 If such a segment is not available, then the sender SHOULD retransmit 966 the highest-sequence segment sent so far and set TLP.is_retrans to 967 true. This segment is chosen to deal with the retransmission 968 ambiguity problem in TCP. Suppose a sender sends N segments, and 969 then retransmits the last segment (segment N) as a loss probe, and 970 then the sender receives a SACK for segment N. As long as the sender 971 waits for the RACK reordering window to expire, it doesn't matter if 972 that SACK was for the original transmission of segment N or the TLP 973 retransmission; in either case the arrival of the SACK for segment N 974 provides evidence that the N-1 segments preceding segment N were 975 likely lost. 977 In the case where there is only one original outstanding segment of 978 data (N=1), the same logic (trivially) applies: an ACK for a single 979 outstanding segment tells the sender the N-1=0 segments preceding 980 that segment were lost. Furthermore, whether there are N>1 or N=1 981 outstanding segments, there is a question about whether the original 982 last segment or its TLP retransmission were lost; the sender 983 estimates whether there was such a loss using TLP recovery detection 984 (see below). 986 The sender MUST follow the RACK transmission procedures in the ''Upon 987 Transmitting a Data Segment'' section (see above) upon sending either 988 a retransmission or new data loss probe. This is critical for 989 detecting losses using the ACK for the loss probe. Furthermore, 990 prior to sending a loss probe, the sender MUST check that there is no 991 other previous loss probe still in flight. This ensures that at any 992 given time the sender has at most one additional packet in flight 993 beyond the congestion window limit. This invariant is maintained 994 using the state variable TLP.end_seq, which indicates the latest 995 unacknowledged TLP loss probe's ending sequence. It is reset when 996 the loss probe has been acknowledged or is deemed lost or irrelevant. 997 After attempting to send a loss probe, regardless of whether a loss 998 probe was sent, the sender MUST re-arm the RTO timer, not the PTO 999 timer, if FlightSize is not zero. This ensures RTO recovery remains 1000 the last resort if TLP fails. The following pseudo code summarizes 1001 the operations. 1003 TLP_send_probe(): 1005 If TLP.end_seq is None: 1006 TLP.is_retrans = false 1007 Segment = send buffer segment starting at SND.NXT 1008 If Segment exists and fits the peer receive window limit: 1009 /* Transmit the lowest-sequence unsent Segment */ 1010 Transmit Segment 1011 RACK_transmit_data(Segment) 1012 TLP.end_seq = SND.NXT 1013 Increase FlightSize by Segment length 1014 Else: 1015 /* Retransmit the highest-sequence Segment sent */ 1016 Segment = send buffer segment ending at SND.NXT 1017 Transmit Segment 1018 RACK_retransmit_data(Segment) 1019 TLP.end_seq = SND.NXT 1021 7.4. Detecting losses using the ACK of the loss probe 1023 When there is packet loss in a flight ending with a loss probe, the 1024 feedback solicited by a loss probe will reveal one of two scenarios, 1025 depending on the pattern of losses. 1027 7.4.1. General case: detecting packet losses using RACK 1029 If the loss probe and the ACK that acknowledges the probe are 1030 delivered successfully, RACK-TLP uses this ACK -- just as it would 1031 with any other ACK -- to detect if any segments sent prior to the 1032 probe were dropped. RACK would typically infer that any 1033 unacknowledged data segments sent before the loss probe were lost, 1034 since they were sent sufficiently far in the past (at least one PTO 1035 has elapsed, plus one round-trip for the loss probe to be ACKed). 1036 More specifically, RACK_detect_loss() (step 5) would mark those 1037 earlier segments as lost. Then the sender would trigger a fast 1038 recovery to recover those losses. 1040 7.4.2. Special case: detecting a single loss repaired by the loss probe 1042 If the TLP retransmission repairs all the lost in-flight sequence 1043 ranges (i.e. only the last segment in the flight was lost), the ACK 1044 for the loss probe appears to be a regular cumulative ACK, which 1045 would not normally trigger the congestion control response to this 1046 packet loss event. The following TLP recovery detection mechanism 1047 examines ACKs to detect this special case to make congestion control 1048 respond properly [RFC5681]. 1050 After a TLP retransmission, the sender checks for this special case 1051 of a single loss that is recovered by the loss probe itself. To 1052 accomplish this, the sender checks for a duplicate ACK or DSACK 1053 indicating that both the original segment and TLP retransmission 1054 arrived at the receiver, meaning there was no loss. If the TLP 1055 sender does not receive such an indication, then it MUST assume that 1056 either the original data segment, the TLP retransmission, or a 1057 corresponding ACK were lost, for congestion control purposes. 1059 If the TLP retransmission is spurious, a receiver that uses DSACK 1060 would return an ACK that covers TLP.end_seq with a DSACK option (Case 1061 1). If the receiver does not support DSACK, it would return a DUPACK 1062 without any SACK option (Case 2). If the sender receives an ACK 1063 matching either case, then the sender estimates that the receiver 1064 received both the original data segment and the TLP probe 1065 retransmission, and so the sender considers the TLP episode to be 1066 done, and records that fact by setting TLP.end_seq to None. 1068 Upon receiving an ACK that covers some sequence number after 1069 TLP.end_seq, the sender should have received any ACKs for the 1070 original segment and TLP probe retransmission segment. At that time, 1071 if the TLP.end_seq is still set, and thus indicates that the TLP 1072 probe retransmission remains unacknowledged, then the sender should 1073 presume that at least one of its data segments was lost. The sender 1074 then SHOULD invoke a congestion control response equivalent to a fast 1075 recovery. 1077 More precisely, on each ACK the sender executes the following: 1079 TLP_process_ack(ACK): 1080 If TLP.end_seq is not None AND ACK's ack. number >= TLP.end_seq: 1081 If not TLP.is_retrans: 1082 TLP.end_seq = None /* TLP of new data delivered */ 1083 Else if ACK has a DSACK option matching TLP.end_seq: 1084 TLP.end_seq = None /* Case 1, above */ 1085 Else If ACK's ack. number > TLP.end_seq: 1086 TLP.end_seq = None /* Repaired the single loss */ 1087 (Invoke congestion control to react to 1088 the loss event the probe has repaired) 1089 Else If ACK is a DUPACK without any SACK option: 1090 TLP.end_seq = None /* Case 2, above */ 1092 8. Managing RACK-TLP timers 1094 The RACK reordering, the TLP PTO timer, the RTO and Zero Window Probe 1095 (ZWP) timer [RFC793] are mutually exclusive and used in different 1096 scenarios. When arming a RACK reordering timer or TLP PTO timer, the 1097 sender SHOULD cancel any other pending timer(s). An implementation 1098 is to have one timer with an additional state variable indicating the 1099 type of the timer. 1101 9. Discussion 1103 9.1. Advantages and disadvantages 1105 The biggest advantage of RACK-TLP is that every data segment, whether 1106 it is an original data transmission or a retransmission, can be used 1107 to detect losses of the segments sent chronologically prior to it. 1108 This enables RACK-TLP to use fast recovery in cases with application- 1109 limited flights of data, lost retransmissions, or data segment 1110 reordering events. Consider the following examples: 1112 1. Packet drops at the end of an application data flight: Consider a 1113 sender that transmits an application-limited flight of three data 1114 segments (P1, P2, P3), and P1 and P3 are lost. Suppose the 1115 transmission of each segment is at least RACK.reo_wnd after the 1116 transmission of the previous segment. RACK will mark P1 as lost 1117 when the SACK of P2 is received, and this will trigger the 1118 retransmission of P1 as R1. When R1 is cumulatively 1119 acknowledged, RACK will mark P3 as lost and the sender will 1120 retransmit P3 as R3. This example illustrates how RACK is able 1121 to repair certain drops at the tail of a transaction without an 1122 RTO recovery. Notice that neither the conventional duplicate ACK 1123 threshold [RFC5681], nor [RFC6675], nor the Forward 1124 Acknowledgment [FACK] algorithm can detect such losses, because 1125 of the required segment or sequence count. 1127 2. Lost retransmission: Consider a flight of three data segments 1128 (P1, P2, P3) that are sent; P1 and P2 are dropped. Suppose the 1129 transmission of each segment is at least RACK.reo_wnd after the 1130 transmission of the previous segment. When P3 is SACKed, RACK 1131 will mark P1 and P2 lost and they will be retransmitted as R1 and 1132 R2. Suppose R1 is lost again but R2 is SACKed; RACK will mark R1 1133 lost and trigger retransmission again. Again, neither the 1134 conventional three duplicate ACK threshold approach, nor 1135 [RFC6675], nor the Forward Acknowledgment [FACK] algorithm can 1136 detect such losses. And such a lost retransmission can happen 1137 when TCP is being rate-limited, particularly by token bucket 1138 policers with large bucket depth and low rate limit; in such 1139 cases retransmissions are often lost repeatedly because standard 1140 congestion control requires multiple round trips to reduce the 1141 rate below the policed rate. 1143 3. Packet reordering: Consider a simple reordering event where a 1144 flight of segments are sent as (P1, P2, P3). P1 and P2 carry a 1145 full payload of MSS octets, but P3 has only a 1-octet payload. 1146 Suppose the sender has detected reordering previously and thus 1147 RACK.reo_wnd is min_RTT/4. Now P3 is reordered and delivered 1148 first, before P1 and P2. As long as P1 and P2 are delivered 1149 within min_RTT/4, RACK will not consider P1 and P2 lost. But if 1150 P1 and P2 are delivered outside the reordering window, then RACK 1151 will still spuriously mark P1 and P2 lost. 1153 The examples above show that RACK-TLP is particularly useful when the 1154 sender is limited by the application, which can happen with 1155 interactive or request/response traffic. Similarly, RACK still works 1156 when the sender is limited by the receive window, which can happen 1157 with applications that use the receive window to throttle the sender. 1159 RACK-TLP works more efficiently with TCP Segmentation Offload (TSO) 1160 compared to DUPACK-counting. RACK always marks the entire TSO 1161 aggregate lost because the segments in the same TSO aggregate have 1162 the same transmission timestamp. By contrast, the algorithms based 1163 on sequence counting (e.g., [RFC6675][RFC5681]) may mark only a 1164 subset of segments in the TSO aggregate lost, forcing the stack to 1165 perform expensive fragmentation of the TSO aggregate, or to 1166 selectively tag individual segments lost in the scoreboard. 1168 The main drawback of RACK-TLP is the additional states required 1169 compared to DUPACK-counting. RACK requires the sender to record the 1170 transmission time of each segment sent at a clock granularity that is 1171 finer than 1/4 of the minimum RTT of the connection. TCP 1172 implementations that record this already for RTT estimation do not 1173 require any new per-packet state. But implementations that are not 1174 yet recording segment transmission times will need to add per-packet 1175 internal state (expected to be either 4 or 8 octets per segment or 1176 TSO aggregate) to track transmission times. In contrast, [RFC6675] 1177 loss detection approach does not require any per-packet state beyond 1178 the SACK scoreboard; this is particularly useful on ultra-low RTT 1179 networks where the RTT may be less than the sender TCP clock 1180 granularity (e.g. inside data-centers). Another disadvantage is the 1181 reordering timer may expire prematurely (like any other 1182 retransmission timer) to cause higher spurious retransmission 1183 especially if DSACK is not supported. 1185 9.2. Relationships with other loss recovery algorithms 1187 The primary motivation of RACK-TLP is to provide a general 1188 alternative to some of the standard loss recovery algorithms 1189 [RFC5681][RFC6675][RFC5827][RFC4653]. [RFC5827][RFC4653] dynamically 1190 adjusts the duplicate ACK threshold based on the current or previous 1191 flight sizes. RACK-TLP takes a different approach by using a time- 1192 based reordering window. RACK-TLP can be seen as an extended Early 1193 Retransmit [RFC5827] without a FlightSize limit but with an 1194 additional reordering window. [FACK] considers an original segment 1195 to be lost when its sequence range is sufficiently far below the 1196 highest SACKed sequence. In some sense RACK-TLP can be seen as a 1197 generalized form of FACK that operates in time space instead of 1198 sequence space, enabling it to better handle reordering, application- 1199 limited traffic, and lost retransmissions. 1201 RACK-TLP is compatible with the standard RTO [RFC6298], RTO-restart 1202 [RFC7765], F-RTO [RFC5682] and Eifel algorithms [RFC3522]. This is 1203 because RACK-TLP only detects loss by using ACK events. It neither 1204 changes the RTO timer calculation nor detects spurious RTO. 1206 9.3. Interaction with congestion control 1208 RACK-TLP intentionally decouples loss detection from congestion 1209 control. RACK-TLP only detects losses; it does not modify the 1210 congestion control algorithm [RFC5681][RFC6937]. A segment marked 1211 lost by RACK-TLP MUST NOT be retransmitted until congestion control 1212 deems this appropriate. 1214 The only exception -- the only way in which RACK-TLP modulates the 1215 congestion control algorithm -- is that one outstanding loss probe 1216 can be sent even if the congestion window is fully used. However, 1217 this temporary over-commit is accounted for and credited in the in- 1218 flight data tracked for congestion control, so that congestion 1219 control will erase the over-commit upon the next ACK. 1221 If packet losses happen after the reordering window has been 1222 increased by DSACK, RACK-TLP may take longer to detect losses than 1223 the pure DUPACK-counting approach. In this case TCP may continue to 1224 increase the congestion window upon receiving ACKs during this time, 1225 making the sender more aggressive. 1227 The following simple example compares how RACK-TLP and non-RACK-TLP 1228 loss detection interacts with congestion control: suppose a sender 1229 has a congestion window (cwnd) of 20 segments on a SACK-enabled 1230 connection. It sends 10 data segments and all of them are lost. 1232 Without RACK-TLP, the sender would time out, reset cwnd to 1, and 1233 retransmit the first segment. It would take four round trips (1 + 2 1234 + 4 + 3 = 10) to retransmit all the 10 lost segments using slow 1235 start. The recovery latency would be RTO + 4*RTT, with an ending 1236 cwnd of 4 segments due to congestion window validation. 1238 With RACK-TLP, a sender would send the TLP after 2*RTT and get a 1239 DUPACK, enabling RACK to detect the losses and trigger fast recovery. 1240 If the sender implements Proportional Rate Reduction [RFC6937] it 1241 would slow start to retransmit the remaining 9 lost segments since 1242 the number of segments in flight (0) is lower than the slow start 1243 threshold (10). The slow start would again take four round trips (1 1244 + 2 + 4 + 3 = 10) to retransmit all the lost segments. The recovery 1245 latency would be 2*RTT + 4*RTT, with an ending cwnd set to the slow 1246 start threshold of 10 segments. 1248 The difference in recovery latency (RTO + 4*RTT vs 6*RTT) can be 1249 significant if the RTT is much smaller than the minimum RTO (1 second 1250 in [RFC6298]) or if the RTT is large. The former case can happen in 1251 local area networks, data-center networks, or content distribution 1252 networks with deep deployments. The latter case can happen in 1253 developing regions with highly congested and/or high-latency 1254 networks. 1256 9.4. TLP recovery detection with delayed ACKs 1258 Delayed or stretched ACKs complicate the detection of repairs done by 1259 TLP, since with such ACKs the sender takes longer time to receive 1260 fewer ACKs than would normally be expected. To mitigate this 1261 complication, before sending a TLP loss probe retransmission, the 1262 sender should attempt to wait long enough that the receiver has sent 1263 any delayed ACKs that it is withholding. The sender algorithm 1264 described above features such a delay, in the form of 1265 TLP.max_ack_delay. Furthermore, if the receiver supports DSACK then 1266 in the case of a delayed ACK the sender's TLP recovery detection 1267 mechanism (see above) can use the DSACK information to infer that the 1268 original and TLP retransmission both arrived at the receiver. 1270 If there is ACK loss or a delayed ACK without a DSACK, then this 1271 algorithm is conservative, because the sender will reduce the 1272 congestion window when in fact there was no packet loss. In practice 1273 this is acceptable, and potentially even desirable: if there is 1274 reverse path congestion then reducing the congestion window can be 1275 prudent. 1277 9.5. RACK for other transport protocols 1279 RACK can be implemented in other transport protocols (e.g., [QUIC- 1280 LR]). The [Sprout] loss detection algorithm was also independently 1281 designed to use a 10ms reordering window to improve its loss 1282 detection. 1284 10. Security Considerations 1286 RACK-TLP algorithm behavior is based on information conveyed in SACK 1287 options, so it has security considerations similar to those described 1288 in the Security Considerations section of [RFC6675]. 1290 Additionally, RACK-TLP has a lower risk profile than [RFC6675] 1291 because it is not vulnerable to ACK-splitting attacks [SCWA99]: for 1292 an MSS-size segment sent, the receiver or the attacker might send MSS 1293 ACKs that SACK or acknowledge one additional byte per ACK. This 1294 would not fool RACK. In such a scenario, RACK.xmit_ts would not 1295 advance, because all the sequence ranges within the segment were 1296 transmitted at the same time, and thus carry the same transmission 1297 timestamp. In other words, SACKing only one byte of a segment or 1298 SACKing the segment in entirety have the same effect with RACK. 1300 11. IANA Considerations 1302 This document makes no request of IANA. 1304 Note to RFC Editor: this section may be removed on publication as an 1305 RFC. 1307 12. Acknowledgments 1309 The authors thank Matt Mathis for his insights in FACK and Michael 1310 Welzl for his per-packet timer idea that inspired this work. Eric 1311 Dumazet, Randy Stewart, Van Jacobson, Ian Swett, Rick Jones, Jana 1312 Iyengar, Hiren Panchasara, Praveen Balasubramanian, Yoshifumi 1313 Nishida, Bob Briscoe, Felix Weinrank, Michael Tuexen, Martin Duke, 1314 Ilpo Jarvinen, Theresa Enghardt, Mirja Kuehlewind, Gorry Fairhurst, 1315 and Yi Huang contributed to the draft or the implementations in 1316 Linux, FreeBSD, Windows, and QUIC. 1318 13. References 1320 13.1. Normative References 1322 [RFC2018] Mathis, M. and J. Mahdavi, "TCP Selective Acknowledgment 1323 Options", RFC 2018, October 1996. 1325 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1326 Requirement Levels", RFC 2119, March 1997. 1328 [RFC2883] Floyd, S., Mahdavi, J., Mathis, M., and M. Podolsky, "An 1329 Extension to the Selective Acknowledgement (SACK) Option 1330 for TCP", RFC 2883, July 2000. 1332 [RFC5681] Allman, M., Paxson, V., and E. Blanton, "TCP Congestion 1333 Control", RFC 5681, September 2009. 1335 [RFC6298] Paxson, V., Allman, M., Chu, J., and M. Sargent, 1336 "Computing TCP's Retransmission Timer", RFC 6298, June 1337 2011. 1339 [RFC6675] Blanton, E., Allman, M., Wang, L., Jarvinen, I., Kojo, M., 1340 and Y. Nishida, "A Conservative Loss Recovery Algorithm 1341 Based on Selective Acknowledgment (SACK) for TCP", 1342 RFC 6675, August 2012. 1344 [RFC7323] Borman, D., Braden, B., Jacobson, V., and R. 1345 Scheffenegger, "TCP Extensions for High Performance", 1346 September 2014. 1348 [RFC793] Postel, J., "Transmission Control Protocol", September 1349 1981. 1351 13.2. Informative References 1353 [FACK] Mathis, M. and M. Jamshid, "Forward acknowledgement: 1354 refining TCP congestion control", ACM SIGCOMM Computer 1355 Communication Review, Volume 26, Issue 4, Oct. 1996. , 1356 1996. 1358 [POLICER16] 1359 Flach, T., Papageorge, P., Terzis, A., Pedrosa, L., Cheng, 1360 Y., Karim, T., Katz-Bassett, E., and R. Govindan, "An 1361 Analysis of Traffic Policing in the Web", ACM SIGCOMM , 1362 2016. 1364 [QUIC-LR] Iyengar, J. and I. Swett, "QUIC Loss Recovery And 1365 Congestion Control", draft-ietf-quic-recovery-latest (work 1366 in progress), March 2020. 1368 [RFC4653] Bhandarkar, S., Reddy, A., Allman, M., and E. Blanton, 1369 "Improving the Robustness of TCP to Non-Congestion 1370 Events", August 2006. 1372 [RFC5682] Sarolahti, P., Kojo, M., Yamamoto, K., and M. Hata, 1373 "Forward RTO-Recovery (F-RTO): An Algorithm for Detecting 1374 Spurious Retransmission Timeouts with TCP", RFC 5682, 1375 September 2009. 1377 [RFC5827] Allman, M., Ayesta, U., Wang, L., Blanton, J., and P. 1378 Hurtig, "Early Retransmit for TCP and Stream Control 1379 Transmission Protocol (SCTP)", RFC 5827, April 2010. 1381 [RFC6937] Mathis, M., Dukkipati, N., and Y. Cheng, "Proportional 1382 Rate Reduction for TCP", May 2013. 1384 [RFC7765] Hurtig, P., Brunstrom, A., Petlund, A., and M. Welzl, "TCP 1385 and SCTP RTO Restart", February 2016. 1387 [SCWA99] Savage, S., Cardwell, N., Wetherall, D., and T. Anderson, 1388 "TCP Congestion Control With a Misbehaving Receiver", ACM 1389 Computer Communication Review, 29(5) , 1999. 1391 [Sprout] Winstein, K., Sivaraman, A., and H. Balakrishnan, 1392 "Stochastic Forecasts Achieve High Throughput and Low 1393 Delay over Cellular Networks", USENIX Symposium on 1394 Networked Systems Design and Implementation (NSDI) , 2013. 1396 Authors' Addresses 1398 Yuchung Cheng 1399 Google, Inc 1401 Email: ycheng@google.com 1403 Neal Cardwell 1404 Google, Inc 1406 Email: ncardwell@google.com 1407 Nandita Dukkipati 1408 Google, Inc 1410 Email: nanditad@google.com 1412 Priyaranjan Jha 1413 Google, Inc 1415 Email: priyarjha@google.com