I had to perform some performance / load testing on some authoritative DNS servers, came across the venerable queryperf but unfortunately it seems to have disappeared from the contrib part of Bind.

So just to make my life easier, and make sure I’ll find it again next time, I’ve made a “standalone” copy of contrib/queryperf on my Github profile.

Installation is straightforward (I should probably need to spend 5 minutes to build a debian package … let’s keep that in mind) :

$ git clone https://github.com/adedommelin-ducksify/queryperf.git
$ cd queryperf/
$ ./configure
$ make
$ cp queryperf ~/bin/ # or everywhere in your $PATH

Basic queryperf usage, stressing the 11.22.33.44 server :

$ queryperf -d ~/tmp/test_file -s 11.22.33.44 –l 300 –i 60 –c -q 20

Which should output something like that :

DNS Query Performance Testing Tool
Version: $Id: queryperf.c,v 1.12 2007/09/05 07:36:04 marka Exp $

[Status] Processing input data
[Status] Sending queries (beginning with 11.22.33.44)
[Status] Testing complete

Statistics:

  Parse input file:     once
  Ended due to:         reaching end of file

  Queries sent:         20003 queries
  Queries completed:    20003 queries
  Queries lost:         0 queries
  Queries delayed(?):   0 queries

  RTT max:              0.001429 sec
  RTT min:              0.000118 sec
  RTT average:          0.000474 sec
  RTT std deviation:    0.000141 sec
  RTT out of range:     0 queries

  Percentage completed: 100.00%
  Percentage lost:        0.00%

  Started at:           Sun Dec 13 07:40:07 2020
  Finished at:          Sun Dec 13 07:40:08 2020
  Ran for:              0.512049 seconds

  Queries per second:   39064.620769 qps

The ~/tmp/testfile contains a list of records to be tested (in the example above, a 20003 generated list) in the following form :

record1 A
record2 AAAA
[...]

Available queryperf options :

Usage: queryperf [-d datafile] [-s server_addr] [-p port] [-q num_queries]
                 [-b bufsize] [-t timeout] [-n] [-l limit] [-f family] [-1]
                 [-i interval] [-r arraysize] [-u unit] [-H histfile]
                 [-T qps] [-e] [-D] [-R] [-c] [-v] [-h]
  -d specifies the input data file (default: stdin)
  -s sets the server to query (default: 127.0.0.1)
  -p sets the port on which to query the server (default: 53)
  -q specifies the maximum number of queries outstanding (default: 20)
  -t specifies the timeout for query completion in seconds (default: 5)
  -n causes configuration changes to be ignored
  -l specifies how a limit for how long to run tests in seconds (no default)
  -1 run through input only once (default: multiple iff limit given)
  -b set input/output buffer size in kilobytes (default: 32 k)
  -i specifies interval of intermediate outputs in seconds (default: 0=none)
  -f specify address family of DNS transport, inet or inet6 (default: any)
  -r set RTT statistics array size (default: 50000)
  -u set RTT statistics time unit in usec (default: 100)
  -H specifies RTT histogram data file (default: none)
  -T specify the target qps (default: 0=unspecified)
  -e enable EDNS 0
  -D set the DNSSEC OK bit (implies EDNS)
  -R disable recursion
  -c print the number of packets with each rcode
  -v verbose: report the RCODE of each response on stdout
  -h print this usage

Interesting KB available on ISC website : https://kb.isc.org/docs/aa-00561