lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Optimizing TCP writes


From: Jonathan Larmour
Subject: Re: [lwip-users] Optimizing TCP writes
Date: Wed, 05 Mar 2008 14:10:35 +0000
User-agent: Thunderbird 1.5.0.12 (X11/20070530)

Bill Auerbach wrote:
> 
> Is there a way to call tcp_write and defer the output?  I know I have
> several small chunks of data going out and each is sent separately with
> tcp_write.  If I can get lwIP to build the outgoing segment list and
> send them all at once performance would improve a lot.

That's intrinsic to tcp_write. tcp_write only enqueues. It needs tcp_output
to actually send anything (possibly called via tcp_output_nagle as you
notice below...)

> I noticed in a couple of places after a tcp_write, there is a use of the
> macro tcp_output_nagle.  If we use our own raw connection handling,
> should our code be using this after tcp_write also?  Just for reference,
> is there a reason tcp_write (maybe with a test as to when) doesn’t use
> tcp_output_nagle directly?

Precisely to allow a number of separate writes to be enqueued and then sent
all at once. From the comment preceding tcp_write in tcp_out.c:
" * Write data for sending (but does not send it immediately).
 *
 * It waits in the expectation of more data being sent soon (as
 * it can send them more efficiently by combining them together).
 * To prompt the system to send data now, call tcp_output() after
 * calling tcp_write().
"

You can call tcp_output directly yourself, or you can call tcp_output_nagle
to use the Nagle algorithm, which is usually recommended for a variety of
reasons. http://en.wikipedia.org/wiki/Nagle's_algorithm

Jifl
-- 
eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["Si fractum non sit, noli id reficere"]------       Opinions==mine




reply via email to

[Prev in Thread] Current Thread [Next in Thread]