Congestion Control in a Real Trace: Reading cwnd, Losses and Recovery
A complete packet capture of a six-megabyte TCP transfer, read event by event: slow start, an application pause, a loss burst repaired with SACK, a delay spike that causes a spurious timeout, and an outage with exponential backoff.
kvi5hnuCode Sprout team member17 min readOn this page
The last two articles described the congestion control algorithms one at a time. Real connections mix them: a single transfer can slow-start, pause, lose a burst of packets, hit a delay spike and survive an outage, all within seconds. This article reads one such transfer from a real packet capture, the way you would when debugging a slow connection. It shows what each event looks like in the capture, in the kernel's counters, and in the sender's cwnd.
The experiment
In the course lab, a client (192.0.2.10) sends 6 MB to a server (198.51.100.10) through the router r1:
- The bottleneck is 4 Mbit/s with a 40 KB queue, and the base RTT (round-trip time) is 30 ms. So the BDP (bandwidth-delay product, how much data fills the path) is 4,000,000 bit/s × 0.030 s = 120,000 bits = 15,000 bytes, about 10 segments of 1448 bytes.
- The sender is Linux with its default congestion control, CUBIC. Its segmentation offloads are turned off so that each packet in the capture is one TCP segment. Article 6 explains offloads, and the callout below says what you see when they're on.
tcpdumpcaptures at the sender, keeping 128 bytes of each packet (headers only), and a script samplescwndfromssat the same time.
The sending program writes 1 MB, pauses for one second, then writes 5 MB more. While it runs, a script makes four things happen at the router:
| Event | When | What the router does |
|---|---|---|
| 1 | about 2.2 s | Nothing: the application pauses for 1 second |
| 2 | about 5.5 s | For 150 ms, drops 20% of the client's packets (an nftables rule with numgen random) |
| 3 | about 9.0 s | Delays packets toward the client (the ACKs) by 1.2 s for 1.2 s |
| 4 | about 12.7 s | Drops every packet from the client for 1.5 s |
Here's the summary of the capture:
Packet size limit: inferred: 128 bytes
Number of packets: 7179
Data size: 6875 kB
Capture duration: 17.438951 seconds
Data byte rate: 394 kBps
The lines to note are the packet count (data and ACKs together) and the duration. The byte rate, about 394 kB per second, is averaged over the whole 17 seconds including the stalls, so it's below the 0.5 MB/s the bottleneck can carry.
And here's the whole transfer. The top panel is a time-sequence graph drawn from the capture: each blue dot is a data segment, plotted at the time it was sent and at its sequence number. The orange line is the highest byte acknowledged so far, and red circles are retransmissions. The bottom panel is cwnd over the same time axis.

In a time-sequence graph, the slope is the throughput: about 0.5 MB/s here, or 4 Mbit/s, the bottleneck rate. Flat stretches are times when nothing new was delivered, and red circles show where the sender had to repair something. Reading the graph left to right is the quickest way to find where a slow transfer lost its time.
The handshake: what was negotiated
The first three packets set up the options that the rest of the trace depends on:
1 0.000000 192.0.2.10 → 198.51.100.10 TCP 74 42000 → 6000 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM TSval=3372092383 TSecr=0 WS=1024
2 0.016573 198.51.100.10 → 192.0.2.10 TCP 74 6000 → 42000 [SYN, ACK] Seq=0 Ack=1 Win=65160 Len=0 MSS=1460 SACK_PERM TSval=1056745588 TSecr=3372092383 WS=1024
3 0.031989 192.0.2.10 → 198.51.100.10 TCP 66 42000 → 6000 [ACK] Seq=1 Ack=1 Win=64512 Len=0 TSval=3372092452 TSecr=1056745588
Both sides offered an MSS of 1460 (an MTU of 1500 minus 40 bytes of IPv4 and TCP headers), SACK_PERM (so SACK can be used), timestamps (TSval/TSecr), and a window scale of 1024 (WS=1024, a shift of 10). With timestamps, every segment carries 12 more bytes of options, so the data segments in this trace carry 1448 bytes, not 1460. SACK and timestamps both play a part in the recovery events below.
Slow start and the first losses
The connection begins in slow start, and cwnd climbs from 10 to about 53 segments in the first 0.2 seconds. The path holds only about 10 segments plus a 40 KB queue (about 28 segments), so, as in article 72, slow start overshoots, and the cluster of retransmissions near 0.3 seconds is the repair. After that, CUBIC settles into its cycle between about 25 and 37 segments.
Event 1: the application pauses
At about 2.2 seconds, the sending program stops writing for a second. Nothing is sent, the ACKs for the last data arrive, and the graph goes flat. This isn't a network problem. In a capture, a pause with nothing outstanding (the ACK line has caught up with the data) means the sender had nothing to send. A pause with data still unacknowledged would point to the network or the receiver instead.
When the application resumes at about 2.8 seconds, cwnd drops to 10. The idle time was longer than the RTO, so Linux restarted from the initial window (article 73 measured this rule on its own). ssthresh remembered the old window, so slow start took cwnd back to about 34 in a few round trips.
Event 2: a loss burst repaired with SACK
At about 5.5 seconds, the router drops a fifth of the client's packets for 150 ms. Here's the start of what the sender sees: ACKs arriving from the server (←), with any SACK blocks:
2800 5.508 ← ack=2332953
2803 5.511 ← ack=2335849
2806 5.519 ← ack=2338745
2807 5.521 ← ack=2338745 SACK 2340193-2341641 [Duplicate ACK (#1)]
2810 5.524 ← ack=2338745 SACK 2340193-2343089 [Duplicate ACK (#2)]
2813 5.527 ← ack=2338745 SACK 2340193-2344537 [Duplicate ACK (#3)]
Each line is: frame number, time in seconds, direction, the ACK number, and any SACK block as a start-end byte range the receiver holds. The bracketed label is Wireshark's analysis.
The ACK number stops advancing at 2338745: the segment starting there is lost. Every later segment that arrives produces a duplicate ACK with a SACK block reporting what the receiver has beyond the hole. The block grows by 1448 bytes each time. The next few milliseconds, with data the sender transmits (→) mixed in:
2814 5.532 ← ack=2338745 SACK 2340193-2345985 [Duplicate ACK (#4)]
2815 5.535 → seq=2373497 len=1448
2816 5.535 → seq=2374945 len=1448
2817 5.535 ← ack=2338745 SACK 2340193-2347433 [Duplicate ACK (#5)]
2818 5.536 → seq=2376393 len=1448
2819 5.539 ← ack=2338745 SACK 2340193-2348881 [Duplicate ACK (#6)]
2820 5.540 → seq=2377841 len=1448
2821 5.540 ← ack=2338745 SACK 2340193-2350329 [Duplicate ACK (#7)]
2822 5.542 → seq=2338745 len=1448 [This frame is a (suspected) fast retransmission,This frame is a (suspected) retransmission]
2823 5.544 ← ack=2338745 SACK 2351777-2353225 2340193-2350329 [Duplicate ACK (#8)]
2824 5.547 ← ack=2338745 SACK 2351777-2354673 2340193-2350329 [Duplicate ACK (#9)]
2825 5.548 → seq=2379289 len=1448
2826 5.551 → seq=2380737 len=1448
2827 5.551 ← ack=2338745 SACK 2351777-2356121 2340193-2350329 [Duplicate ACK (#10)]
2828 5.552 ← ack=2338745 SACK 2351777-2357569 2340193-2350329 [Duplicate ACK (#11)]
2829 5.556 → seq=2382185 len=1448
2830 5.556 ← ack=2338745 SACK 2351777-2359017 2340193-2350329 [Duplicate ACK (#12)]
2831 5.559 → seq=2350329 len=1448 [This frame is a (suspected) fast retransmission,This frame is a (suspected) retransmission]
2832 5.559 ← ack=2338745 SACK 2351777-2360465 2340193-2350329 [Duplicate ACK (#13)]
2833 5.562 ← ack=2338745 SACK 2351777-2361913 2340193-2350329 [Duplicate ACK (#14)]
2834 5.564 ← ack=2338745 SACK 2351777-2363361 2340193-2350329 [Duplicate ACK (#15)]
2835 5.566 → seq=2383633 len=1448
2836 5.568 → seq=2385081 len=1448
2837 5.568 ← ack=2338745 SACK 2351777-2364809 2340193-2350329 [Duplicate ACK (#16)]
Things to notice:
- The fast retransmission of 2338745 (frame 2822) doesn't come at the third duplicate ACK, but about 20 ms after the first. Linux detects loss with RACK (article 66): a segment is lost once a segment sent after it has been SACKed and a short reordering window has passed. That avoids retransmitting packets that were only reordered.
- A second hole appears. From frame 2823 on, the SACK option carries two blocks: 2340193 to 2350329, and a new block starting at 2351777. The 1448 bytes from 2350329 are missing too. The sender retransmits that segment in frame 2831 without waiting for another round trip. This is what SACK-based recovery buys, and what NewReno couldn't do.
- New data keeps flowing. Between retransmissions, the sender sends new segments (2373497, 2374945, …): roughly one for every couple of ACKs. That's Proportional Rate Reduction spreading the window reduction across the round trip.
In the cwnd panel, event 2 shows as a drop from about 26 to about 12 over a few hundred milliseconds. The burst caused losses in two successive windows, so CUBIC reduced twice (×0.7 each time). Then the cubic growth curve resumes.
Event 3: a delay spike and a spurious timeout
At about 9.0 seconds, the router starts holding back packets toward the client by 1.2 seconds. The data still gets to the server, but its ACKs take 1.2 seconds to return. From the sender's side, nothing comes back at all:
4641 9.528 → seq=4001049 len=1448 [This frame is a (suspected) retransmission]
4642 10.186 → seq=4001049 len=1448 [This frame is a (suspected) retransmission]
4643 10.186 ← ack=4003945
4644 10.189 ← ack=4005393
4645 10.194 ← ack=4008289
4646 10.200 ← ack=4011185
4649 10.208 ← ack=4014081
4652 10.213 ← ack=4016977
4655 10.218 ← ack=4019873
4656 10.223 ← ack=4021321
4661 10.228 ← ack=4024217
4664 10.234 ← ack=4027113
4666 10.239 ← ack=4030009
4667 10.240 ← ack=4064761
The sender's retransmission timer (about 500 ms at this point) fires first. Frame 4641 retransmits the oldest unacknowledged segment, 4001049. cwnd drops to 1 in the bottom panel: TCP assumes the worst. The single dot at about 9.2 seconds in the time-sequence graph, before the timeout, is a Tail Loss Probe: Linux sends one segment early, hoping to provoke an ACK, before falling back to a full timeout. Here the probe's ACK was delayed too.
The timer backs off and fires again at 10.186 (frame 4642). Then, at last, the delayed ACKs arrive in a rush (frames 4643 onward). They acknowledge data the sender originally sent, not its retransmissions: nothing had been lost. Linux recognizes this from the timestamps echoed in those ACKs, which belong to the original transmissions (the Eifel detection idea from article 67), and undoes the reduction. In the bottom panel, cwnd jumps from 1 back to about 38 at 10.2 seconds, instead of slow-starting from 1. The kernel counted it:
TcpRetransSegs 71 0.0
TcpExtTCPSackRecovery 10 0.0
TcpExtTCPFullUndo 0 0.0
TcpExtTCPLossUndo 1 0.0
TcpExtTCPTimeouts 5 0.0
TcpExtTCPLossProbes 2 0.0
TcpExtTCPDSACKRecv 0 0.0
TcpExtTCPSpuriousRTOs 0 0.0
TCPLossUndo is 1: one recovery episode was undone. Without undo, the connection would have spent many round trips slow-starting back up after a timeout that never needed to happen. The last ACK in the excerpt (4064761) also jumps far ahead in one step. It's a cumulative ACK covering everything the receiver had buffered while the ACKs were delayed. ACKs that cover more than two segments are called stretch ACKs. They also appear when receivers merge incoming segments (GRO, generic receive offload) or ACK less often.
Event 4: an outage and exponential backoff
At about 12.7 seconds, the router drops everything from the client for 1.5 seconds. This time packets really are lost. Here are all transmissions of the first segment that went missing:
5963 12.677 → seq=5246329 len=1448
6009 13.256 → seq=5246329 len=1448 [This frame is a (suspected) retransmission]
6010 13.896 → seq=5246329 len=1448 [This frame is a (suspected) retransmission]
6011 15.114 → seq=5246329 len=1448 [This frame is a (suspected) retransmission]
The original was sent at 12.677. The retransmissions follow at 13.256, 13.896 and 15.114, so the gaps between them are about 0.58, 0.64 and 1.22 seconds. Each retransmission doubles the timeout, which is exponential backoff (article 65). The first gap includes a Tail Loss Probe (the lone dot near 12.95 seconds) before the real timeout, and the 0.64 → 1.22 step is the clean doubling.

The outage ended at about 14.2 seconds, but the sender didn't find out until its next retransmission at 15.114, almost a second later. This is the cost of backoff: it's polite to a broken network, but it means TCP can stay silent for a while after a path recovers. After the ACK arrives, the sender retransmits the rest of the lost window quickly (the dense cluster of red circles), and cwnd slow-starts from 1, because this time the loss was real and nothing is undone.
Connection completion
When the program has written all 6 MB, it shuts down its side of the connection:
7168 17.374 42000 → 6000 [FIN, PSH, ACK] Seq=6290337 Ack=1 Win=64512 Len=1120 TSval=3372109789 TSecr=1056762924
7178 17.423 6000 → 42000 [FIN, ACK] Seq=1 Ack=6291458 Win=1291264 Len=0 TSval=1056762995 TSecr=3372109789
The client's last data segment carries the FIN flag (data and FIN together in one segment is common). The server acknowledges it, and closes its side with its own FIN in the same segment. As article 59 explains, the FIN uses one sequence number. The data ends at 6290337 + 1120 = 6291457, the FIN takes that number, and so the server acknowledges 6291458.
Over the whole transfer, the kernel counted 71 retransmitted segments, 10 SACK recoveries and 5 retransmission timeouts. The 5 timeouts are the two timer expirations in event 3 and the three in event 4.
How to read any capture like this
The same approach works for any slow TCP transfer:
- Plot the time-sequence graph. A straight line at the expected slope means the transfer was limited by the path, which is normal.
- Classify each flat stretch. If the ACK line has caught up with the data, the application or the receiver window was the limit. If data is outstanding and the ACKs have stopped, the path lost something or delayed it.
- Look at the retransmissions. Fast retransmissions with SACK blocks are routine and cheap. Retransmissions separated by doubling gaps are timeouts, and those are expensive.
- Check the counters.
nstat(ornetstat -son other systems) shows whether timeouts were spurious and undone, and whether recovery was SACK-based. - Look at
cwndif you can sample it.ss -tiduring the transfer shows whether the window was halving after losses or collapsing to 1.
Common questions
Why is the throughput slope steady even during the sawtooth?
The bottleneck stays busy as long as at least one BDP is in flight. Here the BDP is about 10 segments and cwnd stayed above 12 except around the timeouts, so the queue sometimes drained but the link didn't go idle.
How can I tell a timeout from a fast retransmission in a capture?
A fast retransmission follows a run of duplicate ACKs or SACK blocks, and usually happens within one RTT of the loss. A timeout follows a period with no ACKs at all, and repeated timeouts are spaced at doubling intervals. Wireshark labels fast retransmissions as "Fast Retransmission" and others as "Retransmission". Its "RTO" field shows the time since the original transmission.
Why does Wireshark say "suspected" retransmission?
Because it can only infer intent from sequence numbers. A segment with a sequence number it has already seen looks like a retransmission, but reordering in the network or a capture point that missed packets can produce the same pattern.
Where should I capture: at the sender or the receiver?
At the sender, you see what TCP decided and when, but you can't tell which packets were lost in the network: they all appear as sent. At the receiver, you see what actually arrived. For difficult problems, capture at both ends and compare.
Why didn't the sender detect the end of the outage sooner?
It had backed off its timer to more than a second, and nothing else prompts it to send. Exponential backoff protects a congested network from retransmission storms. The price is up to one backed-off RTO of extra silence after the path recovers.
Does the undo in event 3 mean timeouts are harmless?
No. The connection still stopped for over a second waiting for ACKs, and undo only avoided the extra cost of slow-starting afterward. A real spike like this, for example during a cellular handover, still hurts the application.
Summary
- A time-sequence graph shows a whole transfer at once: the slope is throughput, flat stretches are stalls, and red marks are repairs. Wireshark and
tsharkcan produce it from any capture. - The handshake fixes the options the rest depends on: MSS, SACK, timestamps, window scaling.
- An application pause has nothing outstanding. On resume, Linux restarts from the initial window after an idle period longer than the RTO.
- A loss burst produces duplicate ACKs with growing SACK blocks. Linux retransmits each hole (using RACK timing), keeps sending new data at a reduced rate (PRR), and CUBIC reduces the window by 0.7 per congestion event.
- A delay spike caused a timeout with nothing lost. Timestamps showed the ACKs were for the originals, and Linux undid the reduction (
TCPLossUndo). - A real outage produced retransmissions at doubling intervals and a slow start from 1, and the sender learned the path was back only at its next backed-off retransmission.
Practice questions
1. In a time-sequence graph, the data line climbs at 0.5 MB/s, then is flat for 2 seconds, with the ACK line flat at the same level as the data. What happened?
Answer
Everything sent had been acknowledged, and nothing new was sent. The sender had nothing to send (the application paused) or was blocked by a zero receive window. It wasn't network loss, which would leave unacknowledged data with the ACK line below it.
2. A duplicate ACK carries the SACK blocks 2351777–2353225 and 2340193–2350329, and its ACK number is 2338745. Which byte ranges is the receiver missing?
Answer
Everything below 2338745 has arrived. The receiver is missing 2338745–2340192 (before the first block) and 2350329–2351776 (between the two blocks). Data above 2353225 hasn't been reported yet, either because it hasn't arrived or because it hasn't been sent.
3. Retransmissions of one segment appear at 20.10, 20.62, 21.66 and 23.74 seconds. What is happening, and when would you expect the next one?
Answer
Repeated retransmission timeouts with exponential backoff: the gaps are about 0.52, 1.04 and 2.08 seconds, doubling each time. The next would come about 4.16 seconds later, at roughly 27.9 seconds, unless an ACK arrives first.
4. After a timeout, cwnd goes to 1 and then, a fraction of a second later, back to its old value without slow-starting. What did the sender conclude?
Answer
That the timeout was spurious: the ACKs that arrived were for the original transmissions (shown by timestamps, DSACK or F-RTO), so nothing had been lost. Linux undid the congestion window reduction. Check TCPLossUndo or TCPSpuriousRTOs in nstat.
5. Why do the data segments in this trace carry 1448 bytes, when both sides announced an MSS of 1460?
Answer
The timestamp option is in every segment and takes 12 bytes (10 bytes plus 2 bytes of padding). The MSS announced in the SYN doesn't account for options, so the actual payload is 1460 − 12 = 1448 bytes.
6. A capture at the sender shows a segment sent once and never retransmitted, but the receiver never got it. How is that possible?
Answer
It can't be a real loss that TCP recovered from, because TCP would have retransmitted it. Possibilities: the data was later covered by a different retransmission (segments can be repacketized, so a retransmission can start at a different sequence number), or the connection ended (reset or abort) before recovery. Also check that the capture didn't drop packets: tcpdump reports "packets dropped by kernel" when it falls behind.
Previous: Better Loss Recovery: NewReno, SACK-Based Recovery, PRR and Limited Transmit
Next: High-Speed TCP: CUBIC, Fairness and Sharing Congestion State

More in TCP/IP Course
Quiz: TCP/IP Delicate Details
Twenty-five questions on the details that catch out experienced engineers: sequence numbers for SYN and FIN, TIME_WAIT versus tcp_fin_timeout, Karn's algorithm, socket buffer doubling, even and odd ephemeral ports, IPv6 checksums and fragmentation, negative DNS caching, and capture filter traps.
Quiz: TCP/IP Interview Questions
Thirty-three networking questions of the kind asked in developer, SRE and network engineering interviews: what happens when you load a URL, TCP versus UDP, handshakes, closing and TIME_WAIT, subnetting, NAT, DNS, MTU problems, congestion, TLS and QUIC, and debugging slow or failing connections.
Quiz: TCP/IP Course Final Exam (All Parts)
The final exam for the TCP/IP course: thirty questions across all fourteen parts, from packets and addressing through Ethernet, ARP, IP, DHCP, NAT, ICMP, UDP, DNS, TCP connections, reliability, congestion control, security, QUIC and troubleshooting.
Quiz: Modern Transports and Troubleshooting (TCP/IP Part 14)
Review modern transports and troubleshooting: QUIC packets, handshakes, 0-RTT, streams and connection migration, HTTP/3, Multipath TCP, SCTP multihoming, and a layered method for diagnosing real network faults.
Discussion
Sign in to ask a question or share what you learned.