Date: Mon, 10 Mar 2003 16:24:06 -0800 From: Sean Chittenden <seanc@FreeBSD.org> To: Giorgos Keramidas <keramida@freebsd.org> Cc: freebsd-doc@freebsd.org Subject: Re: Updated sendfile(2)... Message-ID: <20030311002406.GZ79234@perrin.int.nxad.com> In-Reply-To: <20030310233805.GA7010@gothmog.gr> References: <20030310231907.GX79234@perrin.int.nxad.com> <20030310233805.GA7010@gothmog.gr>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <sean@chittenden.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030311002406.GZ79234>