postfix rate limiting
I did add a new slow transport to my Postfix configuration but this doesn't looks to work. Messages pass correctly in the slow transport but they aren't rate-limited.
Currently, I've been setting this up in my master.cf:
slow unix - - n - 1 smtp
-o default_destination_concurrency_limit=1
-o initial_destination_concurrency=1
-o smtp_destination_concurrency_limit=1
-o in_flow_delay=2s
-o syslog_name=slow
Any idea why my messages aren't rate-limited?
The config you have now is only going to make sure you only have a single simultaneous delivery to each destination. It's not going to actually throttle anything. I think adding this line to main.cf
may accomplish what you want:
slow_destination_rate_delay=2s
That will tell the queue manager to insert the specified delay between each individual delivery to the same destination. Since you haven't modified default_destination_recipient_limit
from its default, it should apply the delay to each recipient domain. So this should mandate a 2 second delay between each delivery to the domain listed in the transport map.
When I've had to do this in the past, I didn't go with the alternate transport mechanism. Since I was only concerned with delivery speed to each unique domain, I just added these lines to main.cf
:
smtp_destination_concurrency_limit = 1
smtp_destination_rate_delay = 1s
So if there is mail being injected for 30 different domains, it may try to deliver a message to all 30 of them at once, but never more than one at a time to example.com
and never faster than 1 per second to example.com
.