On Thu, Mar 27, 2014 at 06:23:39PM +0000, MV wrote:

> >Viktor Dukhovni wrote:
> > Furthermore, because "*" is cached, you really don't want to use
> > "*" at all for dynamic transport resolution.
> Thanks for your input RE the caching of the special pattern "*" results.
> 
> > I answered your question upthread, use:
> >     sender_dependent_default_transport_maps
> > For some reason you're still looking elsewhere...
>
> I can't use sender_dependent_default_transport_maps because I don't
> want to use sender-based static "routes". I'm looking for a "random"
> or round-robin-ish split of smtp that provides consistent "helo ..
> hostname .. ip .. reverse-dns-lookup"

Of course you can.  You're just not listening carefully.  Your
sender dependent maps would actually largely ignore the sender,
and just provide a round-robin response.  The important part is
that this mechanism returns a "default_transport" which never
overrides local or other more specific transport information.

This mechanism (being a lookup on the sender, which is a message,
not recipient property) can help avoid unnecessarily splitting of
the envelope for multi-recipient mail.  You should try to send all
the recipients of a message to the same default transport, therefore
you should have an modestly sized LRU cache within the round-robin
process that returns a cached answer for a cached sender, but
returns and caches a random answer for a new sender.

If many messages come predominantly from a single sender and (since
your traffic is likely single-recipient bulk mail, solicited or
otherwise) multi-recipient messages are rare, you may not need the
cache, since envelope splitting will not be useful, but the cache
might defeat the load-balancing you want.

> Anyways, I've got the round-robin working now, using transport_maps
> and this script https://gist.github.com/mvsantos/9813415
> But I'm finding the solution very ugly. There must be a more elegant
> way to do dynamic smtp deliveries...

Use socketmap (or the obsolete tcp table) with:

    sender_dependent_default_transport_maps

Don't bother logging the queries except briefly if you're unsure
it is working.

-- 
        Viktor.

Reply via email to