This is not an entirely proper way to benchmark a DNS server, but, in a pinch, it should give you some idea of its responsiveness and stability.

The commands below require dig (provided by the bind-utils package), and shuf (provided by the coreutils package). Pretty standard stuff you should already have installed.

The first step is to grab a large sample of domain names. Here’s one of them:

In my case, the three internal DNS servers are 192.168.122.2-4. The shuf -i 2-4 -n 1 command below will pick one of those at random for every lookup. Here we do lookups on three batches of one hundred random domains – one at a time – and measure average response time, while waiting for five minutes between each job. From this you could sort-of calculate a 15-minute average.

I suppose it may be interesting to see how DNS performance changes if you lookup more than one domain in a single pass. Similar to the previous example, the command below will launch 10 instances of dig in parallel. If working with external DNS servers, be careful not to get blacklisted.

Here’s a different way of doing the same operation as in the previous example, but without using xargs. Why? It’s just a clever example of using custom file handles to read multiple lines of input in a single loop iteration and assign each line to a different variable. You should really play with this.
 

Leave A Reply

Please enter your comment!
Please enter your name here