[Dovecot] Optimizing POP3 performance?

Timo Sirainen tss at iki.fi
Fri Jan 4 12:41:07 EET 2008


On Fri, 2008-01-04 at 11:25 +0100, Sebastian Färber wrote:
> Because i want to get rid of qmail completely (switching to exim) i
> just tried to replace the qmail pop3 daemon with dovecot too.
> Immediately after the migration the server became basically unusable
> because of the high I/O Load caused by the dovecot pop3 daemon.

The main issue here is that qmail-pop3d violates POP3 spec and returns
wrong message sizes. The size that should be reported to POP3 clients is
the one with linefeeds counted as CR+LF pairs instead of plain LFs. This
doesn't seem to break clients, but I don't want to violate specs just to
make things a bit easier.

The best way to handle this would be to have your MDA add ,W=<vsize> to
maildir filenames. Dovecot v1.1 does this itself also. After that
Dovecot uses the <vsize> as the message's virtual size.

Existing files can't (or shouldn't) be renamed, so those would still be
problematic with v1.0 if you have index files disabled. v1.1 handles
this better by storing the sizes to dovecot-uidlist.

Of course if you don't care about any of this, you could just as well
modify Dovecot's sources and have it work the same as qmail-pop3d:

--- a/src/pop3/client.c Fri Jan 04 03:31:04 2008 +0200
+++ b/src/pop3/client.c Fri Jan 04 12:40:28 2008 +0200
@@ -83,9 +83,9 @@ static bool init_mailbox(struct client *
 
                expunged = FALSE;
                failed = FALSE;
-               mail = mail_alloc(t, MAIL_FETCH_VIRTUAL_SIZE, NULL);
+               mail = mail_alloc(t, MAIL_FETCH_PHYSICAL_SIZE, NULL);
                while (mailbox_search_next(ctx, mail) > 0) {
-                       uoff_t size = mail_get_virtual_size(mail);
+                       uoff_t size = mail_get_physical_size(mail);
 
                        if (size == (uoff_t)-1) {
                                expunged = mail->expunged;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20080104/b275ff31/attachment.bin 


More information about the dovecot mailing list