cURL / Mailing Lists / curl-users / Single Mail

curl-users

DNS name resolution

From: Russell Neufeld <rneufeld_at_archivas.com>
Date: Tue, 01 Nov 2005 15:49:58 -0500

Hi,

    We are using DNS round-robining to load balance among servers and
we're having a hard time getting curl to obey it. (Fedora Core 4,
libcurl/7.13.1) I have a name - www.cluster.archivas.com - which
resolves to one of 192.168.139.103, 192.168.139.104, 192.168.139.105, or
192.168.139.106. Running "hosts www.cluster.archivas.com" multiple
times over and over shows that the ip addresses are round robining and
returned in different order each time. However running the command line
"curl http://www.cluster.archivas.com/file" multiple times over and over
always hits the same server. (If I wait about a minute and try again,
it might choose another server.)

    I've tried this using the command line curl, pycurl, and libcurl.
With pycurl and libcurl I've tried setting

        self.curl.setopt(pycurl.DNS_CACHE_TIMEOUT, 0)
        self.curl.setopt(pycurl.DNS_USE_GLOBAL_CACHE, 0)

but neither had any effect.

    The interesting thing is that other network utilities do respect the
round-robining. Running wget with the same URL over and over does round
robin, as does repeated invokations of ping, so I feel like I've
eliminated any OS name caching. Named is not running on the machine.

    I can imagine that I'm not setting the right curl opt when I'm using
pycurl or libcurl, but I don't understand why the command line curl
would exhibit the same behavior.

    Any ideas? Thanks a lot,

       Russ
Received on 2005-11-01