cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Slow DNS lookups compared to wget

From: Rick Richardson <rickr_at_mn.rr.com>
Date: Mon, 18 Feb 2002 13:22:03 -0600

On Mon, Feb 18, 2002 at 12:42:28PM -0600, Rick Richardson wrote:
> On Mon, Feb 18, 2002 at 09:06:23AM -0600, Rick Richardson wrote:
>
> Yes, the problem seems to be a broken "getaddrinfo()" for some IP
> lookups, as invoked by curl and as implemented by RH7.2's libc 2.2.4
> and kernel 2.4.9-21. Dunno if any other combinations are affected. I
> have attached a short test program. Here are the results:
>
> $ ./getaddrinfo www.yahoo.com www.bloomberg.com
> www.yahoo.com: rc = 0, time = 1 secs
> www.bloomberg.com: rc = 0, time = 29 secs
>
> I dunno enough about DNS internals to be able to point the finger of
> blame here. Curl's "configure" script automagically selects ipv6 and
> claims that there is a working getaddrinfo(), so it uses that instead
> of the tried-and-true gethostbyname(). Here's the strace output of
> the test program.

BTW, if I change hints.ai_family in the test program from PF_UNSPEC to
AF_INET, then getaddrinfo() runs like the wind. Here are the times
for the two ways.

        $ ./gaiAFINET www.yahoo.com www.bloomberg.com
        www.yahoo.com: rc = 0, time = 1 secs
        www.bloomberg.com: rc = 0, time = 0 secs

        $ ./gaiUNSPEC www.yahoo.com www.bloomberg.com
        www.yahoo.com: rc = 0, time = 1 secs
        www.bloomberg.com: rc = 0, time = 28 secs

-Rick

-- 
Rick Richardson  rickr@mn.rr.com        http://home.mn.rr.com/richardsons/
Stock information at your fingertips:   http://linuxtrade.0catch.com/
Gore: "I've been a part of the discussions on the strategic reserve
since the days when it was first established". The reserve was
established in 1975.  Gore was first elected to Congress in 1977.
Received on 2002-02-18