Speno's Pythonic Avocado 25.1.2004

2004-01-25

load testing BIND using dnspython and queryperf

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.

This post references topics: python
posted at 10:55:44    #    comment []    trackback []
January 2004
MoTuWeThFrSaSu
    1 2 3 4
5 6 7 8 91011
12131415161718
19202122232425
262728293031 
Dec
2003
 Feb
2004

One python programmer's search for understanding and avocados. This isn't personal, only pythonic.

XML-Image Letterimage

© 2004-2005, John P. Speno