I have a pretty simple client/server application (TCP). 1 instance is sending 40 packets (smoothly distributed through 1 second) with around 1500 bytes data (part of data is timestamp). 2 instance is receiving these packets and sending back another packets with initial timestamp. Now in 1 instance I'm measuring difference between current timestamp and timestamp from packets. So I'm getting somekind of handmade-RTT. Also additionally I'm taking TCP RTT value for sockets with getsockopt and I see clearly:
My RTT showing me values around 1 ms (which is expected at such low rate of packets)
TCP RTT showing me ~40ms And I don't get it why. I know exactly that I'm receiving my packets early than 40 ms.
Also, If I will increase packets count from 40 to 600 for example, I will catch TCP RTT as ~150 mcs which is expected for my configuration.
Can anyone explain me this 40 ms from kernel side on low packets count?
Thank you
答案 0 :(得分:0)
40ms是Linux上的ACK延迟。这是正在发生的事情:
解决这个问题的方法可能非常好,但是我们需要对您的协议和您的实际要求有更多的了解,以便提出有用的建议。不要禁用Nagle。几乎总是最糟糕的“解决方案”。
答案 1 :(得分:0)
延迟确认包就是答案。您将得到的数据包更少。