cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: round robin DNS without Ares only takes first IP

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Thu, 28 Apr 2005 14:07:42 +0200 (CEST)

On Thu, 28 Apr 2005, A Nonymous wrote:

> Dan Fandrich said he would expect the DNS server to return the list of
> addresses in random order. I have been told that caching DNS servers are not
> obliged to reorder the a-records, or you can not rely on it..

And in this case, we know that the DNS cache within libcurl itself never
reorders them when addresses are re-used.

>> But this will only change which address it starts trying on, not the order
>> of the individual entries, right?
>
> Absolutely. To change the order of the chain in a multithreaded application
> I would have to reorder a copy of the address chain. We could easily do this
> in case you prefer it. Personally I think it is not necessary.

I don't have any particular opinion, I just wanted to be sure this was the
intended behaviour of your suggestion! I feel uncapable of stating exactly how
either approach will affect applications when ran over a long time over
various situations with good/bad addresses in the returned list.

> Philippe Hameau spoke from my heart. Additionally reordering the whole chain
> gets subordinated by the fact that connect retries are only needed in case
> the first server is down or refusing connection.

Right. I'm OK with doing like this.

But is there really a point to add an option for this? Will there ever be
applications that will want to force the same order as long as the address is
fetched from the DNS cache? I can't see how it ever can be reasonable.

Also, your fix only changes how this is done from the easy interface, we need
a little patch for the multi interface approach as well (especially since the
"easy" internal approach is subject for going trashcan in a not so distant
future). The multi interface uses the connect.c:trynextip() function to
advanced to the next IP.

--
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2005-04-28