[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Using hash directories

On Fri, May 23, 2003 at 10:59:39AM +0200, Volker Tanger wrote:
> Quite a number of filesystems still do linear search when trying to
> access a file. So accessing the mailbox for Zacharias Zulu (zzulu) among
> 20.000 users will give the OS probably 19.998 filenames too look up


Thanks all for your explanations! I summarize here the benefits of hash
directories I've heard (simple and practical explanation;-)).

- better performances because classical FS (such as ext3 in my case) are
  slower with a big number of entries in a directory.
- easier to scale, because you can easily put some ranges of accounts in
  another partition/disk/server by moving some directories.
- easier to administer, because we don't like waiting when doing "ls";-)

So for my purpose, I will run with a two level hash ([0-9a-z]/[0-9a-z])
for users maildirs, and create them in the ldap based on the uid with
something like this (perl) :

$mailbox = $uid;
$mailbox =~ s/[^a-z^0-9]+//g;
$mailbox =~ s/(.)(.).*/\/home\/vmail\/$1\/$2\/$uid\//;

(this could help someone :-))

Emmanuel Lacour ------------------------------------ Easter-eggs
44-46 rue de l'Ouest  -  75014 Paris   -   France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37    -     Fax: +33 (0) 1 41 35 00 76
mailto:elacour@easter-eggs.com   -    http://www.easter-eggs.com

Reply to: