blob: 970756e10750b84da5435026dde4e62afd2743f7 [file] [log] [blame]
Brendan Gregg553f2aa2016-02-14 18:15:24 -08001Demonstrations of tcpretrans, the Linux eBPF/bcc version.
2
3
4This tool traces the kernel TCP retransmit function to show details of these
5retransmits. For example:
6
7# ./tcpretrans
8TIME PID IP LADDR:LPORT T> RADDR:RPORT STATE
901:55:05 0 4 10.153.223.157:22 R> 69.53.245.40:34619 ESTABLISHED
1001:55:05 0 4 10.153.223.157:22 R> 69.53.245.40:34619 ESTABLISHED
1101:55:17 0 4 10.153.223.157:22 R> 69.53.245.40:22957 ESTABLISHED
12[...]
13
14This output shows three TCP retransmits, the first two were for an IPv4
15connection from 10.153.223.157 port 22 to 69.53.245.40 port 34619. The TCP
16state was "ESTABLISHED" at the time of the retransmit. The on-CPU PID at the
17time of the retransmit is printed, in this case 0 (the kernel, which will
18be the case most of the time).
19
20Retransmits are usually a sign of poor network health, and this tool is
21useful for their investigation. Unlike using tcpdump, this tool has very
22low overhead, as it only traces the retransmit function. It also prints
23additional kernel details: the state of the TCP session at the time of the
24retransmit.
25
26
27A -l option will include TCP tail loss probe attempts:
28
29# ./tcpretrans -l
30TIME PID IP LADDR:LPORT T> RADDR:RPORT STATE
3101:55:45 0 4 10.153.223.157:22 R> 69.53.245.40:51601 ESTABLISHED
3201:55:46 0 4 10.153.223.157:22 R> 69.53.245.40:51601 ESTABLISHED
3301:55:46 0 4 10.153.223.157:22 R> 69.53.245.40:51601 ESTABLISHED
3401:55:53 0 4 10.153.223.157:22 L> 69.53.245.40:46444 ESTABLISHED
3501:56:06 0 4 10.153.223.157:22 R> 69.53.245.40:46444 ESTABLISHED
3601:56:06 0 4 10.153.223.157:22 R> 69.53.245.40:46444 ESTABLISHED
3701:56:08 0 4 10.153.223.157:22 R> 69.53.245.40:46444 ESTABLISHED
3801:56:08 0 4 10.153.223.157:22 R> 69.53.245.40:46444 ESTABLISHED
3901:56:08 1938 4 10.153.223.157:22 R> 69.53.245.40:46444 ESTABLISHED
4001:56:08 0 4 10.153.223.157:22 R> 69.53.245.40:46444 ESTABLISHED
4101:56:08 0 4 10.153.223.157:22 R> 69.53.245.40:46444 ESTABLISHED
42[...]
43
44See the "L>" in the "T>" column. These are attempts: the kernel probably
45sent a TLP, but in some cases it might not have been ultimately sent.
46
47
48USAGE message:
49
50# ./tcpretrans -h
51usage: tcpretrans [-h] [-l]
52
53Trace TCP retransmits
54
55optional arguments:
56 -h, --help show this help message and exit
57 -l, --lossprobe include tail loss probe attempts
58
59examples:
60 ./tcpretrans # trace TCP retransmits
61 ./tcpretrans -l # include TLP attempts