February 16, 2005

[Research] IMAP Performance

I’ve been looking at IMAP performance over the last few days, and I’ve come up with some pretty heretical results.

The platform for these tests was FreeBSD 4.5/i386, running on a Dell PE 2400. The filesystem was UFS with softupdates enabled. RAM was 512MB, and clearcache was run prior to every test. I tested UW-IMAP using mbox format, Dovecot using both mbox and maildir formats, and Courier-IMAP using maildir.

The results (the two tests that have 0 times are for Dovecot on the THREAD ORDEREDSUBJECT command, which is not implemented in Dovecot):

Servermailbox formattesttime
dovecotmaildir1.capa0.053203
dovecotmaildir1.fetch0.156899
dovecotmaildir1.pine0.234601
dovecotmaildir1.select0.002402
dovecotmaildir1.sort0.140133
dovecotmaildir1.squirrelmail2.692953
dovecotmaildir1.thread0.272252
dovecotmaildir2.sort0.046875
dovecotmaildir2.squirrelmail0.183964
dovecotmaildir2.thread0.0
dovecotmaildir3.sort0.012698
dovecotmaildir3.squirrelmail0.007863
dovecotmbox1.capa0.002634
dovecotmbox1.fetch3.066798
dovecotmbox1.pine0.844669
dovecotmbox1.select0.002329
dovecotmbox1.sort0.053704
dovecotmbox1.squirrelmail2.689958
dovecotmbox1.thread0.206899
dovecotmbox2.sort0.046262
dovecotmbox2.squirrelmail2.488003
dovecotmbox2.thread0.0
dovecotmbox3.sort0.014379
dovecotmbox3.squirrelmail0.00873
couriermaildir1.capa0.002704
couriermaildir1.fetch0.268682
couriermaildir1.pine0.158809
couriermaildir1.select0.032384
couriermaildir1.sort1.258794
couriermaildir1.squirrelmail1.587882
couriermaildir1.thread1.232035
couriermaildir2.sort1.219862
couriermaildir2.squirrelmail0.364796
couriermaildir2.thread1.131387
couriermaildir3.sort0.107762
couriermaildir3.squirrelmail0.04076
uw-imapmbox1.capa0.002472
uw-imapmbox1.fetch0.363805
uw-imapmbox1.pine0.171299
uw-imapmbox1.select0.142298
uw-imapmbox1.sort0.253514
uw-imapmbox1.squirrelmail1.16735
uw-imapmbox1.thread0.595428
uw-imapmbox2.sort0.266605
uw-imapmbox2.squirrelmail0.62801
uw-imapmbox2.thread0.35498
uw-imapmbox3.sort0.163758
uw-imapmbox3.squirrelmail0.116656

Or, as a graph:

Imaptest

The PINE and SquirrelMail tests are taken from a typical short session dump of the corresponding mail clients. The PINE test is a simple opening of the inbox, fetching the header information for a range of messages, fetching the header information for another range, and finally fetching a message. The first two SquirrelMail tests are variants on the form of open mailbox, expunge, sort by some key, and then fetch the header information for a message range. The third just lists subscribed mailboxes and gets a status for INBOX.

This seems to suggest that while maildirs are faster for certain operations, mbox is quite acceptable overall, in particular the UW-IMAP implementation (the Dovecot version seems to fall over). This is counter to the prevailing wisdom that maildirs scream. On the other hand, it seems that the functions used most often by mail clients typically involve a fair amount of sorting, something that maildirs are particularly bad at (except sorting by arrival).

Not included in this set of tests were numbers for creating a new mailbox, copying a message from INBOX to the new mailbox, expunging, copying the message back, expunging, and then deleting the new mailbox. Preliminary tests indicate that Dovecot’s maildir and UW-IMAP’s mbox implementations are about the same speed, Courier is slightly slower, and Dovecot’s mbox implementation completely falls over. This is perhaps a slightly overblown scenario, but without the mailbox creation and deletion it’s not far off from actual usage: there are a number of mail clients that will do a search of the INBOX for certain things, copy those messages to another mailbox (like, say, the spam box), and then expunge — possibly over and over.

I am still working on testing Cyrus, and I’d like to test Sun ONE as well, if I can get a server up and running for it.

Posted by Rowan Littell at February 16, 2005 09:31 AM