Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Sep 2000 18:32:04 +0200
From:      "Steven Jurczyk" <steve@post.pl>
To:        <freebsd-net@freebsd.org>
Subject:   Re: sendfile() questions
Message-ID:  <039301c02257$25521790$0201000a@haven>
References:  <Pine.LNX.4.21.0009190916190.10738-100000@tesseract.intercosmos.net>

next in thread | previous in thread | raw e-mail | index | archive | help
 > I'm updating my company's web server software for use under FreeBSD-4.1,
> and I'm having troubles with the new? behavior of sendfile().  I'm only
> getting partial writes on files larger than about 16k, using both blocking
> and non-blocking IO on the network sockets.  Our implementation using
> sendfile() works fine under FreeBSD-3.1 through FreeBSD-3.5.1.


I use sendfile() in my web server and this function work OK under 3.x and 4.x. 0
bytes sent status (return value == 0 and *sbytes == 0) is returned in async mode
when socket is clossed (network error, timeout or something like this).

Is "sbytes variable" a off_t (unsigned long long - 64 bit) type?

> Are there any buffer sizes in the kernel that can be increased to make
> sendfile() happier with larger files?  (I wouldn't expect this, because
> sendfile() is supposed to be "zero-copy"...)

yes...
options         NSFBUFS

But I don't change this value (only incrase MAXUSERS) and my web server supports
1K concurent connections without any problem.

> Is it better to put a packet header into an iovec and have sendfile() take
> care of it, or to write the header to the socket using writev() (or
> something similar) and then use sendfile just for sending the file off the
> filesystem?

sendfile with iovec is better (faster) - headers and first bytes of file is sent
in one packet.

pozdrawiam
Stefan Jurczyk
----------------------------------------------------------------------------
HomeNet - http://home.pl - info@home.pl - 0801 325555




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?039301c02257$25521790$0201000a>