possen
possen

Reputation: 9266

Slow name resolution in Bonjour

This seems so basic that people would be screaming about it, searching the web turned up nothing, but I have tested it on several networks and computers. We are having an issue where we use the .local url to access resources it is very slow. If we use the direct IP address we don’t see these delays.

In our stripped down test setup the device and the computer are on the same switch and are the only devices on the switch. The same thing occurs when we are not in this very limited network configuration. Mac OS X Lion on the command line we are getting these results:

With direct ip:

curl 10.101.62.42  0.01s user 0.00s system 18% cpu 0.059 total

With bonjour name:

curl http://xrx0000aac0fefd.local  0.01s user 0.00s system 0% cpu 5.063 total

It is consistently just above 5 seconds per request to resolve. It does not matter which device we try to connect to, the same seems to be occurring in our iPhone app, and is slow with Python scripts. Safari seems to be able to resolve the names quickly.

We could resolve once and then use the IP address but that first request will still be unacceptably slow, and I don’t think this is the way Bonjour is supposed to work.

We are not exactly sure when this started happening but it was not always this way.

Edit: Another data point. On Snow Leopard it is not slow at resolving:

$ time curl http://hp1320.local > /dev/null
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                               Dload  Upload   Total   Spent    Left  Speed
 101  2848    0  2848    0     0  15473      0 --:--:-- --:--:-- --:--:-- 36512

real    0m0.201s
user    0m0.005s
 sys    0m0.009s

Upvotes: 3

Views: 1355

Answers (2)

possen
possen

Reputation: 9266

This is resolved in iOS 5 and Lion 10.7.2. Which is a huge relief. Unfortunate that 4.3 app users will get this slow behavior. Guess it is another reason to upgrade.

Upvotes: 1

Chris Mowforth
Chris Mowforth

Reputation: 6723

Do the hosts you mentioned show up when you browse for them? Enumeration should be pretty quick:

mdns -B _http._tcp

Maybe there's something slowing the name resolution. If you query the IPs with dig it should return the correct address pretty much instantly:

dig A xrx0000aac0fefd.local @224.0.0.251 -p 5353

Failing that try running tcpdump and see if there's a device that's spewing out multicast packets on the network.

Upvotes: 0

Related Questions