DNS Server Performance

Bill Larson wllarso at swcp.com
Wed Apr 4 14:40:24 UTC 2001


There are a couple of tools that I am aware of that can repeatedly
query a name server and generate a load.

Mark Fuhr, of the Perl Net::DNS module fame, wrote a script "mresolv2"
which can quickly query a DNS server.  This script can be found at
http://www.fuhr.org/~mfuhr/perldns/.  It is quite interesting!

Another possibility is to use the netperf benchmark tool that was
developed by Rick Jones at HP.  He used netperf as a tool to tune the
BIND-8 server code for higher performance.  Information about this can
be found at
ftp://ftp.cup.hp.com/dist/networking/briefs/named_performance.txt.
This is an extremely interesting article.

Finally, loading a DNS server to 80 queries/sec isn't difficult.  You
can even do this with "dig" in a script.  You might want to do this
from more than one machine to insure that the client system(s) were
not overloaded.

I have appended a script I call "dns.ping" which makes a number of DNS
queries using dig in parallel.  It isn't pretty, but it does seem to
function.  (Comments appreciated.)  You will have to modify it to run
on your system.  Just typing "dns.ping -n 100 10.0.0.1" will query the
name server at 10.0.0.1 one hundred times in a short period of time.
This will generate a server load on the order of what you are asking.

One very nice part about the results from dns.ping is that it reports
the time that it took to make the query.  I feel that this response
time is an important identifier of the performance of a server (If it
took five minutes to return an answer, it could be said that it
succeeded but who would care?).

Bill Larson (wllarso at swcp.com)

> I would like to measure the performance of a DNS server. Is there any
> DNS Client simulator that can allow to make many requests in the same
> time such as 80 per seconds.

#!/usr/bin/sh

# NAME
#	dns.ping - identify network connectivity to a DNS name server
#
# SYOPSIS
#	dns.ping [-d domain] [-t dns_rr_type] [-n repeat] server

# command usage
USAGE="dns.ping [-d domain] [-t dns_rr_type] [-n count] server"

# defaults
type="A"
domain="www.yahoo.com"
repeat=1

# commands - customize as needed
DIG="/usr/local/bin/dig"

# get command line options
while getopts d:t:n:v option; do
  case "$option" in
    d)	domain=$OPTARG;;
    t)  type=$OPTARG;;
    n)  repeat=$OPTARG;;
    v)  verbose="TRUE";;
   \*)  echo "ERROR: dns.ping - invalid option" >&2
        echo "Usage: $USAGE" >&2
        exit 1;;
  esac
done
shift `expr $OPTIND - 1`

# get name server to query
if [ "$#" -ne 1 ]; then
  echo "ERROR: dns.ping - no name server specified" >&2
  echo "Usage: $USAGE" >&2
  exit 1
fi
server=$1

# check specified name server
$DIG $server A +noauthor +noaddit | \
grep '[ 	]IN[ 	][ 	]*A[ 	]' > /dev/null 2>&1
if [ $? -ne 0 ]; then
  echo "ERROR: dns.ping - unknown name server specified" >&2
  echo "Usage: $USAGE" >&2
  exit 1
fi

# repeatly query name server for information
count=$repeat
while [ $count -gt 0 ]; do
  $DIG @${server} ${domain} ${type} 2> /dev/null | \
    awk '/^;; Total query time/{print $5/1000}' \
    > /tmp/dns.ping.$count.$$ &
  dig_pid=$!
  dig_pids=`echo $dig_pids $dig_pid`
  if [ -n "$verbose" ]; then
    echo "DNS query: $server $count $dig_pid"
  fi
  count=`expr $count - 1`
done

# wait for all queries to complete
for pid in $dig_pids; do
  wait $pid
done

# display times for each query ("-1" => timeout)
for file in `ls /tmp/dns.ping.*.$$`; do
  if [ -s "$file" ]; then
    cat $file
  else
    echo "-1"
  fi
  rm -f $file
done


More information about the bind-users mailing list