Round robin load distribution among servers does not work properly

Mark Andrews Mark_Andrews at isc.org
Tue Apr 7 01:55:23 UTC 2009


In message <96c8e9660904061734t61414549o22a535e681f5866b at mail.gmail.com>, Mallappa Pallakke
 writes:
> Hi,
> 
>  I tried with 9.5.1.P2, but still I am not getting the expected round
> robin results:
> 
>  Please see below my named.conf and zone file:
> 
> named.conf:
> =========
> options {
>        directory "/var/named";
> 
>        // Uncommenting this might help if you have to go through a
>        // firewall and things are not working out.  But you probably
>        // need to talk to your firewall admin.
> 
>        //query-source port 53;
> 
> rrset-order {
>         order cyclic;};    // fixed, random, cyclic
> };
> 
> zone "mycompany.com" {
>        type master;
> //        notify no;
>        file "db.mycompany.com";
> 
>        allow-update { any; };
> //      allow-update { 127.0.0.1; };
> notify yes;
> };
> 
> 
> db.mycompany.com:
> ===============
> $ORIGIN .
> $TTL 0  ;
> mycompany.com           IN SOA  www.mycompany.com. hostmaster.mycompany.com. (
>                                199813404 ; serial
>                                1         ; refresh (1 second)
>                                1         ; retry (1 second)
>                                1         ; expire (1 second)
>                                1         ; minimum (1 second)
>                                )
>                        NS      www.mycompany.com.
> $ORIGIN mycompany.com.
> localhost               A       127.0.0.1
> $TTL 0  ;
> www                     A       10.10.68.1
>                        A       10.10.68.2
>                        A       10.10.68.3
>                        A       10.10.68.4

	Change the nameservers name to be something other than
	www.mycompany.com.

	www.mycompany.com is being retrieved twice once for the
	answer section and once for the additional section.  Each
	retrieval rotates the RRset once. The latter gets thrown
	away when named supresses duplicate RRsets in the answer
	so you see 2 rotations and 2 divides equally into 4.

	B.T.W. one should choose "random" rather than "round-robin" if
	you want uniform load on failure.

	Mark
 
> I always get following answers repeatedly. Not getting 10.10.68.2 and
> 10.10.68.3 as top records in response messages:
> =================================================
> atcafs-n4s1:/kwlogs/msp# dig www.mycompany.com
> 
> ; <<>> DiG 9.3.2 <<>> www.mycompany.com
> ;; global options:  printcmd
> ;; Got answer:
> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 13961
> ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 1, ADDITIONAL: 0
> 
> ;; QUESTION SECTION:
> ;www.mycompany.com.             IN      A
> 
> ;; ANSWER SECTION:
> www.mycompany.com.      0       IN      A       10.10.68.4
> www.mycompany.com.      0       IN      A       10.10.68.1
> www.mycompany.com.      0       IN      A       10.10.68.2
> www.mycompany.com.      0       IN      A       10.10.68.3
> 
> ;; AUTHORITY SECTION:
> mycompany.com.          0       IN      NS      www.mycompany.com.
> 
> ;; Query time: 1 msec
> ;; SERVER: 10.10.68.1#53(10.10.68.1)
> ;; WHEN: Sun Apr  6 00:21:07 2008
> ;; MSG SIZE  rcvd: 113
> 
> 
> =================================================
> 
> atcafs-n4s1:/kwlogs/msp# dig www.mycompany.com
> 
> ; <<>> DiG 9.3.2 <<>> www.mycompany.com
> ;; global options:  printcmd
> ;; Got answer:
> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 65208
> ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 1, ADDITIONAL: 0
> 
> ;; QUESTION SECTION:
> ;www.mycompany.com.             IN      A
> 
> ;; ANSWER SECTION:
> www.mycompany.com.      0       IN      A       10.10.68.2
> www.mycompany.com.      0       IN      A       10.10.68.3
> www.mycompany.com.      0       IN      A       10.10.68.4
> www.mycompany.com.      0       IN      A       10.10.68.1
> 
> ;; AUTHORITY SECTION:
> mycompany.com.          0       IN      NS      www.mycompany.com.
> 
> ;; Query time: 1 msec
> ;; SERVER: 10.10.68.1#53(10.10.68.1)
> ;; WHEN: Sun Apr  6 00:21:09 2008
> ;; MSG SIZE  rcvd: 113
> 
> ===================================================
> 
> 
> Please let me know anything is missing.
> 
> Regards,
> Mallappa Pallakke
> 
> 
> On Sun, Apr 5, 2009 at 8:55 AM, Kirk <bind at kirkb.net> wrote:
> > Mallappa Pallakke wrote:
> >>
> >> Hi,
> >>
> >>    I was trying to do load balancing of client request among
> >> configured servers using internal DNS server, I get proper load
> >> balaning (DNS response with top most IP address going with proper
> >> round robin fashio) for odd number of IP addresses. But it does not
> >> give same bevior for even number of IP addresses.
> >>
> >> For example:
> >>
> >>  If I have configured x.y.z.1, x.y.z.2, x.y.z.3, I get following
> >> combinations in dig response:
> >>
> >>  x.y.z.1
> >>  x.y.z.2
> >>  x.y.z.3
> >>
> >>  x.y.z.2
> >>  x.y.z.3
> >>  x.y.z.1
> >>
> >>  x.y.z.3
> >>  x.y.z.1
> >>  x.y.z.2
> >>
> >> And this repeats, giving round robin distribution.
> >>
> >> However, if I add one more IP address to the zone list (x.y.z.4), I
> >> get only following combinations:
> >>
> >> x.y.z.1
> >> x.y.z.2
> >> x.y.z.3
> >> x.y.z.4
> >>
> >> and
> >>
> >> x.y.z.3
> >> x.y.z.4
> >> x.y.z.1
> >> x.y.z.2
> >>
> >> It gets repeated. I will never get x.y.z.2 and x.y.z.4 as top entries
> >> in this response.
> >>
> >> Can anybody tell me why this limitation and is there any sollution to
> >> resove this problem?
> >>
> >> Thanks in advance.
> >>
> >> Mallappa
> >
> >
> > Not sure what version of BIND you are using, but here I am using 9.5.1-P2.
> >  I just loaded a zone with 10 www records and different IP's and they are
> > handed out round robin just fine.
> >
> > The idea of using DNS for load balancing has been brought up here so many
> > times its hard to count.  The answer is always the same. DNS was *never*
> > meant to provide this functionality.  Spend the big bucks and get a device
> > meant to do *load balancing*.
> >
> > Search the archive for previous threads on this subject.
> > http://marc.info/?l=bind9-users&w=2&r=1&s=load+balancing&q=b
> >
> _______________________________________________
> bind-users mailing list
> bind-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/bind-users
-- 
Mark Andrews, ISC
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: Mark_Andrews at isc.org



More information about the bind-users mailing list