Date: Tue, 4 Jan 2005 20:53:29 -0800 From: Kris Kennaway <kris@obsecurity.org> To: Bruce Campbell <bruce@engmail.uwaterloo.ca> Cc: freebsd-questions@freebsd.org Subject: Re: New FreeBSD 5.3 e-mail server extremely slow - traced to getpwnam maybe ? Message-ID: <20050105045329.GA77072@xor.obsecurity.org> In-Reply-To: <1104892047.41db508f4c7f4@www.nexusmail.uwaterloo.ca> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <sys/types.h>
> #include <pwd.h>
>=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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050105045329.GA77072>
