Skip to content
Advertisement

I have a question with option in DNSperf tool in Linux

I tried to use the DNSperf tool that is the benchmark testing tool for an authoritative name server in Linux. This tool has various features to provide the result in many aspects. But I would like to know some options like -c and -q. I tried to observe it from the source code in C. But I don’t get it.

-c from the manual, it’s written that

-c clients Enables the local server to act as multiple clients and specifies the number of clients represented by this server. The server sends requests from multiple sockets. By default, the local server acts as a single client.

In fact, it’s just trying to send many queries as many internal threads from the source code. And the maximum of the inputted value in -c option must not exceed 256 that means the length of the socket should not exceed 256?

And two: I’m also curious about the -q option, it’s written that

-q num_queries Sets the maximum number of outstanding requests. When this value is reached, dnsperf stops sending requests until either response is received or its requests time out. The default value is 100.

What is the trigger runs the number reaches 100? I don’t understand about this and I tried to seek out from the source code, it’s quite too complex.

Could everyone help me to understand it? I know my question is quite ambiguous, but I’m not sure how to exactly ask the right way about this so please help me.

Advertisement

Answer

“-c” option specifies how many local source ports to use when doing queries. This is default to 1. So, you will see all queries using only one source port. Maximum value 256 means that you can use a max of 256 unique src ports to send DNS queries.

“-q” is the queue limit. There can be at most this many queries in the dnsperf queue when it stops generating new queries.

So, if the DNS server is slower than usual and takes a longer time to respond, dnsperf will only generate “-q” number of queries and wait for responses.

For example, if you set “-q” to 100, dnsperf will generate at most 100 queries and wait for their responses or timeout. If it gets 5 responses, it will generate 5 new queries, and again the queue will be full at 100. If the dns server is fast, it may happen that the queue limit of 100 is never reached, and dnsperf will make DNS queries as fast as possible.

Be aware that using a high value for -c and -q will also likely increase the memory usage of dnsperf tool in certain network conditions.

Advertisement