[En-Nut-Discussion] TCP Sockets: Slower than expected response time.
Ulrich Hertlein
ulrich.hertlein at artcom.de
Wed Oct 11 18:01:51 CEST 2006
Josh Arnold wrote:
> We have an Ethernut implementation that talks to our own PC hosted GUI. We
> have been battling with slower than expected response times when
> passing/processing packets back to the GUI. The packets are typically small
> but lots of them.
>
> Our setup is NutOs running on an ATmega128 with a DM9000E controller.
>
> Here is an example data exchange.
> GUI Server(Ethernut)
> Send ASCII cmd------->
> <--------------------ACK cmd received(<1ms) Ok, this is good
> <--------------------PSH Data in response to CMD (99ms this too is
> slow)
> ACK Data received------>(200 ms after data received from server)
Are you sending your response packets in one chunk (one write call) or a
number of smaller ones? In the latter case it's possible you're hit by
'Nagles algorithm' http://en.wikipedia.org/wiki/Nagle's_Algorithm
It basically queues TCP packets for a small time until either a timeout
has expired or enough data is queued.
To work around this you could either collect your response data into a
single write or disable the algorithm using setsockopt TCP_NODELAY.
Hope this helps,
/Ulrich
--
Ulrich Hertlein | Software Development
ART+COM AG
Kleiststr. 23-26 | 10787 Berlin | Germany
phone: +49.30.21001-433
fax: +49.30.21001-555
http://www.artcom.de
More information about the En-Nut-Discussion
mailing list