A new name server running BIND
needed to be load tested. Included in BIND's distribution
is a utility called queryperf which can be used to test a name server's
performance. As input, queryperf takes a list of domain resource names and
resource types seperated by whitespace and uses that list to generate
queries to a name server. It should look like this:
foo.example.com. A
bar.example.com. A
mail.example.com. MX
1.0.0.127.in-addr.arpa. PTR
2.0.0.127.in-addr.arpa. PTR
It would have been fairly easy to parse our zonefiles, looking for
$ORIGIN tags and the like to construct our input file for performance
testing. However,
dnspython, an open-source DNS toolkit
written in python, made it even easier. Here's the code:
# zoner.py
import dns.zone
import os.path
import sys
TYPES = ['A', 'PTR', 'MX']
for filename in sys.argv[1:]:
zone = dns.zone.from_file(filename, os.path.basename(filename),
relativize=False)
for type in TYPES:
for (name, ttl, rdata) in zone.iterate_rdatas(type):
print '%s\t%s' % (name, type)
This program parsed our zonefiles to produce an input file for
queryperf. As for the new name server, it passed the test with flying
circuses. |