Load Testing DNS using DNSPerf

In this article we will discuss load testing DNS using DNSperf

When i was setting up my internal DNS servers, I wanted to know how much requests my server can handle. As my DNS server is authoritative DNS server, i decided to go with popular tool “Dnsperf” for load testing . Dnsperf is a DNS server performance testing tool. It is primarily intended for measuring the performance of authoritative DNS servers.

Requirements

1. One DNS server , you will run tests against it. I used BIND server with some internal DNS name configured in the zone.
2. DNSperf installation : It can be on same server or on a different machine.

How to configure  the DNS zone?

To run DNS test , you need to have a large number of unique DNS names like aaa.yourdomain.com, xyz.yourdomain.com , xdz.yourdomain.com ..

Intead of creating these individual DNS records, i created a wild card DNS entry in the zone file

1 2 3   *    IN     A     192.168.2.28  

Above line has to be at the end of the zone file. Now server will respond to any requests for your domain, with the result “192.168.1.28”

Now let us see how to run tests against the new zone

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32   ~]# dnsperf -h DNS Performance Testing Tool Nominum Version 2.1.0.0   Usage: dnsperf [f family] [s server_addr] [p port] [a local_addr] [x local_port] [d datafile] [c clients] [T threads] [n maxruns] [l timelimit] [b buffer_size] [t timeout] [e] [D] [y [alg:]name:secret] [q num_queries] [Q max_qps] [S stats_interval] [u] [v] [h] f address family of DNS transport, inet or inet6 (default: any) s the server to query (default: 127.0.0.1) p the port on which to query the server (default: 53) a the local address from which to send queries x the local port from which to send queries (default: 0) d the input data file (default: stdin) c the number of clients to act as T the number of threads to run n run through input at most N times l run for at most this many seconds b socket send/receive buffer size in kilobytes t the timeout for query completion in seconds (default: 5) e enable EDNS 0 D set the DNSSEC OK bit (implies EDNS) y the TSIG algorithm, name and secret q the maximum number of queries outstanding (default: 100) Q limit the number of queries per second S print qps statistics every N seconds u send dynamic updates instead of queries v verbose: report each query to stdout h print this help  

To run the tests, we need to provide “input” file. A Dnsperf input file should contain a large and realistic set of queries, on the order of ten thousand to a million. The input file contains one line per query, consisting of a domain name and an RR type name separated by a space. The class of the query is implicitly IN.

Let us create a simple input file with following command

1 2 3   for i in seq 1 2000000; do echo “$i.mydomain.com A” >> n.txt ;done;  

Contents of the file would be like this

1 2 3 4 5 6 7 8   1.mydomain.com A 2.mydomain.com A 3.mydomain.com A 4.mydomain.com A 5.mydomain.com A 6.mydomain.com A  

Now we will run a simple test against the DNS server running on 127.0.0.1 using the file n.txt

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25   ~]# dnsperf -s 127.0.0.1 -d n.txt DNS Performance Testing Tool Nominum Version 2.1.0.0   [Status] Command line: dnsperf s 127.0.0.1 d n.txt [Status] Sending queries (to 127.0.0.1) [Status] Started at: Tue Mar 14 15:04:50 2017 [Status] Stopping after 1 run through file [Status] Testing complete (end of file)   Statistics:   Queries sent: 2000000 Queries completed: 2000000 (100.00%) Queries lost: 0 (0.00%)   Response codes: NOERROR 2000000 (100.00%) Average packet size: request 37, response 86 Run time (s): 29.006722 Queries per second: 68949.535215   Average Latency (s): 0.001282 (min 0.000035, max 0.022059) Latency StdDev (s): 0.000452  

From the result you can see that “Queries per second:   68949.535215” . You can get better throughputs with multiple clients using “-c” option. 

There are more commandline options are there , please check the documentation at here

These numbers will give you a fair idea on how much DNS requests your hardware can handle and this will help you while selecting the server/hardware configuration for DNS servers. 

As always, feel free to drop us a note if you have any queries or feedbacks using our comment form below. Always happy to help you ????

Author: , 0000-00-00