Application latency on a busy API host has crept up, p99 doubled, but CPU is flat and the database is fine. The on-call engineer runs ss -tin and sees retrans:84/19200 on dozens of sockets. That number alone tells you very little — TCP retransmits are a symptom, not a root cause, and there are at least four distinct mechanisms that produce them. This runbook walks the layered diagnosis so the actual upstream cause is identified, not papered over with a kernel knob.
How to verify
# Cumulative retransmit counters since boot
nstat -az TcpRetransSegs TcpExtTCPLostRetransmit TcpExtTCPFastRetrans TcpExtTCPSlowStartRetrans
# Per-socket retransmit and RTO state
ss -tin state established | awk '/retrans/ {print}'
# Sampled deltas — most operationally useful number
nstat -s 1 TcpRetransSegs
# Per-CPU dropwatch (kernel free_skb call sites)
sudo dropwatch -l kas
A retransmit rate above roughly 0.5% of TcpOutSegs on a healthy local network is abnormal. Across the public internet 1-2% is plausible; above that, something is wrong.
What’s happening
A TCP retransmit fires for one of four reasons, and the kernel exposes each one as a separate counter under /proc/net/netstat:
- TCPFastRetrans — three duplicate ACKs triggered the fast retransmit path. Implies a single packet was lost mid-stream; the receiver kept ACKing the last in-order byte. Common cause: a single dropped frame on a congested switch port.
- TCPSlowStartRetrans — retransmit during slow start, usually because the initial window was set high and the path can’t absorb it.
- TcpExtTCPLossProbes (TLP) — the receiver didn’t ACK at all and the kernel’s RACK loss-probe timer fired. Implies a tail-loss pattern: last few packets of a burst lost.
- TcpExtTCPSpuriousRTOs / TCPDSACKRecv — an RTO fired but the data was actually delivered; the receiver later sent a D-SACK indicating duplicate receipt. Classic sign of an RTO too aggressive for the actual path RTT, or a switch reordering packets.
The mental model: retransmits cluster around one of three patterns — single-packet loss on one path, tail-loss on bursty paths, or reordering misclassified as loss. Each maps to a different fix.
The procedure
-
Establish the baseline rate. Run
nstat -s 1 TcpRetransSegs TcpOutSegsfor 60 seconds and compute retrans ÷ outsegs. If the ratio is<=0.5%, the symptom is below the noise floor — chase something else. -
Decompose the retransmit type. Sample the named counters every 5 seconds:
while sleep 5; do nstat -az TcpExtTCPFastRetrans TcpExtTCPSlowStartRetrans \ TcpExtTCPLossProbes TcpExtTCPSpuriousRTOs TcpExtTCPDSACKRecv \ TcpExtTCPSACKReorder | awk '{print $1, $2}' echo "---" doneIf
TCPFastRetransdominates, you have mid-stream loss on a real path. IfTCPLossProbesdominates, tail-loss — typically a small flow whose last packets fell off. IfTCPDSACKRecvandTCPSACKReorderare climbing together, packets are being delivered out of order and TCP is misreading reordering as loss. -
Isolate the talking peers. A path problem is rarely uniform across all peers:
ss -tin state established | \ awk '/retrans/ {match($0, /[0-9.]+:[0-9]+/); print substr($0, RSTART, RLENGTH)}' | \ sort | uniq -c | sort -rn | head -20If 90% of retransmits land on one peer, the problem is in that path. If retransmits are uniformly spread, the problem is local — NIC, driver, qdisc, kernel.
-
Capture a real packet trace for one bad peer. Pick the worst offender from step 3 and run a focused capture:
sudo tcpdump -i any -w /var/tmp/retrans-$(date +%s).pcap \ -s 96 -G 30 -W 1 host <peer-ip> and tcpOpen in Wireshark. The Expert Info → Warning panel will summarize Retransmissions, Duplicate ACKs, Out-of-Order. Filter
tcp.analysis.retransmissionand look at the gaps between original and retransmit. Gap<= 2 * RTTmeans fast retransmit; gap > RTO (often 200ms-1s) means an RTO timeout. -
Eliminate the local NIC. Before blaming the network, rule out the host:
ethtool -S eth0 | grep -E 'drop|err|fifo|miss' cat /proc/net/softnet_stat # column 2 = drops, column 3 = squeezes tc -s qdisc show dev eth0 # qdisc-level dropsAny non-zero
rx_missed_errors,rx_fifo_errors, or growing softnet drops means the host can’t drain packets fast enough — the retransmits are loss the kernel inflicted on itself, and tuning the network won’t fix it. -
Apply the targeted change. Based on the dominant retransmit type:
- Fast retransmits to one peer → engage the network team with the pcap, switch counters, link error rates.
- Tail-loss with TLP firing → enable BBR (
net.ipv4.tcp_congestion_control=bbr) and verifynet.ipv4.tcp_notsent_lowat=131072to reduce queue-induced loss. - Reordering misclassified as loss → check for LACP misconfiguration on the upstream switch, or a multipath route where two paths have different RTTs.
cat /proc/sys/net/ipv4/tcp_reorderingdefaults to 3; do not raise this without evidence. - Local NIC drops → raise
net.core.netdev_max_backlog,ethtool -G eth0 rx 4096, pin RX queues to CPUs withset_irq_affinity.
Common pitfalls
- Treating retransmits as a single number. Headline
TcpRetransSegsaggregates four different causes. Without decomposing the counters, every fix is a guess. - Enabling BBR because it’s newer. BBR is excellent for bandwidth-delay-product paths with shallow buffers; it is not a fix for reordering or NIC drops. Wrong tool for those problems.
- Capturing on
anyand trusting the timestamps.tcpdump -i anytimestamps after the kernel has already buffered the packet — a fast retransmit can look like an RTO. For accurate gap measurement, capture on the actual ingress interface. - Ignoring
tcp_sack=0legacy hosts. If SACK is disabled (rare in modern kernels but seen on appliances) the kernel falls back to NewReno and retransmits balloon. Confirmcat /proc/sys/net/ipv4/tcp_sackis1. - Treating SpuriousRTOs as harmless. They aren’t — spurious RTOs collapse the congestion window to 1 MSS and the connection has to slow-start back up. A handful per minute is fine; hundreds means the RTO estimate is broken (path RTT spiking past the smoothed estimate).
Stack Harbor runs these decomposed retransmit dashboards across every customer host fleet, so when an application owner reports tail-latency we already know whether it’s a single-path issue, a NIC saturation problem, or a reordering pattern in their upstream — no exploratory week of packet captures required. See our managed operations service for how the standing instrumentation is wired.