Massive alias / bulk delivery problem

John Stoffel
Tue, 14 Jul 2020 18:12:22 -0000

gnd> we are experimenting with using Dovecot as part of a simplified
gnd> mail stack with SQL for a internal messaging / notification
gnd> system for our customers. Sometimes we need to send a message to
gnd> thousands of customers at once and we do it by having aliases
gnd> resolve to 10k and 20k+ mail accounts.

gnd> When we send such a message the server load (obviously) is very
gnd> high for a few minutes (in case of an alias containing 10k
gnd> addresses its around 6-7 minutes for a 2 core machine with load
gnd> around 20-30).

gnd> Are there any optimizations or ways how to design the system
gnd> around this problem ? Eg. is there a way how to deliver messages
gnd> more slowly, and spread the load over longer time ?

This is not a dovecot issue, but a postfix issue.  You need to setup
some queues in postfix to handle mail floods like this.  You should
take this to the postfix mailing list on postfix.org, and first look
in the archives, there have been recent discussions about this type of
issue.

gnd> The stack is very simple with Postfix receiving the messages and
gnd> Dovecot acting as a LMTP and IMAP server. Mailboxes are in the
gnd> Maildir format on disk. Customers get the messages on login, a
gnd> PHP script connects to the mail account associated with their ID
gnd> via IMAP and sends unseen messages in the form of a JSON.

Postfix is also sending the emails too.  :-)

John