lkml.org 
[lkml]   [1999]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: sendfile()
From
Date
jgmyers@netscape.com (John Myers) writes:

> Ingo Molnar wrote:
> > one reason we made syscalls so lightweight is to avoid silly
> > 'multi-purpose' conglomerate system calls like NT has. sendfile() has
> > mainly not been added to avoid system calls being done, but because it's
> > strong (and unique) conceptual foundations. Linux syscalls will be even
> > more lightweight in the future. (i have a prototype patch that makes them
> > cost 0.30 microseconds) Do you see the point, again an apples to oranges
> > problem.
>
> System-call overhead is not the problem with omitting a header argument
> to sendfile(). The problem with omitting a header argument to
> sendfile() is that the write() causes the header to be sent out as a
> short packet. When the application next calls sendfile(), it gets
> nailed by Nagle's algorithm.

That is why Linux 2.2 has added the TCP_CORK option to avoid the problem.

From netman tcp.7:


TCP_CORK
If enabled don't send out partial frames. All
queued partial frames are sent when the option is
cleared again. This is useful for prepending head-
ers before calling sendfile(2), or for throughput
optimization. This option cannot be combined with
TCP_NODELAY.


So you enable TCP_CORK, write the headers, start the sendfile, and then
clear TCP_CORK again - everything goes out in one packet.


-Andi


--
This is like TV. I don't like TV.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.481 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site