Is asychronous DNS lookup worth keeping at all?

Eric S. Raymond esr at thyrsus.com
Thu Dec 3 12:46:13 UTC 2015


Hal Murray <hmurray at megapathdsl.net>:
> We could setup a few test cases, and measure the results, then hack the code 
> to not use threads and run them again.  That is worth doing even without this 
> discussion.

Agreed.

> esr at thyrsus.com said:
> > 2. getaddrinfo() is called twice during argument or config parsing.
> >    It launches two worker threads. 
> 
> I think it only uses 1 thread.  That's good for saving resources, but bad if 
> you have lots of resources and want to get started quickly, especially if the 
> DNS for the first one is slow or times out.

OK, so the only real difference this makes to my analysis is we know which order
the DNS replies will land in.

> > 4. Sometime later, the callback passed to getaddrinfo_sometime is called and
> > the
> >    numeric IP for one hostname becomes available. A UDP socket is opened
> >    and the protocol engine ships a query to the server (or pool whatsis)
> >    at the other end of the association. 
> 
> It doesn't have a socket per server.  It has one per interface.  They get 
> setup early.  (I don't know how it decides which one to use when it has more 
> than one.)

Thanks, that's good to know.  I'm going to try to understand and write down
the receive-side control flow today; this is a useful clue.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>


More information about the devel mailing list