I discussed sendfile()
and related
matters with Linus Torvalds and Dan Kegel
(who has an
interesting page about high-capacity servers).
On Linux, sendfile()
depends on the
TCP_CORK
socket option to avoid undesirable
packet boundaries. FreeBSD has a similar option (part of the
T/TCP extensions) called TCP_NOPUSH
; there is a
subtle difference, though: when TCP_CORK
is turned
off any buffered data is sent immediately, but this is not the
case for TCP_NOPUSH
. The Linux behaviour is
helpful because, for example, it avoids you to avoid awkward
delays waiting for the last packet of an HTTP response. I developed
a
kernel patch for FreeBSD which makes TCP_NOPUSH
work like TCP_CORK
, which is in FreeBSD-4.5 and later.
Although there was some discussion about making FreeBSD and Linux more compatible in this area, it stalled because of problems with naming, with T/TCP, and with design philosophy.
I have a program which I
used to test the behaviour of TCP_NOPUSH
and
TCP_CORK
.
<dot@dotat.at>
$dotat: doc/web/writing/nopush.html,v 1.3 2007/08/22 01:59:07 fanf2 Exp $