From owner-freebsd-bugs@FreeBSD.ORG Wed Jan 5 19:40:39 2005 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CC1D516A4CE for ; Wed, 5 Jan 2005 19:40:39 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 94EB643D45 for ; Wed, 5 Jan 2005 19:40:39 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.1/8.13.1) with ESMTP id j05Jedsc077215 for ; Wed, 5 Jan 2005 19:40:39 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.1/8.13.1/Submit) id j05Jedw5077214; Wed, 5 Jan 2005 19:40:39 GMT (envelope-from gnats) Date: Wed, 5 Jan 2005 19:40:39 GMT Message-Id: <200501051940.j05Jedw5077214@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Kris Kennaway Subject: Re: kern/75855 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Kris Kennaway List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jan 2005 19:40:40 -0000 The following reply was made to PR kern/75855; it has been noted by GNATS. From: Kris Kennaway To: freebsd-gnats-submit@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 ----- Date: Wed, 05 Jan 2005 08:47:47 -0500 From: Bruce Campbell Subject: Re: New FreeBSD 5.3 e-mail server extremely slow - traced to getpwnam maybe ? To: Kris Kennaway Cc: freebsd-questions@freebsd.org Quoting Kris Kennaway : > On Tue, Jan 04, 2005 at 09:27:27PM -0500, Bruce Campbell wrote: > > > I wrote a small program: > > > > #include > > #include > > > > 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 -----