[Dovecot] Improving lmtp performance
Hi,
yesterday I migrated and old version with sendmail + courier to a virtual machine (vmware) with postfix and dovecot 2.0.9.
Everything worked fine, but with a more or less default setup for both dovecot and postfix, lmtp performance was pretty bad: a message was written to an inbox every 2 or 3 seconds. With that rate and a 5000+ and growing mail queue mail delivery was really slow.
After searching both the wiki and this list I didn't find anything related to this. I tried a couple of things, and finally added
process_min_avail = 10
to service lmtp entry in 10-master.conf and
local_destination_concurrency_limit = 10
in postfix's main.cf
Now mail delivery is really fast, and my mail queue was delivered in a very sort time. Is this the right solution, or there's a better setup to improve mail delivery performance?
Also, if this is a common problem, may be something should appear in http://wiki2.dovecot.org/LMTP
Thanks.
Joseba Torre. Vicegerencia de TICs, área de Explotación
Joseba Torre put forth on 2/2/2011 4:14 AM:
yesterday I migrated and old version with sendmail + courier to a virtual machine (vmware) with postfix and dovecot 2.0.9.
Everything worked fine, but with a more or less default setup for both dovecot and postfix, lmtp performance was pretty bad: a message was written to an inbox every 2 or 3 seconds. With that rate and a 5000+ and growing mail queue mail delivery was really slow.
<snip>
Now mail delivery is really fast, and my mail queue was delivered in a very sort time. Is this the right solution, or there's a better setup to improve mail delivery performance?
You've posted no log data. It's pretty difficult to diagnose problems without log entries. Do you just want us to guess?
Also, if this is a common problem, may be something should appear in http://wiki2.dovecot.org/LMTP
That's a bit premature. The problem could just as likely be a Postfix configuration error. Get us some logs from both Postfix and Dovecot for the previous configuration with the slow performance.
Are both Postfix and Dovecot running in the same VM guest OS instance or two separate VM guests? Are you running elaborate Sieve scripts? Are you running AV/AS in Dovecot? Anything relatively CPU heavy in Dovecot on a per message basis?
-- Stan
El Thursday 03 February 2011, Stan Hoeppner <stan@hardwarefreak.com> dijo:
You've posted no log data. It's pretty difficult to diagnose problems without log entries. Do you just want us to guess?
Yes, I now may mail was pretty vague, but so was the issue. I posted no logs because I saw nothing really useful in them; the only sympton was the slow delivery rate.
Postfix's was full of messages going to the active queue Feb 1 12:43:20 server1 postfix/qmgr[8916]: ED7236CDC1: from=<noreply@mydomain.com>, size=8314, nrcpt=1 (queue active) Feb 1 12:43:21 server1 postfix/smtpd[9427]: 289306CDC3: client=lgux66.lgp.mydomain.com[10.0.100.71] Feb 1 12:43:21 server1 postfix/cleanup[12768]: 289306CDC3: message- id=<moodlepost24182@moodle2.mydomain.com> Feb 1 12:43:21 server1 postfix/qmgr[8916]: 289306CDC3: from=<noreply@mydomain.com>, size=8313, nrcpt=1 (queue active)
and some occasional delivery Feb 1 12:43:23 server1 postfix/lmtp[9549]: 0C5866CF37: to=<cdmorales001@server1.mydomain.com>, relay=server1.mydomain.com[/var/spool/postfix/private/dovecot-lmtp], delay=854, delays=37/668/140/9.8, dsn=2.0.0, status=sent (250 2.0.0 <cdmorales001@server1.mydomain.com> upb1FNftR03cIgAAl0Wliw Saved)
or delivery error Feb 1 12:43:21 server1 postfix/lmtp[9554]: 1C2946CF92: to=<aanton007@server1.mydomain.com>, relay=server1.mydomain.com[/var/spool/postfix/private/dovecot-lmtp], delay=815, delays=1.6/664/141/8 .9, dsn=4.2.2, status=SOFTBOUNCE (host server1.mydomain.com[/var/spool/postfix/private/dovecot-lmtp] said: 552 5.2.2 <aanton007@server1.mydomain.com> Quota exceeded (mailbox for user is full) ( in reply to end of DATA command))
(softbounce was activated to prevent bounces because of misconfigurations)
Dovecot's was as usual, with some Feb 1 13:18:09 server1 dovecot: lmtp(8924, llasa002@server1.mydomain.com): ArX1FNftR03cIgAAl0Wliw: msgid=<CDPMA-WI015feT9L0Yd00060a97@CDPMA- WI01.infoempleo.com>: saved mail to INBOX Feb 1 13:18:22 server1 dovecot: lmtp(8924, aarruti011@server1.mydomain.com): FbX1FNftR03cIgAAl0Wliw: msgid=<moodlepost24217@moodle2.mydomain.com>: saved mail to INBOX Feb 1 13:18:23 server1 dovecot: lmtp(8924, jlopez078@server1.mydomain.com): E7X1FNftR03cIgAAl0Wliw: msgid=<moodlepost24182@moodle2.mydomain.com>: saved mail to INBOX
(this was the actual delivery rate: in this case, 3 messages in 14 secs)
My question was if this is the expected behavior, or if lmtp was expected to behave a lot better with just 1 process (that was what I expected, at least), and if my solution was usual or at least correct. It was not a practical question -my system is working fine now-, but a more teorical one. I was expecting answers like
"I'm using a very simple conf for lmtp in a busy server, something similar to
protocol lmtp { mail_plugins = quota sieve } service lmtp { unix_listener /var/spool/postfix/private/dovecot-lmtp { group = postfix mode = 0660 user = postfix } }
and it's working fine for me, so look in other place".
Also, if this is a common problem, may be something should appear in http://wiki2.dovecot.org/LMTP
That's a bit premature. The problem could just as likely be a Postfix configuration error. Get us some logs from both Postfix and Dovecot for the previous configuration with the slow performance.
I agree. That's why a say "if this is a common problem".
Are both Postfix and Dovecot running in the same VM guest OS instance or two separate VM guests? Are you running elaborate Sieve scripts? Are you running AV/AS in Dovecot? Anything relatively CPU heavy in Dovecot on a per message basis?
Yes, everything was in the same VM guest, no elaborated sieve scripts that I know (I've just recreated them with horde's ingo, and I'm sure they are quite basic), no AV/AS, and system's load was normal, with some i/o wait, but in my experience this is usual in VM guests.
Thanks.
Joseba Torre. Vicegerencia de TICs, área de Explotación
Joseba Torre put forth on 2/3/2011 3:53 AM:
and some occasional delivery Feb 1 12:43:23 server1 postfix/lmtp[9549]: 0C5866CF37: to=<cdmorales001@server1.mydomain.com>, relay=server1.mydomain.com[/var/spool/postfix/private/dovecot-lmtp], delay=854, delays=37/668/140/9.8, dsn=2.0.0, status=sent (250 2.0.0 <cdmorales001@server1.mydomain.com> upb1FNftR03cIgAAl0Wliw Saved)
Since you're using lmtp and not local(8) for delivery, setting the following is unnecessary and shouldn't have changed any Postfix behavior: local_destination_concurrency_limit = 10
"local_destination_concurrency_limit (default: 2)
The maximal number of parallel deliveries via the local mail delivery
transport to the same recipient (when "local_destination_recipient_limit = 1") or the maximal number of parallel deliveries to the same local domain (when "local_destination_recipient_limit > 1"). This limit is enforced by the queue manager. The message delivery transport name is the first field in the entry in the master.cf file.
A low limit of 2 is recommended, just in case someone has an expensive shell
command in a .forward file or in an alias (e.g., a mailing list manager). You don't want to run lots of those at the same time."
If you do any deliveries via local, to say, root/etc, you probably want to change this back to the default.
The default for lmtp_destination_concurrency_limit = default_destination_concurrency_limit
default_destination_concurrency_limit (default: 20)
The default maximal number of parallel deliveries to the same destination.
This is the default limit for delivery via the lmtp(8), pipe(8), smtp(8) and virtual(8) delivery agents. With per-destination recipient limit > 1, a destination is a domain, otherwise it is a recipient.
Thus, if concurrency is what fixed your problem, merely changing Dovecot process_min_avail = 10 solved the problem entirely, as Postfix was already configured to pump mail through 20 parallel connections, though it would seem you're only doing 10, if that is what this Dovecot setting does. Again, I can't find "process_min_avail" documented anywhere.
or delivery error Feb 1 12:43:21 server1 postfix/lmtp[9554]: 1C2946CF92: to=<aanton007@server1.mydomain.com>, relay=server1.mydomain.com[/var/spool/postfix/private/dovecot-lmtp], delay=815, delays=1.6/664/141/8 .9, dsn=4.2.2, status=SOFTBOUNCE (host server1.mydomain.com[/var/spool/postfix/private/dovecot-lmtp] said: 552 5.2.2 <aanton007@server1.mydomain.com> Quota exceeded (mailbox for user is full) ( in reply to end of DATA command))
^^ This obviously isn't due to the performance problem.
(softbounce was activated to prevent bounces because of misconfigurations)
(this was the actual delivery rate: in this case, 3 messages in 14 secs)
I still can't quite grasp this. Even with a single lmtp connection you should be able to push mail as fast as the disks can write. Dovecot doesn't appear to be blocking for any reason. This long delay between messages makes me think something is blocking and timing out.
relay=server1.mydomain.com[/var/spool/postfix/private/dovecot-lmtp]
Note the "relay=server1.mydomain.com". You should put brackets [] around the nexthop host definition in your transport table (or use localhost or the loopback address) or wherever you're defining the lmtp nexthop. If for some reason there's a name lookup delay/timeout, that could potentially be the cause of your issue. If not name resolution timing out, the problem is almost definitely some kind of timeout. Increasing parallelism simply allows more timeouts to occur in parallel, increasing total deliveries, and masking the source of the problem.
My question was if this is the expected behavior, or if lmtp was expected to behave a lot better with just 1 process (that was what I expected, at least), and if my solution was usual or at least correct. It was not a practical question -my system is working fine now-, but a more teorical one. I was expecting answers like
"I'm using a very simple conf for lmtp in a busy server, something similar to
I think very few people use lmtp for delivery. I'm guessing most use Dovecot LDA, a few procmail, maildrop, etc.
protocol lmtp { mail_plugins = quota sieve } service lmtp { unix_listener /var/spool/postfix/private/dovecot-lmtp { group = postfix mode = 0660 user = postfix } }
and it's working fine for me, so look in other place".
I think you should look for the source of the timeout and squash it. Increasing the Postfix logging level should show you where the timeout is occurring.
I agree. That's why a say "if this is a common problem".
I'd say probably not common. I don't see lmtp discussed here very often. That could simply be my perception, however. I see lmtp discussed more often on the Postfix list, but that's usually with a mailbox daemon other than Dovecot, or, maybe Dovecot but lmtp over the network, not on the same box.
Yes, everything was in the same VM guest, no elaborated sieve scripts that I know (I've just recreated them with horde's ingo, and I'm sure they are quite basic), no AV/AS, and system's load was normal, with some i/o wait, but in my experience this is usual in VM guests.
These facts further my suspicion that it's a timeout issue. Increase your Postfix logging level and see what you find.
-- Stan
participants (2)
-
Joseba Torre
-
Stan Hoeppner