Pages - Menu

Tuesday, July 2, 2013

how to display tcp rto

Calculating the TCP Retransmission Timeout always makes my head explode, yet it can be useful when troubleshooting TCP algorithms like FRTO or TIME_WAIT timeout when TCP Timestamps are in use.

This excellent post by sgros gives a very thorough overview of the RTO algorithms in the kernel and how RTO is actually calculated:
However, I don't want to do that, and I certainly don't want to do it for every socket in realtime. Is there an easy way to display the RTO for every socket?

There sure is:
ss -i
The -i option of ss is the flag to "Show internal TCP information", check man ss for more options.

Here's an example of a socket on my system including its RTO:

State   Recv-Q   Send-Q    Local Address:Port      Peer Address:Port
ESTAB   0        0 
cubic wscale:6,7 rto:660 rtt:396/38.75 ato:40 cwnd:10 send 272.3Kbps rcv_space:14600
ss is one of the "next generation" iproute2 commands to replace the older netstat. Much like ip addr has replaced ifconfig, ip route has replaced route, and ip neigh has replaced arp.


Lukas said...

thanks for nice informative post.
I just want to confirm one thing: units for RTO displayed by ss -i are milliseconds?

Jamie said...

That's my understanding, yes. Though keep in mind for actual sending of retransmissions, RFC2988 states if a timer is less than 1 second it must be rounded up to 1 second.

MS RAO said...

What about units for cwnd and ssthresh??
is it Kilo bytes / bytes ???

Jamie said...

These are measured in bytes.

MS RAO said...

TCP Reno based CWND

In linux if we are working on TCP-RENO (in-place of cubic), cwnd will increase till packet drops occur

I will get sawtooth graph for cwnd vs time

RTT based CWND

If cwnd is computed based on currently updated RTT along with Previous RTT values packet drop will not occur

I will get straight line graph for cwnd vs time

Am I right??

MS RAO said...

At full utilization of the link

if throughput is not limited by rwnd, surely it has to limit by cwnd....

min (cwnd,rwnd) should match with bandwidth * delay

Am i right ??

Anonymous said...

good post :) Thank you