kern/75855

Kris Kennaway kris at obsecurity.org
Wed Jan 5 11:40:40 PST 2005


The following reply was made to PR kern/75855; it has been noted by GNATS.

From: Kris Kennaway <kris at obsecurity.org>
To: freebsd-gnats-submit at FreeBSD.org
Cc:  
Subject: Re: kern/75855
Date: Wed, 5 Jan 2005 11:32:35 -0800

 Adding relevant info to followup
 
 ----- Forwarded message from Bruce Campbell <bruce at engmail.uwaterloo.ca> -----
 
 Date: Wed, 05 Jan 2005 08:47:47 -0500
 From: Bruce Campbell <bruce at engmail.uwaterloo.ca>
 Subject: Re: New FreeBSD 5.3 e-mail server extremely slow - traced to getpwnam
  maybe ?
 To: Kris Kennaway <kris at obsecurity.org>
 Cc: freebsd-questions at freebsd.org
 
 Quoting Kris Kennaway <kris at 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
 
 
 ----- End forwarded message -----


More information about the freebsd-bugs mailing list