tcpcong(8)
π tcpcong(8) π
β¨ NAME β¨
okay so tcpcong is the tool that measures how long TCP sockets hang out in each congestion control state π
It's built on Linux eBPF/bcc, so it's giving low-level energy π₯
π SYNOPSIS π
tcpcong [-h] [-T] [-L] [-R] [-u] [-d] [interval] [outputs]
π¦ DESCRIPTION π¦
bestie, this tool tracks how long TCP sockets spend in each congestion control status, then prints a summary of those durations plus the total number of state changes. β¨ Main character energy, fr fr.
It works by dynamically tracing the kernel functions that update TCP congestion control status. Those functions can change between kernel versions, so this tool will need updating to match kernel changes π
The traced functions only fire when the congestion state actually updates, so the overhead is lowkey tiny π«Ά It also stores the traced data in a BPF map to keep things light. Check the OVERHEAD section for the full tea β And since this runs on BPF, only the root user can use it π
π§© REQUIREMENTS π§©
You need CONFIG_BPF enabled in your kernel, plus bcc installed πΈ
π OPTIONS π
-hβ Pulls up the usage message π-Tβ Adds a timestamp column π°οΈ-Lβ Lets you pick a local TCP port range π―-Rβ Lets you pick a remote TCP port range π-uβ Prints everything in microseconds π¬-dβ Shows the congestion status duration distribution as histograms π
π EXAMPLES π
Show all TCP sockets' congestion status durations until you hit Ctrl-C π
# tcpcongestdura
Show all TCP sockets' congestion status durations every 1 second, 10 times π
# tcpcong 1 10
Show only local ports 3000-3006 every 1 second π―
# tcpcong -L 3000-3006 1
Show only remote ports 5000-5005 every 1 second π
# tcpcong -R 5000-5005 1
Show 1 second summaries in microseconds, with timestamps β±οΈ
# tcpcong -uT 1
Show all TCP sockets' congestion status durations as histograms π
# tcpcong -d
π FIELDS π
LAddrPortβ the local IP address and TCP socket port πRAddrPortβ the remote IP address and TCP socket port πOpen_usβ total time spent in the open status, in microseconds πDod_usβ total time spent in the disorder status, in microseconds πRcov_usβ total time spent in the recovery status, in microseconds π©ΉCwr_usβ total time spent in the cwr status, in microseconds πLos_usβ total time spent in the loss status, in microseconds πOpen_msβ total time spent in the open status, in milliseconds πDod_msβ total time spent in the disorder status, in milliseconds πRcov_msβ total time spent in the recovery status, in milliseconds π©ΉCwr_msβ total time spent in the cwr status, in milliseconds πLoss_msβ total time spent in the loss status, in milliseconds πChgsβ total number of status changes πusecsβ the microsecond range for this bucket π¬msecsβ the millisecond range for this bucket β³countβ how many congestion statuses landed in this time range π’distributionβ an ASCII picture of the distribution (based on the count column) π
π OVERHEAD π
This traces the kernel's TCP congestion status change functions. Those functions get called at a low rate per socket (under 10000 calls per second), so the overhead is expected to be negligible π«§
β οΈ If your app is going to create thousands of TCP connections, test it and understand the overhead before you use this tool in production, bestie π
π SOURCE π
This comes from bcc π
https://github.com/iovisor/bcc
Also check out the companion _examples.txt file in the bcc distribution. It has example usage, output, and commentary for this tool π
π» OS π»
Linux π§
π§ͺ STABILITY π§ͺ
Unstable β it's still in development π§
π©βπ» AUTHOR π©βπ»
jacky gan π
π SEE ALSO π
tcpretrans(8), tcpconnect(8), tcptop(8), tcpdrop(8) π§
πΈ That's the tea, bestie: tcpcong(8) from the USER COMMANDS section, dated 2022-01-27 π
π¦ where this page comes from
- debian bookworm: bpfcc-tools 0.26.0+ds-1 Β· Apache-2.0
- debian trixie: bpfcc-tools 0.31.0+ds-7 Β· Apache-2.0
- ubuntu noble: bpfcc-tools 0.29.1+ds-1ubuntu7 Β· Apache-2.0
- ubuntu questing: bpfcc-tools 0.31.0+ds-7ubuntu2 Β· Apache-2.0
- ubuntu resolute: bpfcc-tools 0.35.0+ds-1ubuntu2 Β· Apache-2.0
- ubuntu stonking: bpfcc-tools 0.35.0+ds-1ubuntu4 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms