Often, an internet connection seems "slow" when browsing due to a slow nameserver. The goal of ns_bench is to help identify cases where the nameserver is sluggish due to the load on the server. By comparing the latency (ping time) and query time to the nameserver for a common record (which should already be cached), you can determine if the nameserver(s) are delaying the lookups.
Many web sites actually have numerous images/embedded links to a number of hosts, so while a delay of 200ms for a host lookup may seem insignificant, compound this by 10 lookups on a page, and you have a delay of 2000 ms (2 seconds)!
ns_bench produces output detailing the minimum, maximum, and average query times for a common A record (google.com), which should almost certainly be cached on the nameserver. It queries the nameserver a few times prior to recording results, however, in the event the server does not have the record cached. Sample output:
Nameserver Response Time (ms)
min/avg/max/stdev/retries
4.2.2.1 12.47/14.47/17.33/1.80/0
4.2.2.3 12.47/13.97/14.97/1.22/0
ns_bench is available for download here. This zip file includes a pre-compiled executable which should work on any modern Windows OS. Despite the default timer resolution of 10ms, this code has a workaround to provide much finer precision when timing the querie. The source is also included, should you want to compile it on another OS. I have tested it on FreeBSD and Linux. If you just want the source code, it can be downloaded here. A binary for OSX (Leopard / x86 only) is available here.
For full instructions for use in Windows, please see the FAQ entry hosted on DSL Reports, written up by DSLR user d_l. A special thanks go out to d_l for testing, writing up the FAQ and for coming up with the idea for this program!
ns_bench is distributed with adns and a patch against the it which adds an additional API call that returns the number of retries necessary to look up the host. It is no longer necessary to download and patch/compile adns manually. The 0.3 version now builds a static local copy of adns long enough to create a statically compiled ns_bench binary.
Feedback/comments/questions welcome; please email me at josh (dot) carroll (at) gmail.com
Download: