retransmission timeout (TCP RTO)

term

networking

Kept in this browser · My desk

How long a Transmission Control Protocol (TCP) sender waits for an acknowledgement before it retransmits the oldest unacknowledged segment: computed from measured round-trip times and their variation, never below one second in the standard, and doubled after every expiry.

It is the slowest and most expensive way a Transmission Control Protocol (TCP) sender learns of a loss. Request for Comments (RFC) 6298 computes it from a smoothed round-trip time plus four times the round-trip variation, starts it at one second, and doubles it each time it fires; when it fires, the congestion window falls to a single segment and slow start begins again. Faster signals exist, duplicate acknowledgements and the Tail Loss Probe, precisely so the timer fires rarely. On a capture, a retransmission after a long silence, then another after twice as long, is the timer's signature; a retransmission after a short burst of duplicate acknowledgements is not.

What it is. The retransmission timeout (RTO) is the interval after which a Transmission Control Protocol (TCP) sender, having heard no acknowledgement, retransmits the earliest segment not yet acknowledged. Request for Comments (RFC) 6298 (June 2011, by Vern Paxson, Mark Allman, H.K. Jerry Chu and Matt Sargent; it obsoletes RFC 2988 and updates RFC 1122) specifies how it is computed and managed. The abbreviation RTO on this site also names the recovery time objective of disaster recovery, a different idea with its own entry.

Where it came from. The original rule of RFC 793 smoothed the round-trip time R and set the timeout to beta x R with beta = 2. Van Jacobson and Michael J. Karels showed in Congestion Avoidance and Control (November 1988) that this adapts to loads of at most 30%; above that, a connection retransmits packets that were only delayed, which they called the network equivalent of pouring gasoline on a fire. Their remedy, among the seven algorithms they added to the 4BSD TCP, was to estimate the variation of the round-trip time as well as its mean, and to back the timer off exponentially.

How it is computed. Before any measurement, RFC 6298 sets the timeout to 1 second (rule 2.1). On the first measurement R it sets the smoothed round-trip time (SRTT) to SRTT = R, the round-trip time variation (RTTVAR) to RTTVAR = R/2, and RTO = SRTT + max(G, K x RTTVAR) with K = 4, G being the clock granularity (rule 2.2). On each later measurement R' it updates RTTVAR = (1 - beta) x RTTVAR + beta x |SRTT - R'| first, then SRTT = (1 - alpha) x SRTT + alpha x R', with alpha = 1/8 and beta = 1/4, and recomputes the timeout (rule 2.3). Whenever the result is below 1 second it SHOULD be rounded up to 1 second (rule 2.4), and any maximum placed on it must be at least 60 seconds (rule 2.5). Karn's algorithm forbids taking samples from retransmitted segments, whose acknowledgement is ambiguous, unless the timestamp option removes the ambiguity, and at least one sample must be taken per round trip (section 3).

Worked, by hand. Samples of 100, 140, 90 and 300 ms, with a fine clock. First: SRTT 100, RTTVAR 50, RTO 100 + 4 x 50 = 300 ms. Second, R' = 140: RTTVAR = 0.75 x 50 + 0.25 x |100 - 140| = 47.5; SRTT = 0.875 x 100 + 0.125 x 140 = 105; RTO = 105 + 190 = 295 ms. Third, R' = 90: RTTVAR = 0.75 x 47.5 + 0.25 x 15 = 39.375; SRTT = 103.125; RTO is about 260.6 ms. Fourth, R' = 300: RTTVAR = 0.75 x 39.375 + 0.25 x 196.875 = 78.75; SRTT is about 127.7; RTO is about 442.7 ms. Every one of these is below the standard's 1-second floor, so a host following rule 2.4 would wait 1 second each time; the variation term is what lets the timer stretch when the path becomes erratic.

Managing the timer. Every time a data segment is sent and the timer is not running, it is started; when all data is acknowledged it is stopped; an acknowledgement of new data restarts it (rules 5.1 to 5.3). When it expires, the earliest unacknowledged segment is retransmitted, the timeout is doubled, the back-off (rule 5.5), and the timer restarted with the new value, so a dead path is probed at 1, 2, 4, 8, 16 and 32 seconds and beyond. RFC 6298 lowered the initial value from RFC 2988's 3 seconds to 1, but if the timer fires waiting for the acknowledgement of a SYN (synchronize) segment, the timeout goes back to 3 seconds when data transmission begins (rule 5.7 and section 7). After a timeout, RFC 5681 sets the congestion window to the loss window, a single segment, which is why one timeout can cost a long connection far more than the wait itself.

Faster signals. Three duplicate acknowledgements start fast retransmit without waiting (RFC 5681). RFC 8985 (February 2021), RACK-TLP, by Yuchung Cheng, Neal Cardwell, Nandita Dukkipati and Priyaranjan Jha, detects losses from per-segment transmit timestamps and selective acknowledgements, and its Tail Loss Probe sends a probe after a probe timeout of about twice the smoothed round-trip time, precisely to avoid retransmission timeout events at the end of a flight.

In practice. Linux departs from the standard's floor: net.ipv4.tcp_rto_min_us defaults to 200,000 microseconds, 200 ms, and the documentation recommends values at or below that; tcp_rto_max_ms defaults to 120,000 ms; and tcp_retries2, default 15, gives a hypothetical timeout of 924.6 seconds before an unacknowledged connection is killed. ss -ti shows each connection's current rto in milliseconds, its backoff count (the actual timeout is rto shifted left by backoff) and its rtt/rttvar.

What goes wrong. A floor that is too high makes every tail loss on a short request cost a second or more; one that is too low retransmits packets that were only delayed. Reading a slow retransmission in a capture as network loss misses the doubling pattern that tells a dead path from a lossy one. And a timeout always resets the congestion window, so its cost is counted in round trips of slow start as well as in seconds.

Neighbours. The congestion window is what a timeout cuts; congestion control decides how it regrows; the receive window's zero-window probes follow the same timer; retries in applications add their own timeouts on top.

Also known as: retransmission timer, tcp retransmission timeout, srtt, rttvar, timeout de retransmissão

Sources

← Back to R Back to the glossary