Date: Wed, 5 Jan 2005 08:47:47 -0500 From: Bruce Campbell <bruce@engmail.uwaterloo.ca> To: Kris Kennaway <kris@obsecurity.org> Cc: freebsd-questions@freebsd.org Subject: Re: New FreeBSD 5.3 e-mail server extremely slow - traced to getpwnam maybe ? Message-ID: <1104932867.41dbf003405b1@www.nexusmail.uwaterloo.ca> In-Reply-To: <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> <20050105045329.GA77072@xor.obsecurity.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Quoting Kris Kennaway <kris@obsecurity.org>: > On Tue, Jan 04, 2005 at 09:27:27PM -0500, Bruce Campbell wrote: > > > I wrote a small program: > > > > #include <sys/types.h> > > #include <pwd.h> > > > > main( int argc, char *argv[] ) > > { > > getpwuid( 13076 ); > > } > > > > 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) > > ... > > Try tuning the pwd_mkdb parameters (see hash(3)) in > /usr/src/usr.sbin/pwd_mkdb/pwd_mkdb.c and recompile: > > HASHINFO openinfo = { > 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). Thanks. That had no effect on the large number of seeks/reads to do a getpwuid of a specific uid. I tried boosting that number further, still no change. I suspect the problem is related to some change to the hash functions between 4.7 and 5.2.1 and I hope to get to the bottom of it today. I tried two getpwnam (as opposed to getpwuid) calls on 2 different userids, one took 1000 seek/reads, the other 16,000, so it's all pretty random, no doubt related to how stuff gets hashed. On 4.7 it takes just one or two reads/seeks. As each login via ipop, imap, and each sendmail, and just about everything will be doing getpwnam's I think this is our problem. -- Bruce Campbell Engineering Computing CPH-2374B University of Waterloo (519)888-4567 ext 5889 ---------------------------------------- This mail sent through www.mywaterloo.ca
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1104932867.41dbf003405b1>