idnits 2.17.1 draft-huitema-quic-ts-05.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document 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 (March 17, 2021) is 1135 days in the past. Is this intentional? Checking references for intended status: Experimental ---------------------------------------------------------------------------- No issues found here. Summary: 0 errors (**), 0 flaws (~~), 2 warnings (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group C. Huitema 3 Internet-Draft Private Octopus Inc. 4 Intended status: Experimental March 17, 2021 5 Expires: September 18, 2021 7 Quic Timestamps For Measuring One-Way Delays 8 draft-huitema-quic-ts-05 10 Abstract 12 The TIMESTAMP frame can be added to Quic packets when one way delay 13 measurements are useful. The timestamp is set to the number of 14 microseconds from the beginning of the node's epoch to the time at 15 which the packet is sent. The draft defines the "enable_timestamp" 16 transport parameter for negotiating the use of this extension frame, 17 and the TIMESTAMP frame. 19 Status of This Memo 21 This Internet-Draft is submitted in full conformance with the 22 provisions of BCP 78 and BCP 79. 24 Internet-Drafts are working documents of the Internet Engineering 25 Task Force (IETF). Note that other groups may also distribute 26 working documents as Internet-Drafts. The list of current Internet- 27 Drafts is at https://datatracker.ietf.org/drafts/current/. 29 Internet-Drafts are draft documents valid for a maximum of six months 30 and may be updated, replaced, or obsoleted by other documents at any 31 time. It is inappropriate to use Internet-Drafts as reference 32 material or to cite them other than as "work in progress." 34 This Internet-Draft will expire on September 18, 2021. 36 Copyright Notice 38 Copyright (c) 2021 IETF Trust and the persons identified as the 39 document authors. All rights reserved. 41 This document is subject to BCP 78 and the IETF Trust's Legal 42 Provisions Relating to IETF Documents 43 (https://trustee.ietf.org/license-info) in effect on the date of 44 publication of this document. Please review these documents 45 carefully, as they describe your rights and restrictions with respect 46 to this document. Code Components extracted from this document must 47 include Simplified BSD License text as described in Section 4.e of 48 the Trust Legal Provisions and are provided without warranty as 49 described in the Simplified BSD License. 51 Table of Contents 53 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 54 1.1. Terms and Definitions . . . . . . . . . . . . . . . . . . 3 55 2. Specification . . . . . . . . . . . . . . . . . . . . . . . . 3 56 2.1. Negotiation . . . . . . . . . . . . . . . . . . . . . . . 3 57 2.1.1. Zero RTT and Timestamp Option . . . . . . . . . . . . 4 58 2.2. Sending TIMESTAMP frames . . . . . . . . . . . . . . . . 4 59 2.3. TIMESTAMP frame format . . . . . . . . . . . . . . . . . 4 60 2.4. RTT Measurements . . . . . . . . . . . . . . . . . . . . 5 61 2.5. Choice of Epoch . . . . . . . . . . . . . . . . . . . . . 5 62 2.6. One-Way Delay Measurements . . . . . . . . . . . . . . . 6 63 3. Discussion . . . . . . . . . . . . . . . . . . . . . . . . . 6 64 3.1. Management of Time . . . . . . . . . . . . . . . . . . . 7 65 4. Security Considerations . . . . . . . . . . . . . . . . . . . 8 66 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 8 67 6. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 9 68 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 9 69 7.1. Normative References . . . . . . . . . . . . . . . . . . 9 70 7.2. Informative References . . . . . . . . . . . . . . . . . 9 71 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 10 73 1. Introduction 75 The QUIC Transport Protocol [I-D.ietf-quic-transport] provides a 76 secure, multiplexed connection for transmitting reliable streams of 77 application data. The algorithms for QUIC Loss Detection and 78 Congestion Control [I-D.ietf-quic-recovery] use measurement of Round 79 Trip Time (RTT) to determine when packets should be retransmitted. 80 RTT measurements are useful, but there are however many cases in 81 which more precise One-Way Delay (1WD) measurements enable more 82 efficient Loss Detection and Congestion Control. 84 An example would be the Low Extra Delay Background Transport (LEDBAT) 85 [RFC6817] which uses variations in transmission delay to detect 86 competition for transmission resource. Experience shows that while 87 LEDBAT may be implemented using RTT measurements, it is somewhat 88 inefficient because it will cause unnecessary slowdowns in case of 89 queues or delayed ACKs on the return path. Using 1WD solves these 90 issues. Similar argument can be made for most delay-based 91 algorithms. 93 We propose to enable one way delay measurements in QUIC by defining a 94 TIMESTAMP frame carrying the time at which a packet is sent. The use 95 of this extension frame is negotiated with a transport parameter, 96 "enable_timestamp". When the extension is negotiated by both 97 parties, this frame can be used in conjunction with other such as ACK 98 to measure one way delays. 100 1.1. Terms and Definitions 102 The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 103 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 104 "OPTIONAL" in this document are to be interpreted as described in BCP 105 14 [RFC2119] [RFC8174] when, and only when, they appear in all 106 capitals, as shown here. 108 2. Specification 110 The enable_timestamp transport parameter used for negotiating the use 111 of the extension frame is defined in Section 2.1. The timestamp 112 frame format is defined in Section 2.3. 114 2.1. Negotiation 116 The use of the timestamp frame extension is negotiated using a 117 transport parameter: 119 o enable_timestamp (TBD) 121 The enable timestamp transport parameter is included if the endpoint 122 wants to receive or accepts to send timestamp frames for this 123 connection. This parameter is encoded as a variable integer as 124 specified in section 16 of [I-D.ietf-quic-transport]. It can take 125 one of the following three values: 127 1. I would like to receive TIMESTAMP frames 129 2. I am able to generate TIMESTAMP frames 131 3. I am able to generate TIMESTAMP frames and I would like to 132 receive them 134 Peers receiving another value SHOULD terminate the connection with a 135 TRANSPORT PARAMETER error. 137 A peer that advertises its capability of sending TIMESTAMP frames 138 using option values 2 or 3 MUST NOT send these frames if the other 139 peer does not announce advertise its desire to receive them by 140 sending the enable_timestamp TP with option 1 or 3. This condition 141 is described as "successful sending negotiation" in Section 2.2. 143 Peers that receive TIMESTAMP frames when they have not advertised 144 their desire to receive them MAY terminate the connection with a 145 PROTOCOL VIOLATION error. 147 2.1.1. Zero RTT and Timestamp Option 149 Implementations MUST NOT remember the value of the enable_timestamp 150 parameter and try to use it when attempting 0-RTT on subsequent 151 connections. This rules is in line with the suggestions in section 152 7.4.2 of [I-D.ietf-quic-transport] to adopt conservative defaults and 153 avoid compatibility issues. It is also consistent with the 154 specification to only use TIMESTAMP frames in 1RTT packets, see 155 Section 2.2. 157 2.2. Sending TIMESTAMP frames 159 Following successful sending negotiation, a peer SHOULD add a 160 timestamp frame to 1RTT packets carrying an ACK frame. This 161 specification does not impose a placement of TIMESTAMP frames in the 162 packet. They MAY be sent either before or after the ACK frame. 164 Implementations SHOULD NOT send more than one TIMESTAMP frame per 165 packet, but they MAY send more than one in rare circumstances. When 166 multiple TIMESTAMP frames are present in a packet, the receiver 167 retains the frame indicating the largest timestamp. 169 Implementations MUST NOT send the TIMESTAMP frame in Initial, 0-RTT 170 or Handshake packets, because there is a risk that the peer will 171 receive such packets before the negotiation completes. This 172 restriction may appear excessive because some Handshake packets are 173 typically sent after the negotiation completes, but restricting 174 TIMESTAMP frames to 1RTT packets is simpler and less error prone than 175 allowing the TIMESTAMP frame in just a fraction of Handshake packets. 177 2.3. TIMESTAMP frame format 179 TIMESTAMP frames are identified by the frame type: 181 o TIMESTAMP (TBD) 183 TIMESTAMP frames carry a single parameter, the timestamp. 185 0 1 2 3 186 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 187 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 188 | Timestamp (i) ... 189 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 191 Figure 1: TIMESTAMP Frame Format with Timestamp 193 The timestamp encodes the number of microseconds since the beginning 194 of the epoch, as measured by the peer at the time at which the packet 195 is sent. It is encoded using the exponent selected by the peer in 196 the ack_delay_exponent. The exponent reduced timestamp is encoded as 197 a variable length integer. 199 TIMESTAMP frames are not ack-eliciting. Their loss does not require 200 retransmission. 202 For congestion control, TIMESTAMP frames are treated like ACK frames. 203 Section 7 of [I-D.ietf-quic-recovery] specifies that "packets 204 containing only ACK frames do not count towards bytes in flight and 205 are not congestion controlled". The same applies to packets 206 containing only TIMESTAMP frames, or a combination of ACK frames and 207 TIMESTAMP frames. 209 2.4. RTT Measurements 211 RTT measurements are performed as specified in Section 4 of 212 [I-D.ietf-quic-recovery], without reference to the Timestamp 213 parameter of the Timestamped ACK frames. 215 2.5. Choice of Epoch 217 Each peer can chose its epoch as it sees fit, but it MUST remain 218 constant for the duration of the connection, and the resulting 219 timestamps MUST be positive integers. Plausible values for the epoch 220 could be: 222 o the beginning of the connection, i.e., the time at which the first 223 packet for that connection was sent or received. 225 o the time at which the first timestamp is sent. 227 Chosing values close to the beginning of the connection ensures that 228 the timestamps value will be at most equal to the duration of the 229 connection, which limits the amount of bytes required to encode the 230 timestamps. 232 2.6. One-Way Delay Measurements 234 An endpoint generates a One Way Delay Sample on receiving a packet 235 containing both a TIMESTAMP frame and an ACK frame that meets the 236 following two conditions: 238 o the largest acknowledged packet number is newly acknowledged, and 240 o at least one of the newly acknowledged packets was ack-eliciting. 242 The One Way Delay sample, latest_1wd, is generated as the time 243 elapsed since the largest acknowledged packet was sent, corrected for 244 the difference between local time at the sending peer and connection 245 time at the receiving peer, phase_shift. 247 latest_1wd = timestamp - send_time_of_largest_acked - phase_shift 249 By convention, the phase_shift is estimated upon reception of the 250 first RTT sample, first_rtt. It is set to: 252 phase_shift = timestamp - send_time_of_largest_acked - latest_rtt/2 254 In that formula, we assume that the local time are measured in 255 microseconds since the beginning of the connection. The formula does 256 not depend on the choice of epoch by each peer, but simply of the 257 hypothesis that delays on the data path and the return path are about 258 equal. 260 We understand that clocks may drift over time, and that simply 261 estimating a phase shift at the beginning of a connection may be too 262 simplistic for long duration connections. Implementations MAY adopt 263 different strategies to reestimate the phase shift at appropriate 264 intervals. Specifying these strategies is beyond the scope of this 265 document. 267 3. Discussion 269 This document replaces an earlier proposal to modify the format of 270 the ACK frame by including a timestamp inside the modified frame. 271 The revised proposal encodes the timestamp independently of the ACK 272 frame, which requires slightly more overhead to encode the type of 273 the TIMESTAMP frame. 275 Defining an independent frame allows for more flexibility. This 276 draft defines the combination of TIMESTAMP with ACK frames, but they 277 could be combined with other frames as well. For example, adding a 278 TIMESTAMP to packets carrying a Path Response could allow measuring 279 one way delays before deciding to migrate to a new path. 281 3.1. Management of Time 283 There are two known issues with deducing one way delays from RTT 284 measurements: clock drift and undefined phase difference. 286 The phase difference problem is easy to understand. We start from a 287 list of measurements associating the send time of packet number x 288 (s[x]), the receive time of the acknowledgement of packet (a[x]), and 289 the timestamp indicating when packet x was received by the peer 290 (p[x]). The peer's timestamp are expressed in the peer's clock. 292 Suppose that we model the peer's clock as local time plus phase 293 difference f, and that we model the rtt as the sum of two one way 294 delays, up (u[x]) and down (d[x]). We get: 296 u[x] = p[x] + f - s[x] 298 d[x] = a[x] - p[x] - f 300 Just looking at the equation shows that the value of f cannot be 301 determined from the a series of measurement (s[x], a[x], p[x]). You 302 can just add constraints that all u[x] and d[x] are positive numbers, 303 which gives a range of plausible values for f: max(s[x] - p[x]) < f < 304 min(a[x]-p[x]). In case you wonder, you get similar formulations in 305 a multipath scenario. The plausible range may narrow to the min rtt 306 of the shortest path, but no further. 308 The phase difference uncertainty is not a big issue in practice, 309 because control algorithms are much more interested in the variations 310 of the delays than by their absolute values. Suppose we want to 311 compare one way delays at measurement (x) and (y). We get: 313 u[x] = p[x] + f - s[x] 315 u[y] = p[y] + f - s[y] 317 u[x] - u[y] = p[x] - p[y] - s[x] + s[y] 319 The phase difference does not affect the measurement of variations in 320 the one way delay. 322 The clock drift is another matter. All the equations above assume 323 that the local clock and the remote clock have the same frequency. 324 This is an approximation. Clocks drift over time. Instead of just 325 considering a stable phase difference, one should consider the sum of 326 a phase difference and a time-varying drift component. Estimating 327 drift is a complex problem. This was studied in detail in the 328 development of the Network Time Protocol (NTP) [RFC5905]. In theory, 329 implementations of Quic could copy the algorithms of NTP to build a 330 model of the clocks used by the local node and the peer. That would 331 be very complex. 333 Fortunately, implementations of Quic no not need to implement 334 something as complex as NTP. Most time based algorithms are only 335 interested in variations of delays over a short horizon. Clock drift 336 happens at a slow pace, maybe 1 millisecond per minute. Time base 337 congestion control algorithms already have to cope with the potential 338 drift of the minimum RTT due to changing network conditions. They do 339 that by periodically restarting the measurement of the minimum RTT 340 after some delay, typically less than a minute. A simple 341 implementation of one way delay measurements could follow the same 342 approach, for example resetting the phase difference every 30 seconds 343 or so. 345 4. Security Considerations 347 The Timestamp value in the TIMESTAMP frame is asserted by the sender 348 of the packet. Adversarial peers could chose values of the timestamp 349 designed to exercise side effects in congestion control algorithms or 350 other algorithms relying on the one-way delays. This can be 351 mitigated by running plausibility checks on the received values. For 352 example, each peer can maintain statistics not just on the One Way 353 Delays, but also on the differences between One Way Delays and RTT, 354 and detect outlier values. Peers can also compare the differences 355 between timestamps in packets carrying acknowledgements and the 356 differences between the sending times of corresponding packets, and 357 detect anomalies if the delays between acknowledging packets appears 358 shorter than the delays when sending them. 360 5. IANA Considerations 362 This document registers a new value in the QUIC Transport Parameter 363 Registry: 365 Value: TBD (using value 0x7158 in early deployments) 367 Parameter Name: enable_timestamp 369 Specification: Indicates that the connection should use TimeStamped 370 ACK frames 372 This document also registers a new value in the QUIC Frame Type 373 registry: 375 Value: TBD (using value 757 in early deployments) 376 Frame Name: TIMESTAMP 378 Specification: Timestamp set at the time packet was sent 380 6. Acknowledgements 382 Thanks to Dmitri Tikhonov, Tal Misrahi, Watson Ladd, Martin Thomson 383 and Ian Swett for their reviews and suggestions. 385 7. References 387 7.1. Normative References 389 [I-D.ietf-quic-recovery] 390 Iyengar, J. and I. Swett, "QUIC Loss Detection and 391 Congestion Control", draft-ietf-quic-recovery-34 (work in 392 progress), January 2021. 394 [I-D.ietf-quic-transport] 395 Iyengar, J. and M. Thomson, "QUIC: A UDP-Based Multiplexed 396 and Secure Transport", draft-ietf-quic-transport-34 (work 397 in progress), January 2021. 399 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 400 Requirement Levels", BCP 14, RFC 2119, 401 DOI 10.17487/RFC2119, March 1997, 402 . 404 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 405 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 406 May 2017, . 408 7.2. Informative References 410 [RFC5905] Mills, D., Martin, J., Ed., Burbank, J., and W. Kasch, 411 "Network Time Protocol Version 4: Protocol and Algorithms 412 Specification", RFC 5905, DOI 10.17487/RFC5905, June 2010, 413 . 415 [RFC6817] Shalunov, S., Hazel, G., Iyengar, J., and M. Kuehlewind, 416 "Low Extra Delay Background Transport (LEDBAT)", RFC 6817, 417 DOI 10.17487/RFC6817, December 2012, 418 . 420 Author's Address 422 Christian Huitema 423 Private Octopus Inc. 424 427 Golfcourse Rd 425 Friday Harbor WA 98250 426 U.S.A 428 Email: huitema@huitema.net