cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: DNS caching ?

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Thu, 29 Sep 2005 14:02:29 +0200 (CEST)

On Wed, 28 Sep 2005, Anindya Sinha wrote:

> Since the cache entry is added after lookup (and before successful fetch),
> what happens if the fetch fails ? Is the entry removed so that subsequent
> fetch requests do not use the "failed" IP address ?

First, the default DNS cache is only 60 seconds.

So if libcurl wouldn't cache the lookup in the failure case, how often do you
think you will resolve to a different IP address in the next attempt? Name
resolves are by definition not attempted very frequently.

Also, even if one IP failed one moment, that is actually no indication that it
will fail in the next attempt too.

And, a failed connect to one IP should make it continue to the next.

So, no, I don't think failed transfer from a given IP address is reason enough
to flush the 'name => IP' lookup from the DNS cache.

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