From owner-freebsd-stable@FreeBSD.ORG Tue Sep 13 01:46:33 2005 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ABBCE16A41F for ; Tue, 13 Sep 2005 01:46:33 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4C1D943D48 for ; Tue, 13 Sep 2005 01:46:33 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.13.0/8.13.0) with ESMTP id j8D1kW9N018127; Mon, 12 Sep 2005 18:46:32 -0700 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.13.0/8.13.0/Submit) id j8D1kWk7018126; Mon, 12 Sep 2005 18:46:32 -0700 Date: Mon, 12 Sep 2005 18:46:32 -0700 From: Brooks Davis To: Kris Kennaway Message-ID: <20050913014632.GA17762@odin.ac.hmc.edu> References: <4326158B.8010502@net24.co.nz> <20050913005144.GA46178@xor.obsecurity.org> <20050913013353.GA13778@odin.ac.hmc.edu> <20050913013725.GA62591@xor.obsecurity.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2oS5YaxWCcQjTEyO" Content-Disposition: inline In-Reply-To: <20050913013725.GA62591@xor.obsecurity.org> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new X-Spam-Status: No, hits=0.0 required=8.0 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on odin.ac.hmc.edu Cc: freebsd-stable@freebsd.org, Nikolai Schupbach Subject: Re: Long Format Directory Listing 15x Slower in FreeBSD 5.x X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2005 01:46:33 -0000 --2oS5YaxWCcQjTEyO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 12, 2005 at 09:37:27PM -0400, Kris Kennaway wrote: > On Mon, Sep 12, 2005 at 06:33:53PM -0700, Brooks Davis wrote: > > On Mon, Sep 12, 2005 at 08:51:44PM -0400, Kris Kennaway wrote: > > > On Tue, Sep 13, 2005 at 11:55:55AM +1200, Nikolai Schupbach wrote: > > > > Hello, > > > >=20 > > > > We have been trying to migrate to FreeBSD 5.4 from an older 4.x rel= ease=20 > > > > for one of our busy mail servers. But we have encountered problems = with=20 > > > > directory listings on 5.4. > > > >=20 > > > > Our /var/mail directory contains approximately 8,000 files doing a = long=20 > > > > directory listing (ls -l) takes approximately 5 min and during this= time=20 > > > > the CPU is running near 100%, on a FSBD 4 box the same directory=20 > > > > contents takes less than 20 seconds to list. Even on a directory wi= th=20 > > > > 200 files, each file with a different owner, it will still take at = least=20 > > > > 4-5 seconds to list. The problems only seems to occur when the dire= ctory=20 > > > > contains files from many different users. (as in /var/mail). If I c= hown=20 > > > > all the files in the /var/mail directory to a single user the direc= tory=20 > > > > listing is near instant. > > > >=20 > > > > It appears it has something to do with 'ls' looking up the id's in = the=20 > > > > password database, because if I instruct ls to display numeric IDs = (ls=20 > > > > -ln), rather than converting to user and group names, the directory= with=20 > > > > 8,000 files, with 8,000 different owners will list instantly. > > > >=20 > > > > The reason this concerns me so much is we are also having a problem= with=20 > > > > our Washington IMAP / POP3 server on FBSD 5 using a lot of CPU whil= e=20 > > > > operating on small and even 0 byte mailboxes, when there are approx= five=20 > > > > or more concurrent POP3 or IMAP sessions. And I can't help thinking= that=20 > > > > the two problems are related. > > > >=20 > > > > Does anyone have any ideas? Has anyone else noticed this problem? I= f I=20 > > > > can't resolve it I'm most likely going to revert to using 4.11, but= I'd=20 > > > > really like to know what is going on. (and yes I'm using UFS_DIRHAS= H) > > >=20 > > > Sounds like the real problem is that you have >8000 users on your > > > machine and lookups are taking a long time. There has been discussion > > > of this problem and how to solve it on freebsd-questions@ several > > > times..I think it involves making a minor change to pwd_mkdb and > > > rebuilding. Please search the archives for that mailing list. > >=20 > > If you are using NIS and have any compat options in /etc/nsswitch.conf > > your performance will really suck in situations like this. IIRC, the > > compat code is worse than O(n^2) if you look up each user and the > > non-compat code is close to O(n). I'd really like to stop generating > > nsswitch.conf entries that use compat in 7.0. >=20 > I'm pretty sure there's a problem with the database hash parameters > used by pwd_mkdb on systems with large numbers of users..this is what > I was alluding to above. That wouldn't suprised me. For that matter it could be both problems. -- Brooks --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --2oS5YaxWCcQjTEyO Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFDJi94XY6L6fI4GtQRAqfHAJ4kIrb4ahKlWwPYjg/lLu//fuxuyACeMmd2 5tL9MD1CMDUGj2BG98utU4U= =5YwP -----END PGP SIGNATURE----- --2oS5YaxWCcQjTEyO--