Load balancing outgoing mail relay

Noel Jones noeldude at gmail.com
Wed Jan 17 16:38:47 UTC 2007

> FreeBSD 6.2 with Sendmail (initially) and now postfix.
> MS DNS with round robin (and TTL set to 0 on the records).
> Resolving with nslookup gives something like:
> smarthost.domain.tld
> If I kill then it goes on the second one. But this is failover,
> and I need (approximately) load balancing.

Postfix will always internally shuffle equal-weight MX records (or
multiple A records if there is no MX).  I think sendmail does this

This will not give strict round-robin use of the smarthosts, but over
thousands of messages will give an equal share to each host.

It sounds as if the host has primary/secondary MX records and you
haven't disabled MX lookups for the relayhost.  Use in main.cf
relayhost = [smarthost.domain.tld]
As documented, the brackets are required to disable MX lookups.

You may want to adjust initial_destination_concurrency_limit and
default_destination_concurrency_limit if your smarthosts will allow
more than the default 20 connections.

If sending small amounts of mail, postfix connection caching may
interfere with observed load sharing.  You may want to turn off
smtp_connection_cache_on_demand if sending small amounts of mail, but
leave it on if sending thousands of messages at a time.

Noel Jones

More information about the freebsd-questions mailing list