getaddrinfo performance problems
lists at wildgooses.com
Mon Apr 16 22:14:36 UTC 2012
On 16/04/2012 23:05, Khem Raj wrote:
> On Mon, Apr 16, 2012 at 3:02 PM, Ed W<lists at wildgooses.com> wrote:
>> OK, please see attached version 2 of my patch which I believe implements
>> this satisfactorarily
>> As before the motivation is to avoid making DNS queries when calling
>> getaddrinfo with a numerical IP address. Performance improves dramatically
>> in such situations
> Does this solve your original problem ?
> is there some testcase to go along with this for performance ?
Very much so
You can verify my exact performance issue by using ipset and creating a
bitmap ipset or simply adding an ipaddress or iprange into some ipset.
ipset calls getaddrinfo in order to convert arbitrary names to IP
address integers, including textual representations of ip addresses.
On uclibc this was previously triggering a dns lookup even for a text IP
representation (which is clearly unnecessary). Probably for many folks
this is only a minor performance issue, however, my router handles
multiple networks and we use ipsets to switch between networks as they
go down up - the upshot is that when the current network is down, the
resolver is not working and hence dns is extremely slow and ipset takes
around 60 secs to run just to switch us somewhere else. (It's also
devastating at boot where we have iptables lock down the network while
we build the ipsets - takes many mins to create a dozen ipsets...)
Perhaps an extreme example, but there should be a reduction in dns
lookups all round. Actually this exact case probably explains some
annoying excessive PPP demand dialup issues that I spotted under odd cases.
For simplicity, simply observe your DNS traffic, then run "ipset add
some_ips 220.127.116.11" and note random traffic without the patch, none with.
I hope simple inspection will also show that the change is reasonable?
More information about the uClibc