From owner-freebsd-performance@FreeBSD.ORG Sun Jul 20 13:53:41 2003 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7D13937B401; Sun, 20 Jul 2003 13:53:41 -0700 (PDT) Received: from perrin.int.nxad.com (internal.ext.nxad.com [69.1.70.251]) by mx1.FreeBSD.org (Postfix) with ESMTP id BC27843F85; Sun, 20 Jul 2003 13:53:40 -0700 (PDT) (envelope-from sean@nxad.com) Received: by perrin.int.nxad.com (Postfix, from userid 1001) id B813920F00; Sun, 20 Jul 2003 13:53:39 -0700 (PDT) Date: Sun, 20 Jul 2003 13:53:39 -0700 From: Sean Chittenden To: "Jim C. Nasby" Message-ID: <20030720205339.GP24507@perrin.int.nxad.com> References: <200307191818.13516.paul@pathiakis.com> <20030720110939.GN24507@perrin.int.nxad.com> <20030720164237.GC55392@nasby.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0XhtP95kHFp3KGBe" Content-Disposition: inline In-Reply-To: <20030720164237.GC55392@nasby.net> 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/ User-Agent: Mutt/1.5.4i X-Mailman-Approved-At: Sun, 20 Jul 2003 14:18:08 -0700 cc: freebsd-database@freebsd.org cc: freebsd-performance@freebsd.org cc: Paul Pathiakis Subject: Re: Tuning for PostGreSQL Database X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2003 20:53:41 -0000 --0XhtP95kHFp3KGBe Content-Type: multipart/mixed; boundary="S5HS5MvDw4DmbRmb" Content-Disposition: inline --S5HS5MvDw4DmbRmb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > > > Are there optimal parameters for sizing on the disk > > > throughput? > >=20 > > Increase your file system cache. > =20 > How? I've been wondering if there's a way to do this, and all the > settings I've played with seem to have no effect; it just sits at > 199BUF according to top. You might want to get in the habit of using sysctl for getting that kind of info. `sysctl -d vfs.bufspace` #!/bin/sh echo "Max Buffer space =3D=3D $((`sysctl -n vfs.maxbufspace` / 1024 / 1024)= )MB" The sysctl's that are going to be of most interest (in terms of monitoring) are: sysctl -a| grep bufspace However, none of those will let you adjust your buffer size. To do that, you want to change kern.nbuf in /boot/loader.conf (*grumble* Undocumented loader option). kern.maxbcache Limits the amount of KVM reserved for use by the buffer cache, specified in bytes. The default maximum is 200MB. This parameter is used to prevent the buffer cache from eating too much KVM in large-memory machine configuratio= ns. Only mess around with this parameter if you need to grea= tly extend the KVM reservation for other resources such as t= he swap zone or NMBCLUSTERS. Note that the NBUF parameter will override this limit. Modifies VM_BCACHE_SIZE_MAX. By default, the number of NBUF's on a system is auto sized and takes up to kern.maxbcache. There was a post by a guy to the performance@ list where he was trying to optimize a 4GB machine for squid and he'd set it kern.nbuf to 16384 with 512 KVA_PAGES. *shrug* YMMV with this guy's settings, but: http://lists.freebsd.org/pipermail/freebsd-performance/2003-June/000262.html This post in the developers handbook should also be of interest to most people playing with the NBUF setting: http://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/x8987.= html I've attached an untested patch that lets you see what your kern.nbufs are via a sysctl. At the moment, determining what kern.nbuf is set to is a bit ellusive. If someone with src foo can bless this patch, I'll commit it. > Windows: "Where do you want to go today?" > Linux: "Where do you want to go tomorrow?" > FreeBSD: "Are you guys coming, or what?" Cool signature. -sc --=20 Sean Chittenden --S5HS5MvDw4DmbRmb Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch Content-Transfer-Encoding: quoted-printable Index: boot/common/help.common =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/boot/common/help.common,v retrieving revision 1.25 diff -u -r1.25 help.common --- boot/common/help.common 5 May 2003 07:33:12 -0000 1.25 +++ boot/common/help.common 20 Jul 2003 20:38:49 -0000 @@ -244,6 +244,11 @@ Set the number of sendfile buffers to be allocated. This overrides the value determined when the kernel was compiled. =20 + set kern.nbuf=3D NBUF + + Sets the amount of KVA the kernel can use to map filesystem + buffers for I/O. + set kern.vm.kmem.size=3D VM_KMEM_SIZE =20 Sets the size of kernel memory (bytes). This overrides Index: boot/common/loader.8 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/boot/common/loader.8,v retrieving revision 1.57 diff -u -r1.57 loader.8 --- boot/common/loader.8 29 Jun 2003 20:57:55 -0000 1.57 +++ boot/common/loader.8 20 Jul 2003 20:51:31 -0000 @@ -450,7 +450,7 @@ .Xr sendfile 2 buffers to be allocated. Overrides -.Dv NSFBUFS . +.Va NSFBUFS . .It Va kern.vm.kmem.size Sets the size of kernel memory (bytes). This overrides the value determined when the kernel was compiled. @@ -491,6 +491,13 @@ the NBUF parameter will override this limit. Modifies .Va VM_BCACHE_SIZE_MAX . +.It Va kern.nbuf +Sets the amount of KVA the system can use to map filesystem +buffers for I/O. This parameter is normally automatically +tuned by the kernel at startup and it is recommended that +this parameter be unused unless the administrator knows +exactly what adjusting this value influences. Overrides +.Va NBUF . .It Va machdep.disable_mtrrs Disable the use of i686 MTRRs (x86 only). .It Va net.inet.tcp.tcbhashsize Index: kern/kern_mib.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/kern/kern_mib.c,v retrieving revision 1.68 diff -u -r1.68 kern_mib.c --- kern/kern_mib.c 11 Jun 2003 00:56:56 -0000 1.68 +++ kern/kern_mib.c 20 Jul 2003 20:37:11 -0000 @@ -127,6 +127,9 @@ SYSCTL_INT(_kern, KERN_JOB_CONTROL, job_control, CTLFLAG_RD, 0, 1, "Whether job control is available"); =20 +SYSCTL_INT(_kern, KERN_NBUF, nbuf, CTLFLAG_RD, + &nbuf, 0, "Amount of KVA used to map filesystem buffers for I/O"); + #ifdef _POSIX_SAVED_IDS SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_RD, 0, 1, "Whether saved set-group/user ID is available"); Index: sys/sysctl.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/sys/sysctl.h,v retrieving revision 1.118 diff -u -r1.118 sysctl.h --- sys/sysctl.h 12 Jul 2003 02:00:16 -0000 1.118 +++ sys/sysctl.h 20 Jul 2003 20:26:20 -0000 @@ -355,6 +355,7 @@ #define KERN_LOGSIGEXIT 34 /* int: do we log sigexit procs? */ #define KERN_IOV_MAX 35 /* int: value of UIO_MAXIOV */ #define KERN_MAXID 36 /* number of valid kern ids */ +#define KERN_NBUFS 37 /* number of kernel buffers */ =20 #define CTL_KERN_NAMES { \ { 0, 0 }, \ --S5HS5MvDw4DmbRmb-- --0XhtP95kHFp3KGBe Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Comment: Sean Chittenden iD8DBQE/GwFT3ZnjH7yEs0ERAr2QAJ9R87B/qlix54Rw/7h+eYGIVv8XTgCcCQvx tleVmnzpS0zOIC4pmCCjLwc= =dIz2 -----END PGP SIGNATURE----- --0XhtP95kHFp3KGBe--