I'm observing the below behavor in a TCP connection between a server application and a client which run on two different Red Hat machines.
Example 1
- Client acks everything until now (ACK with WND = 1424)
- Server sends 296 bytes to TCP layer and it is sent to the client(PUSH/ACK)
- Server sends 296 bytes to TCP layer and it is sent to the client(PUSH/ACK)
- Server sends 296 bytes to TCP layer and it is sent to the client(PUSH/ACK)
- Server sends/tries to send 239 bytes to TCP layer but: either one of the following two happens
- the OS waits ~30ms until ACK from client is received before sending these bytes (this x bytes send will be referred as delayed message below)
- the tcp send call returns EWOULDBLOUCK or EAGAIN (I think this is not possible because 239+239+239+239 < 1424. Please correct me if I'm wrong
Example 2
- Client acks everything until now (ACK with WND=1424)
- Server sends 239 bytes to TCP layer and it is sent to the client
- Server sends/tries to send 239 bytes to TCP layer and one of the two things in the above happens
The problem I want to understand is why the server application or the OS waits until the ACK when window size for the client is big enough? Is this something I can tune in the OS level. Can I force server to send all bytes until the window of the client is filled?
As per my understanding there are two possible reasons
- Server application does not pass the 'delayed message' to TCP level becuase the send system call returned EWOULDBLOUCK or EAGAIN.
- Application does pass the message to TCP layer, but the operating system does not send it until an ACK from the client is received.
In all the delayed message scenarios, there is an ACK from the client before the SEND of the delayed message. Also the working logic of the application suggests that it does pass the message to the TCP layer.
Can you please suggest where I should focus on the troubleshooting of this.
- Is it some OS level setting I can set in either the client or server side
- Is this somehow a fault in the application server?
- Am I wrong in assuming OS doesn't return EWOULDBLOCK until messages fill up the window
edit: Reason for duplicate: I was not sure where the issue is; network/os. I have added aditional details. Also, I need a POV from TCP implementation of linux so I think this question belongs here.