From owner-freebsd-net Tue Sep 19 9:27:41 2000 Delivered-To: freebsd-net@freebsd.org Received: from home.pl (matrix.home.net.pl [212.85.112.32]) by hub.freebsd.org (Postfix) with SMTP id 2765537B423 for ; Tue, 19 Sep 2000 09:27:35 -0700 (PDT) Received: from gateway.home.net.pl (HELO haven) (212.85.112.31) by home.pl with SMTP; 19 Sep 2000 16:29:32 -0000 Message-ID: <039301c02257$25521790$0201000a@haven> From: "Steven Jurczyk" To: References: Subject: Re: sendfile() questions Date: Tue, 19 Sep 2000 18:32:04 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > 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