tcp_sendq_trace.py monitors per-socket TCP send buffer utilization over time using the Linux ss command. It produces a CSV time series that lets you identify which client connections are slow (not reading data), causing the server's kernel send buffer to back up.
- Runs
ss -tinm state establishedat a configurable interval to capture all established TCP connections. - Parses each connection's Send-Q (bytes queued in the kernel send buffer waiting to be ACKed or read by the remote side) and snd_buf (
tbfield fromskmem) which is the kernel's current send buffer size. - Computes utilization as
Send-Q / snd_buf(0.0 = idle, 1.0 = buffer full). - Writes timestamped rows to a CSV file for offline analysis or graphing.