From owner-freebsd-questions@FreeBSD.ORG Wed Jan 5 04:53:06 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 94D9B16A4CE for ; Wed, 5 Jan 2005 04:53:06 +0000 (GMT) Received: from obsecurity.dyndns.org (CPE0050040655c8-CM00111ae02aac.cpe.net.cable.rogers.com [69.199.47.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5D15843D1F for ; Wed, 5 Jan 2005 04:53:06 +0000 (GMT) (envelope-from kris@obsecurity.org) Received: by obsecurity.dyndns.org (Postfix, from userid 1000) id 9E4F3533FA; Tue, 4 Jan 2005 20:53:29 -0800 (PST) Date: Tue, 4 Jan 2005 20:53:29 -0800 From: Kris Kennaway To: Bruce Campbell Message-ID: <20050105045329.GA77072@xor.obsecurity.org> References: <1104860328.41dad4a8ebd90@www.nexusmail.uwaterloo.ca> <20050104205922.GD13991@xor.obsecurity.org> <1104875116.41db0e6c7fbf3@www.nexusmail.uwaterloo.ca> <20050104221531.GA70844@xor.obsecurity.org> <1104892047.41db508f4c7f4@www.nexusmail.uwaterloo.ca> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="82I3+IH0IqGh5yIs" Content-Disposition: inline In-Reply-To: <1104892047.41db508f4c7f4@www.nexusmail.uwaterloo.ca> User-Agent: Mutt/1.4.2.1i cc: freebsd-questions@freebsd.org Subject: Re: New FreeBSD 5.3 e-mail server extremely slow - traced to getpwnam maybe ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jan 2005 04:53:06 -0000 --82I3+IH0IqGh5yIs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 04, 2005 at 09:27:27PM -0500, Bruce Campbell wrote: > I wrote a small program: >=20 > #include > #include >=20 > main( int argc, char *argv[] ) > { > getpwuid( 13076 ); > } >=20 > and ran it under truss on 5.x and it generated 178,711 lines of output. > (the bulk of which is those lseek/read calls as above) >=20 > 4.7 (with same master.passwd file) gave 59 lines of output, which seems > normal. >=20 > I'm speculating that imap and sendmail and just about everything use > getpwuid and getpwuid is misbehaving on 5.x especially with a large > master.passwd file. Try tuning the pwd_mkdb parameters (see hash(3)) in /usr/src/usr.sbin/pwd_mkdb/pwd_mkdb.c and recompile: HASHINFO openinfo =3D { 4096, /* bsize */ 32, /* ffactor */ 256, /* nelem */ 2048 * 1024, /* cachesize */ NULL, /* hash() */ 0 /* lorder */ }; e.g. adjust nelem to 12000 to accomodate your significantly-larger-than-average password database. If this helps, please submit a PR requesting that someone make an option to pwd_mkdb to tune this at runtime (or better yet, submit the patch to do this yourself - it's straightforward to modify the source to do this). Kris --82I3+IH0IqGh5yIs Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFB23LJWry0BWjoQKURAq2jAKDzTm5VM87uxVwm0m0bkyTyEWt0MwCeJ/cM d/v91vEB+Lhs9II6nzo8FOA= =/xcw -----END PGP SIGNATURE----- --82I3+IH0IqGh5yIs--