blob: 996c21bbc70da57911db11424e57fdba2760b61b [file] [log] [blame]
dpayne7b7e34a2018-01-18 09:34:20 -08001.TH tcpconnlat 8 "2016-02-19" "USER COMMANDS"
Brendan Greggafc97252016-02-19 16:07:36 -08002.SH NAME
dpayne7b7e34a2018-01-18 09:34:20 -08003tcpconnlat \- Trace TCP active connection latency. Uses Linux eBPF/bcc.
Brendan Greggafc97252016-02-19 16:07:36 -08004.SH SYNOPSIS
dpaynefc507992018-01-18 14:09:28 -08005.B tcpconnlat [\-h] [\-t] [\-p PID] [-v] [min_ms]
Brendan Greggafc97252016-02-19 16:07:36 -08006.SH DESCRIPTION
7This tool traces active TCP connections
8(eg, via a connect() syscall), and shows the latency (time) for the connection
9as measured locally: the time from SYN sent to the response packet.
10This is a useful performance metric that typically spans kernel TCP/IP
11processing and the network round trip time (not application runtime).
12
13All connection attempts are traced, even if they ultimately fail (RST packet
14in response).
15
16This tool works by use of kernel dynamic tracing of TCP/IP functions, and will
17need updating to match any changes to these functions. This tool should be
18updated in the future to use static tracepoints, once they are available.
19
20Since this uses BPF, only the root user can use this tool.
21.SH REQUIREMENTS
22CONFIG_BPF and bcc.
23.SH OPTIONS
24.TP
25\-h
26Print usage message.
27.TP
28\-t
29Include a timestamp column.
30.TP
31\-p PID
32Trace this process ID only (filtered in-kernel).
dpayne7b7e34a2018-01-18 09:34:20 -080033.TP
dpayne7b7e34a2018-01-18 09:34:20 -080034\-v
35Print the resulting BPF program, for debugging purposes.
dpaynefc507992018-01-18 14:09:28 -080036.TP
dpayne8df98b72018-01-18 14:10:32 -080037min_ms
dpaynefc507992018-01-18 14:09:28 -080038Minimum duration to trace, in milliseconds.
Brendan Greggafc97252016-02-19 16:07:36 -080039.SH EXAMPLES
40.TP
41Trace all active TCP connections, and show connection latency (SYN->response round trip):
42#
dpayne7b7e34a2018-01-18 09:34:20 -080043.B tcpconnlat
Brendan Greggafc97252016-02-19 16:07:36 -080044.TP
45Include timestamps:
46#
dpayne7b7e34a2018-01-18 09:34:20 -080047.B tcpconnlat \-t
Brendan Greggafc97252016-02-19 16:07:36 -080048.TP
49Trace PID 181 only:
50#
dpayne7b7e34a2018-01-18 09:34:20 -080051.B tcpconnlat \-p 181
52.TP
53Trace connects with latency longer than 10 ms:
54#
dpaynefc507992018-01-18 14:09:28 -080055.B tcpconnlat 10
dpayne7b7e34a2018-01-18 09:34:20 -080056.TP
57Print the BPF program:
58#
59.B tcpconnlat \-v
Brendan Greggafc97252016-02-19 16:07:36 -080060.SH FIELDS
61.TP
62TIME(s)
63Time of the response packet, in seconds.
64.TP
65PID
66Process ID that initiated the connection.
67.TP
68COMM
69Process name that initiated the connection.
70.TP
71IP
72IP address family (4 or 6).
73.TP
74SADDR
Mark Drayton11de2982016-06-26 21:14:44 +010075Source IP address.
Brendan Greggafc97252016-02-19 16:07:36 -080076.TP
77DADDR
Mark Drayton11de2982016-06-26 21:14:44 +010078Destination IP address.
Brendan Greggafc97252016-02-19 16:07:36 -080079.TP
80DPORT
81Destination port
82.TP
83LAT(ms)
84The time from when a TCP connect was issued (measured in-kernel) to when a
85response packet was received for this connection (can be SYN,ACK, or RST, etc).
86This time spans kernel to kernel latency, involving kernel TCP/IP processing
87and the network round trip in between. This typically does not include
88time spent by the application processing the new connection.
89.SH OVERHEAD
90This traces the kernel tcp_v[46]_connect functions and prints output for each
91event. As the rate of this is generally expected to be low (< 1000/s), the
92overhead is also expected to be negligible. If you have an application that
93is calling a high rate of connects()s, such as a proxy server, then test and
94understand this overhead before use.
95.SH SOURCE
96This is from bcc.
97.IP
98https://github.com/iovisor/bcc
99.PP
100Also look in the bcc distribution for a companion _examples.txt file containing
101example usage, output, and commentary for this tool.
102.SH OS
103Linux
104.SH STABILITY
105Unstable - in development.
106.SH AUTHOR
107Brendan Gregg
108.SH SEE ALSO
109tcpconnect(8), tcpaccept(8), funccount(8), tcpdump(8)