tcptop(8)
β¨ tcptop(8) β NAME β¨
okay so tcptop is literally top, but for TCP π It summarizes TCP send/recv throughput by host. Top for TCP. iconic. π
πΈ SYNOPSIS πΈ
tcptop [-h] [-C] [-S] [-p PID] [--cgroupmap MAPPATH]
[--mntnsmap MAPPATH] [interval] [count] [-4 | -6]
π DESCRIPTION π
bestie, this is top for TCP sessions π¦
It summarizes TCP send/receive Kbytes by host and prints a summary that refreshes, along with other system-wide metrics. main character energy β¨
This uses dynamic tracing of kernel TCP send/receive functions, so it will need to be updated to match kernel changes. ngl that's a little bit of a chore π
The traced TCP functions are usually called at a lower rate than per-packet functions, so they have lower overhead π«Ά The traced data is summarized in-kernel using a BPF map to reduce overhead even more. At very high TCP event rates the overhead may still be measurable, so check the OVERHEAD section for the tea β
Since this uses BPF, only the root user can use this tool. π₯ not me trying to run it as a normal user π
π REQUIREMENTS π
You need CONFIG_BPF and bcc. π§
β¨ OPTIONS β¨
-hβ print the USAGE message π-Cβ don't clear the screen π-Sβ don't print the system summary line (the load averages) π-p PIDβ trace this PID only π―--cgroupmap MAPPATHβ trace cgroups in this BPF map only (filtered in-kernel) π«§--mntnsmap MAPPATHβ trace mount namespaces in this BPF map only (filtered in-kernel) π¦- interval β interval between updates, in seconds (default
1) β±οΈ - count β number of interval summaries (default is many) π«
-4β trace the IPv4 family only π·-6β trace the IPv6 family only πΊ
π EXAMPLES π
Summarize TCP throughput by active sessions, 1 second refresh:
# tcptop
Don't clear the screen (rolling output), and 5 second summaries:
# tcptop -C 5
Trace PID 181 only, and don't clear the screen:
# tcptop -Cp 181
Trace a set of cgroups only (see special_filtering.md from the bcc sources for more details):
# tcptop --cgroupmap /sys/fs/bpf/test01
Trace IPv4 family only:
# tcptop -4
Trace IPv6 family only:
# tcptop -6
π¦ FIELDS π¦
- loadavg β the contents of
/proc/loadavgπ - PID β process ID π
- COMM β process name π·οΈ
- LADDR β local address (IPv4), and TCP port π
- RADDR β remote address (IPv4), and TCP port π
- LADDR6 β source address (IPv6), and TCP port π‘
- RADDR6 β destination address (IPv6), and TCP port πΊοΈ
- RX_KB β received Kbytes π₯
- TX_KB β transmitted Kbytes π€
π OVERHEAD π
This traces all sends/receives in TCP, high up in the TCP/IP stack (close to the application). Those are usually called at a lower rate than per-packet functions, which keeps overhead low. It also summarizes data in-kernel to shave off even more overhead. These techniques help, but there may still be measurable overhead at high send/receive rates, eg, ~13% of one CPU at 100k events/sec. Use funccount to count the kprobes in the tool to find out this rate, since the overhead is relative to the rate. Some sample production servers tested found total TCP event rates of 4k to 15k per second, and the CPU overhead at those rates ranged from 0.5% to 2.0% of one CPU. If your send/receive rate is low (eg, <1000/sec) then the overhead is expected to be negligible. Test in a lab environment first! π§ͺ
π SOURCE π
This is from bcc.
https://github.com/iovisor/bcc
Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool π
π«Ά OS π«Ά
Linux π§
π₯ STABILITY π₯
Unstable, still in development π§
π AUTHOR π
Brendan Gregg π
π§ INSPIRATION π§
top(1) by William LeFebvre π
β SEE ALSO β
tcpconnect(8), tcpaccept(8) π―
ttyl, the manual is cooked π³ this has been USER COMMANDS, bcc's tcptop(8) page, dated 2020-03-08 π slay forever π
π¦ where this page comes from
- alpine 3.24: bcc-doc 0.36.1-r1 Β· Apache-2.0
- nixpkgs unstable: bcc 0.37.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms