OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Subject: Re: Scalability metrics?
From: Brad Knowles (blkskynet.be)
Date: Fri Feb 11 2000 - 16:57:45 CST


At 10:33 PM +0200 2000/2/11, Liviu Daia wrote:

> True, but this is still much better than copying the whole mailbox
> to update the "Status:" flag or to delete a message from the beginning
> of the folder.

        I disagree. If I've just downloaded 500 mail messages (about
what I tend to get in a day), and those are stored in a single
mailbox and I've selected "KeepOnServer", then the entire mailbox
gets re-written just once and then moved back into place. Your
solution re-writes 500 separate files, and as we know one of the
things we absolutely want to avoid is synchronous meta-data
operations -- mailbox-per-user has one, while you have 500.

> I didn't check that, but I wouldn't be surprised if POP servers that
> support maildir would store the UIDL in the filename, just like the
> flags. The maildir format allows this, at least in theory.

        First off, I'm not personally aware of any POP servers that
support maildir. Secondly, if they did, I would be willing to bet
that they almost certainly don't store the UIDL in the filename. If
they did, you'd either have to re-write the message on the fly as you
sent it to the user (adding the non-existent X-UIDL header), or you'd
have some very confused users.

>> You haven't read the paper I presented at SANE '98, have you?
>
> I have to admit I haven't.

        Well, you should. Wietse was a *very* strong influence on that
paper, but you (in particular) and the other members of the
postfix-testers mailing list also influenced it. I would encourage
you to read that which you have influenced. ;-)

> Well, this is a typical situation when some people would advocate
> using the (in)famous ext2. :-)

        But ext2fs doesn't implement hashed directories. SGI's XFS does
(and I have personally witnessed it handling 100,000 files in a
single directory without any problems whatsoever), but it is not yet
available outside of SGI, except for some source code that they've
released but which has not yet been incorporated by anyone I know of.

> That's how a message is supposed to be delivered to a Maildir
> folder: it's first written to "tmp/", then moved to "cur/".

        Ahh, which implies that they're on the same filesystem. Okay, I
see. Instead of twice as many synchronous meta-data operations (as I
was thinking) because you would have to do them once in tmp/ and then
once in cur/, you instead have X synchronous meta-data operations
(one per message stored in maildir), while mailbox-per-user has just
one.

        When it comes to synchronous meta-data operations, I think
mailbox-per-user still wins, and as I've outlined, I think I've got
an approach that beats the crap out of mailbox-per-user. ;-)

>> Still gotta handle those X-UIDL headers. Oops, more synchronous
>> meta-data updates....
>
> Well, a rename is usually not worse than an unlink. :-)

        But adding an X-UIDL header is not a rename, it's a rewrite plus
a rename. The rewrite is what kills you.

> All true, but how does mkstemp() improve the maildir scheme
> described by Bennett? The file created in "tmp/" is the final message,
> with the final name. If somebody else can create files in "tmp/" (the
> one in the Maildir folder, as opposed to things like "/tmp/") you have
> bigger problems than that.

        I presume that the LDA is then switching it's uid to that of the
owner of the maildir, and you have guaranteed that the maildir is
only readable/writable by that process id and root? How do you
handle the case when you've got a quarter of a million users? Do you
really have a quarter of a million different uids that the process
could run as? And if you don't switch uids, but you let it continue
to run as user "procmail" (or root, or whatever), now you've
introduced race conditions that would encourage the use of mkstemp().

-- 
   These are my opinions and should not be taken as official Skynet policy
  _________________________________________________________________________
|o| Brad Knowles, <blkskynet.be>                 Belgacom Skynet NV/SA |o|
|o| Systems Architect, Mail/News/FTP/Proxy Admin  Rue Col. Bourg, 124   |o|
|o| Phone/Fax: +32-2-706.13.11/726.93.11          B-1140 Brussels       |o|
|o| http://www.skynet.be                          Belgium               |o|
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
     Unix is like a wigwam -- no Gates, no Windows, and an Apache inside.
      Unix is very user-friendly.  It's just picky who its friends are.