2010-03-24 10:53:12 delay in sockets
Filip Vanalme (BELGIUM)
Message: 87665
In my application, I measure a delay of about 2 ms between two consecutive socket writes (send() ). Monitoring with WireShark on the network, I notice that the delay between the two messages has increased to about 150 ms. Obviously, for some reason, the driver can't send the second message within some milliseconds. Any ideas why the increased delay ? Is there a way to speed up ?
(ethernet chip on our board is SMSC LAN 9117)
TranslateQuoteReplyEditDelete
2010-03-24 12:05:07 Re: delay in sockets
Filip Vanalme (BELGIUM)
Message: 87668
In my application, I measure a delay of about 2 ms between two consecutive socket writes (send() ). Monitoring with WireShark on the network, I notice that the delay between the two messages has increased to about 150 ms. Obviously, for some reason, the driver can't send the second message within some milliseconds. Any ideas why the increased delay ? Is there a way to speed up ?
(ethernet chip on our board is SMSC LAN 9117)
---
Further investigation of the network trace showed that the delay between the two messages is probably caused by a delayed reception of the tcp ack on the first message. Between the first message and the tcp ack on that message, there is already a delay of 150ms. Once that ack received, the next message is sent almost immediately.
TranslateQuoteReplyEditDelete
2010-03-24 12:43:43 Re: delay in sockets
Mike Frysinger (UNITED STATES)
Message: 87671
this is standard behavior of TCP afaik. if you *really* need low latency, there are things you can do, but that is an interface that shouldnt be abused ...
www.ibm.com/developerworks/linux/library/l-hisock.html
googling for low latency tcp turns up plenty of other pages too ...
QuoteReplyEditDelete
2010-03-25 06:12:23 Re: delay in sockets
Filip Vanalme (BELGIUM)
Message: 87688
On our board, I set the TCP_NODELAY option (with setsockopt()) and the delays disappeared.
I think a combination of elements cause these delays : 1)our pc-application that connects to our board is sending/receiving lots of small packets in a request-response way, 2) the Nagle algorithm in the driver on our board was active, and 3) delayed ACK's from the pc running the pc-application.
Setting the TCP_NODELAY option made part of our pc-application twice as fast as before (because packets from the board are coming faster).
I think this document describes well this phenomenon :
www.stuartcheshire.org/papers/NagledelayedAck