TCP Session – When is the First RTT Measurement Sampled?

layer4protocol-theoryrfctcptransport-protocol

I am trying to understand the RTO mechanism. I have read RFC 6298, but it does not specify when the first RTT measurement is made.

Consider the following packet exchange

  1. Client —–Syn—–> Server
  2. Client <—Syn+Ack— Server
  3. Client —Data+Ack–> Server
  4. Client <–Data+Ack— Server

For the client side, is the first RTT measured after receiving Syn+Ack (#2) or Data+Ack (#4)?

For the server side, is it measured after receiving Data+Ack (#3)?

Best Answer

RTT is measured when transmitting segments, so there must be data in the sent packet so SYN and SYNACK can't provide a measurement. The RFC says:

(5.1) Every time a packet containing data is sent (including a retransmission), if the timer is not running, start it running...

So since in your example the client sends the first data then yes #4 acks it and provides a RTT measurement. Equally the server RTT measurement is made when #4 is acknowledged, a packet that you haven't shown (#5 perhaps)

It's in the first TCP RFC, RFC 793, TRANSMISSION CONTROL PROTOCOL, Section 3.7 Data Communication says:

An Example Retransmission Timeout Procedure

Measure the elapsed time between sending a data octet with a particular sequence number and receiving an acknowledgment that covers that sequence number (segments sent do not have to match segments received). This measured elapsed time is the Round Trip Time (RTT). Next compute a Smoothed Round Trip Time (SRTT) as:

SRTT = ( ALPHA * SRTT ) + ((1-ALPHA) * RTT)

and based on this, compute the retransmission timeout (RTO) as:

RTO = min[UBOUND,max[LBOUND,(BETA*SRTT)]]

where UBOUND is an upper bound on the timeout (e.g., 1 minute), LBOUND is a lower bound on the timeout (e.g., 1 second), ALPHA is a smoothing factor (e.g., .8 to .9), and BETA is a delay variance factor (e.g., 1.3 to 2.0).

I haven't followed this through the updates so there may be better or more explicit references.