[BlueOnyx:24792] Re: IMAP resources

Michael Stauber mstauber at blueonyx.it
Tue Feb 23 18:16:40 -05 2021


Hi Roy,

> Is there any performance difference on the server side between moving
> messages to trash and flat out deleting them via an IMAP connection? If
> so which is easier on the server? Or is there even a performance
> difference?
There are a couple of factors that play a role there and it also depends
on what IMAP implementation they use (Dovecot, UW-IMAP or something
else). But we can generalize a bit for that purpose.

In essence the performance of that transaction depends on available
processing power, possible I/O speed given whatever else the system is
doing and the storage format in which the emails are stored.

Take a run of the mill Dovecot install where the inbox is in Mbox
format. The folder "Trash" is a separate folder with another flat file
in it that contains the Trash-messages.

Say there are a couple of thousand emails in the Inbox and the email you
want to move to trash is near the end of that monolithic file, but not
the last message.

The IMAP daemon now needs to open up the large monolithic Mbox file that
contains your inbox and it has to splice out the message you want to
move to trash. It has to read the entire file into memory, has to remove
the message from it and then write the changed Mailbox file back to
disk. Then it needs to access the equally monolithic Trash Mbox file and
needs to append the message to the end. This can be done by
concatenating, which is less resource intense, but how it's done largely
depends on the IMAP daemon.

So this whole transaction from start to finish will be *much* more
resource intensive the larger these monolithic mailbox files are.

If you use Maildir format (instead of Mbox), then this is a lot less
resource intense, as emails are stored in individual files. Therefore
transactions such as read, write or move are generally less resource
intense and faster, as the process doesn't have to juggle a massive Mbox
file around.

Still: If you have many emails in Maildir format you introduce another
bottleneck, which is directory indexing. Which can also be resource
intensive, but on a different level and generally it's still somewhat
less taxing that lobbing a +4GB Mbox file around on each access to emails.

But like said: This is just one (likely) scenario as I don't know what
they're using. You can also use Dovecot with an SQL backend for message
storage, in which case all these assumptions fly out of the window.

-- 
With best regards

Michael Stauber



More information about the Blueonyx mailing list