[tpop3d-discuss]Re: tpop3d+Exim with hashed maildir directories

Dom Gallagher dgallagher at starnetusa.net
Tue, 01 Jun 2004 11:58:49 -0500

At 06:00 AM 5/31/2004, tpop3d-discuss-request@lists.beasts.org wrote:
>From: Kevin Bonner <keb@pa.net>
>Reply-To: keb@pa.net
>To: tpop3d-discuss@lists.beasts.org
>Subject: Re: [tpop3d-discuss]tpop3d+Exim with hashed maildir directories
>Date: Sun, 30 May 2004 11:10:53 -0400
>Hash: SHA1
>On Saturday 29 May 2004 07:27, Odhiambo Washington wrote:
> > Thanks Chris for the outstanding work!
>Indeed.  We've been using tpop3d for a while now, and couldn't be happier.

We've been using tpop3d with Solaris and Postfix for some 2 years or more 
now.   The performance is phenomenal, especially the low overhead of each 

> > If one has over 1k e-mail domains, it occurs to me that the hashed
> > directory delivery method can give improved performance, yes?
>Probably.  At the very least, it's easy to navigate to the proper place if =
>ever need to find something.

We've got tens of thousands of mailboxes (Maildirs) on Solaris boxes; 
without directory hashing this would not be an option, as UFS performance 
sucks with large numbers of files in one dir.  We still have issues when 
people have thousands of mails, but the mailbox limit deals with this 
fairly well.

Reiser or a similar journalled filesystem would probably improve things, 
but directory hashing is much simpler.

> > At the moment I am using Vmail-sql and Exim delivering mail to
> > /var/spool/virtual/$domain/$user/ - maildir format.
> > I am thinking about hashing all this to something like:
> > /var/spool/virtual/d/do/domain/u/us/user or something along those
> > lines.

Unless you have thousands of domains, the domain hashing is unlikely to be 
necessary, and adds an extra calculation (albeit tiny) per step.

>What we've done here is assign each user their own unique uid, which most=20
>other places do as well.  The hashing scheme we used was as follows:

We shied away from UIDs, as this presents a lot of complications once the 
number of users exceeds byte boundaries; each user on each domain is 
unique, so hashing based on the username alone is sufficient in our 
situation.  One thing to be wary of though; do not allow special characters 
(especially periods or - signs) as the first two (or 3 if doing 3 level 
hashing) characters.  This will map out to /a/./a.user which obviously 
doesn't do exactly what it's meant to in a file system.  Using /a/a./a.user 
does limit this issue to the first character.

Hope this helps.

Dom Gallagher (dgallagher@starnetusa.net)
Development Engineering
StarNet/MegaPOP - http://www.megapop.net

This message is sent in confidence to the addressees.
It may contain privileged, proprietary, or confidential information.