From owner-freebsd-doc Mon Mar 10 16:24:39 2003 Delivered-To: freebsd-doc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6598537B401; Mon, 10 Mar 2003 16:24:35 -0800 (PST) Received: from perrin.int.nxad.com (internal.ext.nxad.com [69.1.70.251]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9AD2943F85; Mon, 10 Mar 2003 16:24:34 -0800 (PST) (envelope-from sean@perrin.int.nxad.com) Received: by perrin.int.nxad.com (Postfix, from userid 1001) id 157672105B; Mon, 10 Mar 2003 16:24:07 -0800 (PST) Date: Mon, 10 Mar 2003 16:24:06 -0800 From: Sean Chittenden To: Giorgos Keramidas Cc: freebsd-doc@freebsd.org Subject: Re: Updated sendfile(2)... Message-ID: <20030311002406.GZ79234@perrin.int.nxad.com> References: <20030310231907.GX79234@perrin.int.nxad.com> <20030310233805.GA7010@gothmog.gr> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GXtmylMy6DdaH5oR" Content-Disposition: inline In-Reply-To: <20030310233805.GA7010@gothmog.gr> User-Agent: Mutt/1.4i X-PGP-Key: finger seanc@FreeBSD.org X-PGP-Fingerprint: 3849 3760 1AFE 7B17 11A0 83A6 DD99 E31F BC84 B341 X-Web-Homepage: http://sean.chittenden.org/ Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --GXtmylMy6DdaH5oR Content-Type: multipart/mixed; boundary="8c7vHYlrYOebzgj6" Content-Disposition: inline --8c7vHYlrYOebzgj6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > > Small but important update for sendfile(2) to include a TUNING > > section. This patch also updates tuning(7) to include a reference to > > sendfile(2)'s TUNING section. > > > > http://people.freebsd.org/~seanc/patches/#sendfile_2_tuning >=20 > Seems ok. Just a few minor details that I noticed are shown below: >=20 > Start sentences on new line. This is a shorter diff and doesn't > touch parts of the mdoc source that don't need to be touched anyway > :) >=20 > Quote this: >=20 > .Pq Fa "struct sf_buf" Thanks for the style notes. Updated patch attached. -sc http://people.freebsd.org/~seanc/patches/#sendfile_2_tuning --=20 Sean Chittenden --8c7vHYlrYOebzgj6 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch Index: lib/libc/sys/sendfile.2 =================================================================== RCS file: /home/ncvs/src/lib/libc/sys/sendfile.2,v retrieving revision 1.16 diff -u -r1.16 sendfile.2 --- lib/libc/sys/sendfile.2 19 Dec 2002 09:40:25 -0000 1.16 +++ lib/libc/sys/sendfile.2 11 Mar 2003 00:19:32 -0000 @@ -106,6 +106,43 @@ implementation of .Fn sendfile is "zero-copy", meaning that it has been optimized so that copying of the file data is avoided. +.Sh TUNING +Internally this system call uses a special +.Xr sendfile 2 +buffer +.Pq Fa "struct sf_buf" +to handle sending file data to the client. +If the sending socket is +blocking and there are not enough sendfile buffers available, +.Xr sendfile 2 +will block and report a state of +.Dq sfbufa . +If the sending socket is non-blocking and there are not enough +sendfile buffers available, the call will block and wait for the +necessary buffers to become available before finishing the call. +.Pp +The number of +.Fa sf_buf Ns 's +allocated should be proportional to the number of nmbclusters used to +send data to a client via +.Xr sendfile 2 . +Tune accordingly to avoid blocking! +Busy installations that make extensive use of +.Xr sendfile 2 +may want to increase these values to be inline with their +.Ar kern.ipc.nmbclusters +.Pq see Xr tuning 7 for details . +.Pp +The number of +.Xr sendfile 2 +buffers in use is determined at boot time by either the +.Em kern.ipc.nsfbufs +.Xr loader.conf 5 +variable or the +.Em NSFBUFS +kernel configuration tunable. +The number of sendfile buffers scales with +.Em kern.maxusers . .Sh RETURN VALUES .Rv -std sendfile .Sh ERRORS @@ -161,6 +198,7 @@ .Xr open 2 , .Xr send 2 , .Xr socket 2 , +.Xr tuning 7 , .Xr writev 2 .Sh HISTORY The Index: share/man/man7/tuning.7 =================================================================== RCS file: /home/ncvs/src/share/man/man7/tuning.7,v retrieving revision 1.59 diff -u -r1.59 tuning.7 --- share/man/man7/tuning.7 27 Dec 2002 12:15:34 -0000 1.59 +++ share/man/man7/tuning.7 11 Mar 2003 00:19:32 -0000 @@ -775,6 +775,11 @@ .Va kern.maxusers so you should not need to modify this parameter except under extreme circumstances. +See the +.Dq TUNING +section in the +.Xr sendfile 2 +man page for details. .Sh KERNEL CONFIG TUNING There are a number of kernel options that you may have to fiddle with in a large-scale system. --8c7vHYlrYOebzgj6-- --GXtmylMy6DdaH5oR Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Comment: Sean Chittenden iD8DBQE+bSym3ZnjH7yEs0ERAv5LAKCd9lKoX5euDkV4xJVHeKP08olU0ACffq2N vUiIusrW9d+6SyDv+O91fQs= =UjLh -----END PGP SIGNATURE----- --GXtmylMy6DdaH5oR-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message