[Dovecot] Optimizing POP3 performance?
Hello,
I recently migrated to Dovecot from Courier-IMAP and i'm very happy with the IMAP Performance and Dovecot in general. The server is running qmail-ldap and i'm still using the qmail pop3 daemon for the POP3 users. 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. I did some debugging and it looks like dovecot opens every old mail in a users maildir and wants to create it's index files etc. I tried running dovecot pop3 with and without "in memory" indexes but this didn't change anything. Is it possible to disable the indexing of the old e-mails completly for pop3?
I understand that dovecot is primarily an IMAP Server but i didn't expect the POP3 Performance to be that bad compared to the qmail pop3 daemon (which is very very basic i have to admit). Is there anything i may have overlooked which helps with the POP3 Performance, any patches that disable the unnecessary indexing etc.? If not, what do you guys recommend and use as a pop3 daemon that is fast and stable?
I'm using dovecot 1.0.2 (i checked the ChangeLog, doesn't look like upgrading would give better pop3 performance?) and the relevant pop3-config is: mail_location: maildir:~/Maildir:INDEX=MEMORY mail_debug: yes dotlock_use_excl: yes maildir_copy_with_hardlinks: yes mail_executable: /usr/local/dovecot/libexec/dovecot/pop3 mail_plugin_dir: /usr/local/dovecot/lib/dovecot/pop3 pop3_enable_last: yes pop3_uidl_format: %f pop3_client_workarounds: outlook-no-nuls oe-ns-eoh
Any hint in the right direction is greatly appreciated
Regards,
Sebastian Faerber
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;
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.
Thanks for the explanation, i suspected something like this.
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:
The patch fixed my problem, the I/O load on the server is now nearly the same as with qmail-pop3d. Thanks Timo, great support!
participants (2)
-
Sebastian Färber
-
Timo Sirainen