How browsers handle multiple IPs [closed]

After all, I had to do the "research" myself. Here's Chromium (version 12.0.742.112) behavior (running on ubuntu 11.04):

Generally it works so: try 1-st ip, once it times-out (after 189 sec.) try 2-nd ip. No error messages given until all ips tried. Next connection will start from first ip again (even if it just failed a second ago and the second ip worked - browser doesn't care)

One interesting thing - TCP connection attempt aren't dropped when user hits cancel - i.e. when I hit cancel, and after 60 seconds click retry, page will show in 130 seconds (189 from the first attempt.) But if I click cancel and click refresh after 190 seconds, the process will start from the beginning.

Regarding the items in the original Question:

  1. Browser gets both IPs from OS, OS doesn't change the order of IPs.
  2. Browser always tries to connect to ip that appears first
  3. It tries for 189 seconds
  4. On 2-nd attempt, it will try first IP again.
  5. When first IP times-out, browser silently continues to the second ip. If it works - the page shows-up, if not - waiting continues.
  6. Not tested. This blog states Chrome caches DNS for just up to 1 minute, when we look at chrome://net-internals/#dns :

    Capacity: 100 Time to live (ms) for success entries: 60000 Time to live (ms) for failure entries: 0

If the first IP works, process will be the same and it will always succeed on the first attempt.


Instead of telling people what you don't want, why not explain what it is you are trying to achieve ?

If all you're after is known data, then go and investigate yourself, or read the documentation of whatever browser (there are hundreds) you are talking about.

It may help you to know that this has nothing to do with DNS, though.

If a browser gets a request, it first looks in its various caches to see if the URL, or if not the URL then the hostname, is already present.
If not, it will hit the system resolver to resolve the hostname.

If the IP it gets back does not respond, it will most certainly cache this internally as a negative lookup result, so directly requesting the same URL again in the hopes of hitting a different A record for it will probably serve no purpose, since it will have stored the hostname result along with the negative IP result.

Or, you know, you could provide more information.

EDIT: I see you did provide some information in between all the demanding and smartassery.

Very well:

  1. If the browser asks the system resolver for a hostname, it will get back whatever information there is for that hostname. If that means 2 IPs, then it will return 2 IPs.
  2. That depends on the browser.
  3. That depends on the browser, but all browsers I have ever used do a single request, and will time out after the standard TCP CONNECT() timeout; I'm fairly certain there's an RFC about that somewhere...
  4. That depends on the browser. It has nothing to do with DNS or networking.
  5. No.
  6. No.

You also seem not to know that DNS records are cached everywhere, especially on clients. These records expire, depending on what the domain owner intended or the caches in between you and him configured. One hour to one day is common, so don't expect the resolver to do another DNS query if you hit refresh like a madman.