I want to know how this is handles or if there is a standard?
views:
40answers:
2Browsers cache DNS Responses for a few minutes and typically attempt a connection with the first IP address returned in the DNS response. The same IP is used until the cache expires.
Internet Explorer caches DNS lookups for 30 minutes by default, as specified by the
DnsCacheTimeout
registry setting. Firefox caches DNS lookups for 1 minute, controlled by thenetwork.dnsCacheExpiration
configuration setting.From: Yahoo Dev Network: Best Practices for Speeding Up Your Web Site
Therefore for multiple IP addresses to be used for load-balancing purposes, the DNS server must change the order of the addresses supplied in the response, choosing the order randomly or in a sequential "round robin" fashion. In fact, this is usually the default behaviour of DNS servers when they respond to hostnames with multiple A records.
There is no standard procedure for deciding which address will be used by the requesting application - a few resolvers attempt to re-order the list to give priority to numerically "closer" networks. Some desktop clients do try alternate addresses after a connection timeout of 30-45 seconds.
Generally they iterate through the responses and use the first one they can connect to.