Brendan Gregg | afc9725 | 2016-02-19 16:07:36 -0800 | [diff] [blame^] | 1 | Demonstrations of tcpconnlat, the Linux eBPF/bcc version. |
| 2 | |
| 3 | |
| 4 | This tool traces the kernel function performing active TCP connections |
| 5 | (eg, via a connect() syscall), and shows the latency (time) for the connection |
| 6 | as measured locally: the time from SYN sent to the response packet. |
| 7 | For example: |
| 8 | |
| 9 | # ./tcpconnlat |
| 10 | PID COMM IP SADDR DADDR DPORT LAT(ms) |
| 11 | 1201 wget 4 10.153.223.157 23.23.100.231 80 1.65 |
| 12 | 1201 wget 4 10.153.223.157 23.23.100.231 443 1.60 |
| 13 | 1433 curl 4 10.153.223.157 104.20.25.153 80 0.75 |
| 14 | 1690 wget 4 10.153.223.157 66.220.156.68 80 1.10 |
| 15 | 1690 wget 4 10.153.223.157 66.220.156.68 443 0.95 |
| 16 | 1690 wget 4 10.153.223.157 66.220.156.68 443 0.99 |
| 17 | 2852 curl 4 10.153.223.157 23.101.17.61 80 250.86 |
| 18 | [...] |
| 19 | |
| 20 | The first line shows a connection from the "wget" process to the IPv4 |
| 21 | destination address 23.23.100.231, port 80. This took 1.65 milliseconds: the |
| 22 | time from the SYN to the response. |
| 23 | |
| 24 | TCP connection latency is a useful performance measure showing the time taken |
| 25 | to establish a connection. This typically involves kernel TCP/IP processing |
| 26 | and the network round trip time, and not application runtime. |
| 27 | |
| 28 | tcpconnlat measures the time from any connection to the response packet, even |
| 29 | if the response is a RST (port closed). |
| 30 | |
| 31 | |
| 32 | USAGE message: |
| 33 | |
| 34 | # ./tcpconnlat -h |
| 35 | usage: tcpconnlat [-h] [-t] [-p PID] |
| 36 | |
| 37 | Trace TCP connects and show connection latency |
| 38 | |
| 39 | optional arguments: |
| 40 | -h, --help show this help message and exit |
| 41 | -t, --timestamp include timestamp on output |
| 42 | -p PID, --pid PID trace this PID only |
| 43 | |
| 44 | examples: |
| 45 | ./tcpconnlat # trace all TCP connect()s |
| 46 | ./tcpconnlat -t # include timestamps |
| 47 | ./tcpconnlat -p 181 # only trace PID 181 |