Uneven round-robin DNS (i.e. not round-robin)?
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?
Solution 1:
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
Solution 2:
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.
Solution 3:
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?