curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Aw: Re: Re: DNS Lookup time (CURLINFO_NAMELOOKUP_TIME) performs worse than getaddrinfo()

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 26 Jun 2018 18:18:09 +0200 (CEST)

On Tue, 26 Jun 2018, Bernhard Jaeger wrote:

> What made the performance difference was the threaded resolver.
> After configuring (and building) curl with the --disable-threaded-resolver option
> I got the correct performance (~1 ms without threaded resolver, ~4ms with
> threaded resolver)
> This solves my problem but I would still be interested to find out why the
> threaded resolver performs worse, usually threading is used to increase
> performance.

That is curious and it triggered me to experiment some more. It turns out this
was related to the issue I mentioned before: the loop that waits for the
resolver thread to complete.

Since it has no socket to wait for to know when the resolve is completed, it
has a slowly increasing sleep timer that wasn't aggressive enough.

I've written a PR now that removes the custom sleep timer from
curl_easy_perform() and instead makes it use the curl_mulit_timeout()
function, which I also made a bit more aggressive during the first 3
milliseconds of a name resolve. At least in my tests, this makes the really
quick name resolves much faster. See https://github.com/curl/curl/pull/2685

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2018-06-26