I recently experienced some delays during DNS host resolution on OS X 10.8. To test it I started a simple script which tries to repeatedly resolve the same hostname 20 times:
#!/bin/sh for i in `seq 20`; do time -p dig www.google.com @22.214.171.124 | grep "^;; Query time:" done
Most request take about the same time as the latency to the name server:
;; Query time: 49 msec real 0.05
However, as soon as I enable the firewall in Mountain Lion (all incoming requests are allowed, stealth mode is not enabled), some of the
dig requests take exactly 5 seconds plus the latency to the name server:
;; Query time: 25 msec real 5.03
Most requests are still fast, but around every 10th to 15th requests has a delay of exactly 5 seconds even through
dig still reports a short query time. It makes no difference if I use
host for testing, or if I use a local DNS server or a public one like in the example above. When the firewall is turned off the delay never happens.
Does the firewall of OS X enforce some kind of rate limiting for requests, or is there anything else I'm missing?