cURL / Mailing Lists / curl-library / Single Mail


DNS round robin resolving tests

From: Daniel Stenberg <>
Date: Thu, 3 Nov 2005 09:53:52 +0100 (CET)


(This thread is hereby moved from the curl-users list to the curl-library list
since this is rather technical dev talk.)

Attached to this mail are two files:

  roundrobin.c - a stand alone test program for testing round robin DNS

  bad11-2000 - the output I got from running the test program with the
  arguments "bad11.haxx.s 2000". It makes the test program resolve that host
  name 2000 times and then check how the response addressess are distributed.

This output clearly shows that gethostbyname() returns a MUCH more "random"
list of addresses on my machine. Unfortunately, most of my
getaddrinfo()-capable Linux hosts are all running Debian unstable so I can
basically only test this on the same glibc. And I cannot detect any noticable
differences between the hosts (they all use different /etc/resolv.conf files
for example).

So, some questions: can anyone detect an obvious flaw in the test method or
give a resonable explanation why this result could be considered OK?

Is there a glibc getaddrinfo() version that does a better job?

Is there anything we mere mortals can do to improve this without modifying

I'm running this here with you first and I will take it to the proper glibc
crowd later on should we consider that the proper action.

  Commercial curl and libcurl Technical Support:

Received on 2005-11-03