<div dir="ltr"><div><div>Hello,</div><div>I have unconventional load profile for my email server and I would like to ask if someone can suggest optimizations in my case.</div><div>I have only one mailbox on the server for collecting emails from variety of external mail servers. I use Postfix for collecting emails and Dovecot to provide IMAP for downloading emails from this mailbox. Currently Postfix configured to use LMTP for transferring emails to Dovecot. Dovecot mail storage format is mdbox. </div><div>Everything was in order (no incoming and active queues in Postfix) when daily incoming email count was up to 1 million emails. </div><div>But now I have to process up to 2 million incoming emails and I faced bottleneck of 10 emails per second for saving emails from Postfix active queue to mdbox using LMTP. Currently Postfix receives about 20 emails per second, incoming and active queues in Postfix are growing and I have to find the way to speed up transferring process from Postfix to mdbox. </div><div><br></div><div>This setup is running on the virtual machine with 8 CPU and 8 GB RAM.</div><div>CPU loaded only by dovecot/lmtp process but not more than 20% per core.</div><div>I/O wait is 2-3%. Disk load is about 200 wMB/sec and 300 rKB/sec (and this sounds quite a bit for our storage capacity) .</div><div>Postfix has destination concurrency limit 20 for default and virtual transport (I’m using virtual transport due to virtual domains configuration).</div><div>Strace showed up that dovecot/lmtp processes have some delays only on waiting for write lock on truncation log file dovecot.index.log. I have temporary moved all index files including truncation log to tmpfs, but this did not help.</div><div>The only thing that helped me to increase speed up to 20 emails per second is removing almost all emails from the mailbox (with empty Inbox I got even 30 emails per second). But I have to keep all incoming emails in the mailbox at least for one week so this way is unacceptable. </div><div><br></div><div>So I would like to ask for suggestions, because I can’t find the root cause of this bottleneck.</div><div><br></div><div>Dovecot version 2.2.31</div><div>Postfix version  2.10.1</div><div><br></div><div>------------------------------------------------Dovecot conf ------------------------------------------------</div><div><br></div><div>mail_location = mdbox:~/mdbox</div><div>mdbox_rotate_interval = 1 days</div><div>mdbox_rotate_size = 200MB</div><div>mail_plugins = " zlib”</div><div>plugin {</div><div>  zlib_save = gz</div><div>  zlib_save_level = 6</div><div>}</div><div><br></div><div>userdb {</div><div>  args = /etc/dovecot/passwd</div><div>  default_fields = uid=vmail gid=vmail home=/opt/vmail/%u</div><div>  driver = passwd-file</div><div>}</div><div>passdb {</div><div>  args = /etc/dovecot/passwd</div><div>  driver = passwd-file</div><div>}</div><div><br></div><div>service lmtp {</div><div>  process_min_avail = 8</div><div>  service_count = 0</div><div>  unix_listener /var/spool/postfix/private/dovecot-lmtp {</div><div>    group = postfix</div><div>    mode = 0600</div><div>    user = postfix</div><div>  }</div><div>  vsz_limit = 0</div><div>}</div><div>------------------------------------------------------------------------------------------------</div><div><br></div><div><br></div><div><br></div><div>--------------------------------------Postfix conf-------------------------------------------</div><div>virtual_alias_maps = hash:/etc/postfix/virtual</div><div>virtual_mailbox_domains = <a href="http://test.com">test.com</a>, <a href="http://example.com">example.com</a></div><div>virtual_mailbox_maps = hash:/etc/postfix/vmailbox</div><div>virtual_transport = lmtp:unix:private/dovecot-lmtp</div><div>default_destination_concurrency_limit = 20</div><div>virtual_destination_concurrency_limit = 20</div><div>------------------------------------------------------------------------------------------------</div></div><div><br></div></div>