Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On round-robin DNS every IP associated to a domain has equal probability of being picked by the client.
But what if I want to set a round-robin domain over two IPs but not in a 50%-50% manner?

For example, I could add 3 A records for IP X and 2 A records for IP Y. That way X and Y would be picked by clients on a 60%-40% rate rather that 50-50 if I would've added only 1 A record for each IP.

In theory it sounds possible. But would this really work as expected?
If it worked on a specific DNS server (namely BIND), what about other DNS servers (e.g. ISP DNSs) that are permanently caching requests??
And assuming this work on the server side, how would clients handle multiple A records having the same IP?

share|improve this question
    
what you're looking for is called "weighted round-robin" –  Greeblesnort Dec 9 '09 at 15:31
add comment

3 Answers

up vote 1 down vote accepted

Here's an implementation of weighted round robin DNS: http://www.mccartney.ie/wordpress/2008/08/19/wrr-dns-with-powerdns/

Returning multiple answers is dangerous thanks to implementations of RFC3484: http://drplokta.livejournal.com/109267.html

share|improve this answer
add comment

Because of caching, and because the DNS resolver on the client actually makes the choice re: what IP address to choose, round-robin is a poor choice for getting any kind of "balance" out of intended load balancing. Trying to tweak it to trend the load statistically isn't going to accomplish anything useful.

Fundamentally, "A" records weren't designed to do what you're looking for. (SRV RR's, by contrast, do have "weighting" capability but, alas, nobody uses them.) I suppose one could implement a DNS server that permuted the list of IP addresses returned using some kind of statistical metric, but given that a goodly number of clients are going to be receiving cached results for lookups to your servers (which the server-side hypothetical statistical metric would never "see"), there's really no way to make that work either.

share|improve this answer
add comment

My understanding of DNS round robin is that the ip returned is controlled by the server (which returns only one ip per client per request) and not controlled by the client. When a client resolver queries DNS, the server returns the first record and sends that record to the back of the line, the next client request gets the second record, etc., etc.

There's no "equal weight" algorithm (or any other alogorithm for that matter that Im aware of). It's simply a matter of how many records there are and those records are returned in order of listing (first to last). Am I right?

share|improve this answer
2  
Not really. DNS servers return all A records to the client but each time in a different order. Then the client chooses which A record to use. And since clients normally pick the first one, this technique can be used as load-balancing –  GetFree Dec 9 '09 at 16:00
    
@ GetFree: Thanks for the clarification. –  joeqwerty Dec 9 '09 at 16:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.