Benchmarking DNS servers with Java

I’m currently in the process of moving our DNS over to another provider and I was curious as to whether the old or new provider offers faster lookups. dig shows query times, but I didn’t want to just run that over and over. I decided to write something to do this, in Java since I like Java. I found this post, which has the meat of the work done already. I also read some of Sun’s JNDI/DNS lookup info, which was pretty dense. All I want to do is specify the name server’s IP and do the lookup. I don’t even really care about the result, just how long the query takes.

The thing I wrote only looks up A records, but can easily be modified to do CNAMEs or whatever. Here’s how you call it:

$ java -jar DNSTester.jar 4.2.2.2 www.google.com 25
Resolved www.google.com to 74.125.235.19 against NS 4.2.2.2
Performed 25 lookups in 233.29 milliseconds.  Average 9.3316ms per lookup.

$ java -jar DNSTester.jar 8.8.4.4 www.google.com 25
Resolved www.google.com to 74.125.226.146 against NS 8.8.4.4
Performed 25 lookups in 450.034 milliseconds.  Average 18.00136ms per lookup.

Code is in github here. Jar is available here.

US Public Debt – historical

In a recent “debate” with a friend, I looked for historical data about the US public debt. I found Google Public Data, which has info about the annual budget deficit/surplus, but apparently (oddly) doesn’t have the debt. Odd because this info is available on the Treasury website.

I copied & pasted the data into Google Docs and made a chart of my own and some basic comparisons over time. Here are some of them rendered as images, though the scale makes the horizontal access kind of useless. I tried embedding the interactive Flash-based graph but it didn’t work. Oh well.

{“dataSourceUrl”:”//spreadsheets.google.com/spreadsheet/tq?key=0Arz9JIGL5KjodGlHZjZyRE9YXzBRd0JpVDRKWkE1d0E&transpose=0&headers=1&range=A1%3AC461&gid=0&pub=1″,”options”:{“displayAnnotations”:true,”title”:””,”backgroundColor”:”#FFFFFF”,”legend”:”right”,”logScale”:false,”wmode”:”opaque”,”hAxis”:{“maxAlternation”:1},”hasLabelsColumn”:true,”width”:550,”height”:400},”state”:{},”chartType”:”AnnotatedTimeLine”,”chartName”:”US Public Debt”}