From owner-freebsd-questions@FreeBSD.ORG Wed Jan 5 13:47:48 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 5482C16A4CE for ; Wed, 5 Jan 2005 13:47:48 +0000 (GMT) Received: from ecserv7.uwaterloo.ca (ecserv7.uwaterloo.ca [129.97.50.127]) by mx1.FreeBSD.org (Postfix) with ESMTP id D0E3643D5D for ; Wed, 5 Jan 2005 13:47:47 +0000 (GMT) (envelope-from bruce@engmail.uwaterloo.ca) Received: from ecserv7.uwaterloo.ca (localhost.uwaterloo.ca [127.0.0.1]) j05DllAG060345; Wed, 5 Jan 2005 08:47:47 -0500 (EST) (envelope-from bruce@engmail.uwaterloo.ca) Received: (from www@localhost) by ecserv7.uwaterloo.ca (8.12.10/8.12.10/Submit) id j05Dllxf060344; Wed, 5 Jan 2005 08:47:47 -0500 (EST) (envelope-from bruce@engmail.uwaterloo.ca) X-Authentication-Warning: ecserv7.uwaterloo.ca: www set sender to bruce@engmail.uwaterloo.ca using -f Received: from 65.93.198.45 ( [65.93.198.45])HTTP; Wed, 5 Jan 2005 08:47:47 -0500 Message-ID: <1104932867.41dbf003405b1@www.nexusmail.uwaterloo.ca> Date: Wed, 5 Jan 2005 08:47:47 -0500 From: Bruce Campbell To: Kris Kennaway 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> In-Reply-To: <20050105045329.GA77072@xor.obsecurity.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.1 / FreeBSD-4.6.2 X-Originating-IP: 65.93.198.45 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 13:47:48 -0000 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