When do I wait for a response confirmation when I have enough window size (transmit/receive buffer)?

Asked 2 years ago, Updated 2 years ago, 111 views

When sending approximately 24 KB of TCP data,

Despite the partner's window size of up to 49640 Byte (checked by Wireshark) 8KB transmission → 8KB transmission → 3KB response confirmation → +4KB response confirmation → +5KB response confirmation → 8KB transmission
It looks like this.
No other communication occurred during this time.

What are the possible reasons for not sending approximately 24 KB at once?

tcp

2022-09-30 11:35

3 Answers

TCP performs a control called TCP Slow Start to avoid congestion in the communication band.At first, it sends slowly, increasing the amount of data that is sent at once while the other party successfully receives the response confirmation, and decreasing the transmission when the response confirmation is not received.

If the data size is larger and hundreds of KB, the size of the 16KB transmission is doubled to 32KB after receipt of the response confirmation, and then doubled to 64KB at once.


2022-09-30 11:35

  • Small initial window size (initcwnd)
  • Small TCP transmit buffer size

How about around?


2022-09-30 11:35

8KB transmission → 8KB transmission → 3KB response confirmation → +4KB response confirmation → +5KB response confirmation → 8KB transmission

As far as this movement is concerned, isn't the Nagle algorithm working?
The Nagle algorithm behaves as follows:

■Nagle Algorithm Transmission Occurs (Excerpt from Wiki)
 Case 1. Unsent data is greater than or equal to the maximum segment size
 Case 2. No past transmitted packets have received an ACK (note TCP delay ACK)
 Case 3. Timeout

The first 2 consecutive 8KB transmissions are configured with a maximum segment size of 8KB and
I think it's because it's beyond that.
After that, I think it is because the unsent data is not more than the maximum segment size (waiting for an ACK response).
Regarding the transmit buffer, if you send() 24KB and its return value is 24KB,
Accepted as TCP transmission (not out of transmit buffers).

We recommend using TCP_NODELAY if you want to execute the data that should be sent immediately.
As a supplement, Nagle algorithm is very incompatible with delay ACK, so there are often problems such as loss of communication and delay.


2022-09-30 11:35

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.