On Sat, Jun 20, 2015 at 04:48:24PM +0000, Adam Roses Wight wrote: > Attaching my WIP patch here... > > On Sat, Jun 20, 2015 at 04:37:11PM +0000, Adam Roses Wight wrote: > > Many hosting providers limit the number of outbound SMTP connections over > > time, and exceeding their threshold results in harsh consequences like > > dropped connections and unpredictable delays until recovery. It would be > > ideal if Postfix supported absolute outbound limits. > > > > Currently, the only workarounds I've found are either complex or have > > unwanted side effects. > > > > There's a precendent for limiting traffic by, the following > > configuration parameters limit by destination, for example: > > * default_destination_concurrency_limit > > * default_destination_rate_delay > > > > I'm proposing that we implement the following configuration parameter, > > which rate limits an entire transport regardless of destination: > > > > default_rate_delay (default: 0s) > > The default amount of delay that is inserted between deliveries. > > > > To enable the delay, specify a non-zero time value (an integral value > > > > plus an optional one-letter suffix that specifies the time unit). > > > > > > I've started writing this feature to determine whether it's feasible > > with the current architecture, but no success yet, this doesn't seem > > to limit the number of jobs which are popped from the queue: > > > > https://github.com/vdukhovni/postfix/compare/master...adamwight:rate_delay
If there is to be a global rate delay, the transport process limit might as well be equal to 1. At which point to implement a rate delay, it suffices for each delivery to take a minimum amount of time, so an option along the lines of: smtp_minimum_delay = 0s would do the trick, by having the smtp_delivery_agent sleep if necessary to ensure that deliveries take at least that amount of time. This would require no changes to the queue manager, which is a rather complex program that is best left as-is. -- Viktor.