On Mon, Dec 12, 2011 at 12:10:33AM +0200, Charalampos Nikolaou wrote:
Hi,
just used getnameinfo() instead of gethostbyaddr() in openConnectionTCP() and it doesn't gain any time improvement. In addition, inspecting openConnectionUDP(), I saw that it uses getnameinfo() instead of gethostbyaddr() and it is slow as well. What I found, though, is that the trouble is caused by INADDR_ANY (i.e., 0.0.0.0). If 127.0.0.1 or a specific, external ip is given, then both getnameinfo() and gethostbyaddr() return instantaneously. After all, is there any point of resolving 0.0.0.0?
- not requiring to know the IP of the machine we're running on - on machines with multiple interfaces (and hence multiple IPs), receive packets from all interfaces, i.e., sent to any of the IPs.
Anyway, regardless the ip given, I think that resolving should be done in a timely manner, don't you think.
Indeed. I have no idea, though, why/how Ubuntu mnages to mess this up. What else can we as humble application programmers do other than using standard systems call and rely on the OS to implement them correctly and efficiently. I'm not aware of such problems on any platfrom we're usually using / testing on; cf., http://monetdb.cwi.nl/testweb/web/status.php
Time permitting, I shall further inspect the problem to find out whether it is an issue in glibc or specific to system configuration (of Ubuntu).
Ok. Please keep us posted about what you find out. Simple question: what do time host 0.0.0.0 and time host 127.0.0.1 say? Stefan
Regards, Babis
-- | Stefan.Manegold @ CWI.nl | DB Architectures (INS1) | | http://CWI.nl/~manegold/ | Science Park 123 (L321) | | Tel.: +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |