tcpcong(8)
π tcpcong(8) β the manual page, but make it make sense β¨
okay bestie, so this is a page from the System Manager's Manual β it's tcpcong, and it's about to become your new fave little chaos-gremlin of a tool π¦
πΈ NAME πΈ
tcpcong β measure how long tcp sockets sit in each congestion state. it uses Linux eBPF/bcc, no cap π
β SYNOPSIS β
tcpcong [-h] [-T] [-L] [-R] [-u] [-d] [interval] [outputs]
π DESCRIPTION π
so this tool measures the congestion control status duration for tcp sockets, and then prints you a lil summary of how long tcp lingered in each congestion state, plus the total number of state changes. it's giving observability π
it works by dynamically tracing the kernel tcp congestion control status updating functions β which means, heads up, if the kernel changes, the tool will need to be updated to match. keep that in mind, fr fr.
the traced functions only get called when there's an actual congestion state update, so the overhead is lowkey tiny. they also use a BPF map to stash the traced data and keep the overhead down even more β peep the OVERHEAD section if you want the deets. and since this uses BPF, only the root user can use this tool π (sorry bestie, root only, no cap).
π«Ά REQUIREMENTS π«Ά
CONFIG_BPFbcc
that's it. that's the list. π
β¨ OPTIONS β¨
-hβ prints the usage message. your classic cry-for-help flag π-Tβ adds a timestamp column. time-stamped slay β°-Lβ specify a local tcp port range.-Rβ specify a remote tcp port range.-uβ output in microseconds.-dβ show the congestion status duration distribution as histograms. pretty little bars, iconic π
π₯ EXAMPLES π₯
show all tcp sockets congestion status duration until you hit Ctrl+C:
# tcpcongestdura
show all tcp sockets congestion status duration every 1 second, 10 times:
# tcpcong 1 10
show only local port 3000-3006 congestion status duration every 1 second:
# tcpcong -L 3000-3006 1
show only remote port 5000-5005 congestion status duration every 1 second:
# tcpcong -R 5000-5005 1
show 1 second summaries, printed in microseconds, with timestamps:
# tcpcong -uT 1
show all tcp sockets congestion status duration as histograms:
# tcpcong -d
π¦ FIELDS π¦
here's your decoder ring for the output columns, bestie π
LAddrPortβ local ip address and tcp socket port.RAddrPortβ remote ip address and tcp socket port.Open_usβ total duration in open status, in microseconds.Dod_usβ total duration in disorder status, in microseconds.Rcov_usβ total duration in recovery status, in microseconds.Cwr_usβ total duration in cwr status, in microseconds.Los_usβ total duration in loss status, in microseconds.Open_msβ total duration in open status, in milliseconds.Dod_msβ total duration in disorder status, in milliseconds.Rcov_msβ total duration in recovery status, in milliseconds.Cwr_msβ total duration in cwr status, in milliseconds.Loss_msβ total duration in loss status, in milliseconds.Chgsβ total number of status changes.usecsβ range of microseconds for this bucket.msecsβ range of milliseconds for this bucket.countβ number of congestion status in this time range.distributionβ ASCII representation of the distribution (thecountcolumn).
π§ OVERHEAD π§
this traces the kernel tcp congestion status change functions. the called rate per second of these functions per socket is low (<10000), so the overhead is expected to be negligible β like, genuinely nothing, iykyk.
but listen: if you've got an application that creates thousands of tcp connections, then test and understand the overhead before you use this. no impulsive production runs, babe π
π SOURCE π
this is from bcc.
https://github.com/iovisor/bcc
also go look in the bcc distribution for a companion _examples.txt file β it's got example usage, output, and commentary for this tool. free lore drop π
π OS π
Linux π§
π STABILITY π
Unstable β in development. it's in its experimental era, we respect it π
π AUTHOR π
jacky gan
π SEE ALSO π
tcpretrans(8), tcpconnect(8), tcptop(8), tcpdrop(8)
and that's the whole page, bestie π«Ά this lil beauty came out of the USER COMMANDS pile on 2022-01-27 β go forth, trace some congestion, and remember: root only, test your overhead, and hydrate πβ¨π
π¦ where this page comes from
- alpine 3.24: bcc-doc 0.36.1-r1 Β· Apache-2.0
- nixpkgs unstable: bcc 0.37.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms