1. Home
  2. Explore
  3. Computer Science
  4. TCP Receive and Congestion Windows

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

TCP Receive and Congestion Windows

Speaker 1Speaker 2

TCP Receive and Congestion Windows

11:11
0:00-11:11
  1. Corey

    Welcome back to part two. Let’s talk TCP windows. There are two different limits to keep straight: the receive window and the congestion window. The number advertised in a TCP packet is the receive window. It tells the sender how much data the receiver can currently accept.

  2. Anna

    So it’s the receiver saying, “Don’t send me more than this much at once.” I like the bucket analogy: the sender can pour data down the pipe, but the receiver needs a bucket big enough to catch it.

  3. Corey

    Exactly. If the sender pours a five-gallon bucket into a pipe but the receiver has only a thimble, data can’t keep flowing as if there were no limit. The receiver’s available space is its receive window. In a real network, the receiver’s capacity is only one constraint: the path has limits too, including bandwidth, latency, packet loss, congestion, and buffers that can fill.

  4. Anna

    And the endpoints have limits of their own. The receiving application might not take data out of the TCP buffer quickly, while the sender may also limit how much it puts on the wire. That sender-side limit is the congestion window.

  5. Corey

    Right. The congestion window is not advertised in packet headers, so you can’t just inspect a packet and read it off. It represents how much the sender is willing to have outstanding before it receives acknowledgments. At any given time, the smaller of the receive window and congestion window limits how much data can be sent.

  6. Anna

    Let’s make that concrete. If the sender can put out ten gallons but the receiver can accept only eight ounces, the receiver’s limit wins. If the receiver can accept five gallons but the sender is currently willing to put out only eight ounces, the sender’s limit wins.

  7. Corey

    That distinction helped explain a database-backup problem. Two servers were gigabit-connected, on the same switch, in the same data center, yet a backup that should have taken far less time was running through the night. The first instinct was to upgrade the links to ten gigabit, but they captured packets before changing the infrastructure.

  8. Anna

    And the trace showed bursts of fast data followed by repeated pauses. A delay of around nineteen or twenty milliseconds might not sound serious once, but if it happens again and again, those small waits can add up.

  9. Corey

    Exactly. Sorting the packet time gaps showed that the pauses weren’t just a one-off. To find out why, the key was to inspect the receive-window values in the direction of the data transfer. The sender’s advertised window wasn’t the important one there; the receiver’s was.

  10. Anna

    The receiver initially advertised a window of 65,535 bytes. As it acknowledged incoming data, its advertised window got smaller. That makes sense: data was filling the receive buffer, and the application wasn’t clearing it out quickly enough.

  11. Corey

    Yes. The sender kept sending full-size segments, each carrying about 1,460 bytes. As those bytes filled the buffer, the advertised window shrank. Eventually there was room for only about 2,299 more bytes—less than two full-size segments. The sender sent one more full-size packet, then had to wait because another full segment wouldn’t fit.

  12. Anna

    Then the receiver acknowledged again with a full 65,535-byte window. That was the sign that its buffer had been cleared, so data could flow again. In this trace, the pause was about twenty milliseconds.

  13. Corey

    And the pattern repeated. Whenever the receive window dropped below the size needed for another full segment, the sender paused until space opened up. The client was not necessarily reporting a zero window—it still had some room—but it was running out of useful space often enough to stall the transfer.

  14. Anna

    So would a faster link have fixed it? Not if the receiver’s application still wasn’t taking data out of the TCP buffer fast enough. A larger receive buffer, perhaps enabled through window scaling, might postpone the stalls, but the buffer could still fill. The underlying issue was that the application wasn’t draining it quickly enough.

  15. Corey

    That’s the important diagnostic lesson: don’t assume a slow transfer is a bandwidth problem. In this case, the trace pointed to the receiving side. The team could investigate receive-side settings or work with the application vendor; changing to a different backup method was ultimately what made the problem go away.

  16. Anna

    Wireshark’s TCP time-sequence graph makes that behavior easier to see once you understand the packets. The horizontal axis is time, and the vertical axis is sequence number—so it represents progress through the data.

  17. Corey

    A smoothly rising line suggests data is moving continuously. Steps or flat stretches indicate pauses that are worth investigating. The graph also shows acknowledged data and the receiver’s advertised window. In the backup trace, the window line stopped advancing while data kept arriving; the data caught up to that limit, and then the sender paused.

  18. Anna

    When the window line moved up again, the sender resumed. So the graph’s repeated pattern—window opens, data flows, window fills, pause—matches the receive-window values we saw in the packets.

  19. Corey

    Now let’s turn to the other limit: the congestion window. The sender doesn’t know in advance how much the network path can handle. It can’t simply start by firing data at the maximum speed of its network card, because the full path to the receiver might not have that capacity.

  20. Anna

    So TCP has to probe the path. The congestion window is a sender-side limit, generally expressed as a multiple of the maximum segment size. The sender’s aim is to use the path efficiently without overwhelming it.

  21. Corey

    Many TCP stacks begin with slow start. The initial amount varies, but imagine it begins at two maximum-sized segments. The sender sends two, waits for acknowledgments, then might send four, then eight. It increases the amount rapidly as acknowledgments show that data is getting through.

  22. Anna

    That rapid growth doesn’t continue forever. When the sender reaches its slow-start threshold, it moves into congestion avoidance and increases more cautiously. The exact behavior depends on the TCP algorithm in use, but the shared idea is to discover how much the path can carry.

  23. Corey

    And the sender doesn’t announce its congestion-window value in the packet. You infer its behavior from the trace. In one example, the round-trip time was about ninety milliseconds. The server sent a small initial group of full-size packets, waited for acknowledgments, and then increased the number it sent in later rounds.

  24. Anna

    The trace graph showed that ramp-up. The sender kept space between the data and the receiver’s window limit, so the receiver’s buffer wasn’t causing those pauses. The roughly regular gaps in the graph matched the network’s round-trip time while the sender waited for acknowledgments.

  25. Corey

    Eventually the amount of data being sent became more consistent, suggesting the sender had reached a threshold and was limiting itself. That pattern needs context: it could reflect the sender’s congestion control, but if an application isn’t giving TCP enough data to send, the apparent limit could also come from the application.

  26. Anna

    And if the sender encounters retransmissions, that’s evidence it may have pushed too hard for the path. TCP can reduce its congestion window, then send less aggressively to avoid adding to congestion.

  27. Corey

    There’s another useful Wireshark distinction when you’re searching for pauses. Delta time measures the time since the previous packet in the capture. If the capture contains many conversations, the previous packet may belong to a completely different TCP connection.

  28. Anna

    So sorting by Delta time across a busy capture can be misleading. You could follow each TCP stream or apply a conversation filter, but doing that manually for every connection would be tedious.

  29. Corey

    Instead, you can use the time since the previous frame in the same TCP stream. If Wireshark doesn’t show TCP timestamps in the packet details, right-click the TCP header, open Protocol Preferences, and enable calculation of conversation timestamps. Then you can create a column for time since the previous frame in that TCP stream and sort by it.

  30. Anna

    When you sort, don’t mistake every large number for a performance problem. Values around familiar boundaries—such as 45 or 60 seconds, or a minute and a half—may reflect keepalives, timeouts, or resets. Look at what the packet is doing and which direction it travels.

  31. Corey

    That direction matters. In a database example, the complaint was that a request took too long to get a response. A long gap before the client sends another request could be client think time. A long gap between a request and the server’s response is much more relevant to a report of a slow server response.

  32. Anna

    Once the gap was found in the per-stream timing column, filtering that conversation and inspecting it showed a request followed by a response about twenty-four seconds later. That matched the reported delay, and helped identify which request had taken so long.

  33. Corey

    One final case shows why it helps to compare captures from both ends. A client could eventually download a file from an LDAP server, but each new attempt began with a twenty-to-thirty-second delay. In the client-side trace, the handshake completed quickly, and the client sent its search request.

  34. Anna

    The server’s first response packet appeared to be missing a segment. The client acknowledged data up to an earlier sequence number and used selective acknowledgment to indicate that it had received a later, smaller piece—but not the full-size segment before it.

  35. Corey

    From the server-side capture, we could see what followed. The server sent a full-sized segment, but it didn’t get acknowledged. At the beginning of a connection, the retransmission timer in this trace was about three seconds. The server waited, retransmitted, and then doubled its wait—about six seconds, then twelve—because it still wasn’t getting a response.

  36. Anna

    It couldn’t use fast retransmission because it hadn’t received the three duplicate acknowledgments needed to trigger it. Eventually, the server tried sending the data in a much smaller segment, 536 bytes, and that one was acknowledged.

  37. Corey

    That smaller segment was a clue. The client’s SYN advertised an MSS of 1,460 bytes, and the server’s SYN-ACK did too. But a router on the path had adjusted the MSS in transit: the client saw 1,432 in the SYN-ACK, and the server’s larger segments weren’t making it through successfully.

  38. Anna

    The router had recently been replaced. It was meant to reduce the MSS to leave room for other processing on the path, but that adjustment had been forgotten. A full 1,460-byte payload plus the TCP and IP headers reaches a 1,500-byte packet, so the larger size left no extra room for that path.

  39. Corey

    Once the outbound router was configured to clamp the MSS to 1,432, the endpoints used a size that could pass through. The delay had come from early packet loss and repeated retransmission timeouts—not from the application simply taking twenty seconds to answer.

  40. Anna

    So the big picture is: the receive window tells you how much the receiver can accept; the congestion window tells you how much the sender is willing to put in flight. The smaller limit governs transmission, and packet timing, acknowledgments, and sequence graphs help you work out which side or network condition is holding things up.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent