Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Sep 2005 21:37:27 -0400
From:      Kris Kennaway <kris@obsecurity.org>
To:        Brooks Davis <brooks@one-eyed-alien.net>
Cc:        Nikolai Schupbach <nikolai@net24.co.nz>, freebsd-stable@freebsd.org, Kris Kennaway <kris@obsecurity.org>
Subject:   Re: Long Format Directory Listing 15x Slower in FreeBSD 5.x
Message-ID:  <20050913013725.GA62591@xor.obsecurity.org>
In-Reply-To: <20050913013353.GA13778@odin.ac.hmc.edu>
References:  <4326158B.8010502@net24.co.nz> <20050913005144.GA46178@xor.obsecurity.org> <20050913013353.GA13778@odin.ac.hmc.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

--dDRMvlgZJXvWKvBx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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 relea=
se=20
> > > for one of our busy mail servers. But we have encountered problems wi=
th=20
> > > directory listings on 5.4.
> > >=20
> > > Our /var/mail directory contains approximately 8,000 files doing a lo=
ng=20
> > > directory listing (ls -l) takes approximately 5 min and during this t=
ime=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 with=
=20
> > > 200 files, each file with a different owner, it will still take at le=
ast=20
> > > 4-5 seconds to list. The problems only seems to occur when the direct=
ory=20
> > > contains files from many different users. (as in /var/mail). If I cho=
wn=20
> > > all the files in the /var/mail directory to a single user the directo=
ry=20
> > > listing is near instant.
> > >=20
> > > It appears it has something to do with 'ls' looking up the id's in th=
e=20
> > > password database, because if I instruct ls to display numeric IDs (l=
s=20
> > > -ln), rather than converting to user and group names, the directory w=
ith=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 w=
ith=20
> > > our Washington IMAP / POP3 server on FBSD 5 using a lot of CPU while=
=20
> > > operating on small and even 0 byte mailboxes, when there are approx f=
ive=20
> > > or more concurrent POP3 or IMAP sessions. And I can't help thinking t=
hat=20
> > > the two problems are related.
> > >=20
> > > Does anyone have any ideas? Has anyone else noticed this problem? If =
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_DIRHASH)
> >=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.

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.

Kris

--dDRMvlgZJXvWKvBx
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)

iD8DBQFDJi1VWry0BWjoQKURAiVsAJ9wVs7mgJntlAg+HjZ6VV7cypgG1QCfbLoU
m+M1ueBmKsL6ols1d22wfC0=
=Th6O
-----END PGP SIGNATURE-----

--dDRMvlgZJXvWKvBx--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050913013725.GA62591>