ns1 & ns2 load balancing

Brad Knowles brad at stop.mail-abuse.org
Thu Jul 7 20:03:45 UTC 2005


At 2:39 PM -0400 2005-07-07, Jim wrote:

>  I've read that a secondary name server will load balance with its master -

	To a certain degree, yes.

>  but I've never heard an explanation of how.

	The book _DNS and BIND_ by Paul Albitz and Cricket Liu has the 
best explanation I've seen so far.  If you buy a copy, make sure it's 
the latest (4th) edition.

>                                               Yes, the secondary is there for
>  a backup should the primary fail, but what does the secondary name server do
>  other than accept zone transfers from its master and where does this load
>  balancing happen?

	It happens at all the other nameservers that might ask for 
information about your zone.

	The algorithm used inside of BIND is that it keeps track of 
response time from all nameservers that are advertised as being 
authoritative for a given zone, and every time a query request comes 
in for a given zone, it will usually ask the nameserver that it 
thinks is fastest.  The algorithm is designed so that it will age the 
data it has over time, and will periodically ask the other 
nameservers, to refresh the response time information it has about 
them.

	It's a kind of complex algorithm, but it does work pretty well. 
However, I can't speak for what kind of load-balancing algorithm may 
be used by any other server.

>  I've read that a client/server will run through its /etc/resolve.conf file,
>  find the first nameserver entry (most likely the primary of the network) and
>  only after a timeout will it request an answer from another nameserver
>  entry. Just as in Windows, nslookup always defaults to querying the primary
>  name server for requests. So when does the secondary get used? Or does it
>  lay dormant until the primary goes down?

	You're thinking of how a resolver queries a caching server.  That 
goes strictly in the order listed in your /etc/resolv.conf.  This is 
why you want to have different clients with slightly different 
/etc/resolv.conf configurations (if you want to try do load-balancing 
at the client level), or you put a layer 4 load-balancing switch in 
front of the caching servers so as to distribute the incoming load 
across multiple machines.

	But the algorithm used by the resolver is also explained in _DNS and BIND_.


	The algorithm I described above is the one that would be used by 
the caching server itself when asking queries of other servers on the 
Internet.

-- 
Brad Knowles, <brad at stop.mail-abuse.org>

"Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety."

     -- Benjamin Franklin (1706-1790), reply of the Pennsylvania
     Assembly to the Governor, November 11, 1755

   SAGE member since 1995.  See <http://www.sage.org/> for more info.



More information about the bind-users mailing list