MX rotation and load balancing

Kevin Darcy kcd at daimlerchrysler.com
Thu Jul 22 01:43:30 UTC 1999


Johan,

I think your main problem is that you have a block of higher-preference MX'es
right next to a block of lower-preference ones, so the first one in the
lower-preference block tends to get over-represented in the rotation. Why
don't you _interleave_ your higher-preference MX'es with your
lower-preference ones? That should provide a more even spread.

---

Mark,

While what you suggest is a very useful setting which will greatly alleviate
Johan's problem, I think it will get defeated somewhat by the fact that the
answers will often be cached and then the caching servers will answer
depending on their own rrset-ordering rules, which might be random,
round-robin, or, in the case of ancient versions of BIND, strange
configurations, or non-BIND-derived nameservers, fixed order.

I think my suggestion above and/or yours might alleviate Johan's immediate
problem, but for a more universal solution, either a) this random ordering
needs to become the default for MX records within BIND (possibly only for
records at the same preference value?), thus becoming an odious special-case
exception to the overall round-robin default, or b) people need to fix their
non-RFC-compliant MTAs so this isn't a problem, or c) some combination of
both.

I vote for (b) :-)


- Kevin

P.S. I've always thought it would be handy for the preferred ordering of an
RRset to be specified as part of the answer from the nameserver. Something to
think about in a future revision of the protocol perhaps...

Mark_Andrews at isc.org wrote:

>         BIND 8.2 / 8.2.1 supports random ordering of responses.
>
>         options {
>                 rrset-order {
>                         type mx order random;
>                         order cyclic;
>                 };
>         };
>
>         Mind you the MTA is supposed to randomly pick between MX records
>         of equal preference but if you randomise the answer it won't
>         matter if it don't.
>
>         Mark
>
> > I have noticed that bind8 rotates MX records just like A records, which
> > seems to be a good thing. However I have the mailhosts for my domain set
> > up as follows:
> >
> >       @       MX      10 mail1.mydomain
> >       @       MX      10 mail2.mydomain
> >       @       MX      10 mail3.mydomain
> >       @       MX      20 mail1.myisp
> >       @       MX      20 mail2.myisp
> >       @       MX      30 mail3.myisp
> >
> > However bind rotates this entire list, which means that in the next
> > state, the client will see:
> >
> >       @       MX      10 mail2.mydomain
> >       @       MX      10 mail3.mydomain
> >       @       MX      20 mail1.myisp
> >       @       MX      20 mail2.myisp
> >       @       MX      30 mail3.myisp
> >       @       MX      10 mail1.mydomain
> >
> > etc.
> > With the effect that mail1.mydomain will be listed before mail2.mydomain
> > in 5 of 6 states. And as many mailserver implementations are simply
> > picking the first MX record with the lowest weight, this means that
> > mail1.mydomain gets much more traffic than mail3.mydomain. This seems to
> > defeat the purpose of having multiple hosts with the same weight. I
> > guess this is a mailer problem, but that's a problem for remote hosts:
> > nothing I can do about it. More intelligent rotation in bind would help
> > as well.
> >
> > Another solution I tried is having multiple A records for the mailhost
> > (which are also rotated by bind):
> >
> >       @       MX      10      mail.mydomain
> >       @       MX      20      mail1.myisp
> >       @       MX      20      mail2.myisp
> >       @       MX      30      mail3.myisp
> >       mail    A       192.168.1.1
> >       mail    A       192.168.1.2
> >       mail    A       192.168.1.3
> >
> > This works a lot better for load balancing, however as soon as one of
> > the three mailhosts drop dead, a lot of the mail for my site is routed
> > via mail1.myisp because many mailservers don't seem to check for
> > multiple A records, but only use the first one. If this happens to be
> > the host that is down, then they immediately use the backup hosts.
> >
> > I guess the ideal solution would be something like:
> >
> >       @       MX      10      dummy1.mydomain
> >       @       MX      10      dummy2.mydomain
> >       @       MX      10      dummy3.mydomain
> >       @       MX      20      mail1.myisp
> >       @       MX      20      mail2.myisp
> >       @       MX      30      mail3.myisp
> >       dummy1  A       192.168.1.1
> >       dummy1  A       192.168.1.2
> >       dummy1  A       192.168.1.3
> >       dummy2  A       192.168.1.2
> >       dummy2  A       192.168.1.3
> >       dummy2  A       192.168.1.1
> >       dummy3  A       192.168.1.3
> >       dummy3  A       192.168.1.1
> >       dummy3  A       192.168.1.2
> >
> > However this just doesn't look "nice" to me. Is there any other way
> > which I may be missing?
> >
> >
> > Greetings,
> >
> > Johan van Selst
> >
> >
> --
> Mark Andrews, Internet Software Consortium
> 1 Seymour St., Dundas Valley, NSW 2117, Australia
> PHONE: +61 2 9871 4742                 INTERNET: marka at isc.org





More information about the bind-users mailing list