BLOG

KB 2441: DNS Performance

Performance issues are often related to DNS. In this article, we suggest a few tests to check that it is working properly, measure response time, and view the statistics reported by the proxy.

Background

The DNS resolution mechanism accounts for a significant portion of the total time between the browser requesting a URL and displaying it.

Steps

  • Test a DNS query: apt-get install host
  • Test the resolution in IPv4: host -4 www.nomdudomaine.com

    or

    host -4 server_IP_address

  • Test the resolution in IPv6: host -6 www.nomdudomaine.com

    or

    host -6 server_IP_address

  • The order host allows you to search for a host name, but also an IP address by performing a name server query. Try:

    host

    to obtain various IP addresses from a host name. Try host several times. The order in which the addresses are returned may change randomly. This shows that the load is distributed across various DNS servers.

    Example:

root@olfeo:~# host tsa-serv.fr
tsa-serv.fr A 10.3.0.3
tsa-serv.fr A 10.3.0.1
root@olfeo:~# host tsa-serv.fr
tsa-serv.fr A 10.3.0.3
tsa-serv.fr A 10.3.0.1
  • With thetime host command, it is possible to time the resolution of the DNS server.

Example:

root@olfeo:~# time host www.olfeo.com
www.olfeo.com has address 176.31.255.59

real 0m0.011s
user 0m0.004s
sys  0m0.004s
    • realcorresponds to the actual time taken for the task.
    • usercorresponds to user time, i.e., the CPU time used by the user program.
    • sysdefines system time, which corresponds to the time used by the system to manage task execution.

    Test with SquidClient

    The squidclient package is installed by default in version 5.95.

root@olfeo:/# squidclient -h localhost -p (Squid listening port number) mgr:idns
HTTP/1.0 200 OK
Server: squid/3.1.19
Mime-Version: 1.0
Date: Tue, May 14, 2013 1:58:25 PM GMT
Content-Type: text/plain
Expires: Tue, May 14, 2013 1:58:25 PM GMT
Last-Modified: Tue, May 14, 2013 1:58:25 PM GMT
X-Cache: MISS from localhost
X-Cache-Lookup: MISS from localhost:8888
Via: 1.0 localhost (squid/3.1.19)
Connection: close
Proxy-Connection: close

Internal DNS Statistics:

The Queue:
                 DELAY SINCE
ID SIZE SENDS FIRST SEND LAST SEND
-- ---- ----- ---------- ---------

Nameservers:
IP ADDRESS                                     # QUERIES # REPLIES
---------------------------------------------- --------- ---------
10.3.0.1                                       286541    286540
10.3.0.3                                       2264      2264

Rcode Matrix:
RCODE ATTEMPT1 ATTEMPT2 ATTEMPT3
0     1100841  2864     998
1     0        0        0
2     6178     4642     4085
3     17337    41       38
4     0        0        0
5     0        0        0

Search list:
tsa-serv.fr
    • RCODE interpretation:

      • NOERROR = 0
      • FORMERR = 1
      • SERVFAIL = 2
      • NXDOMAIN = 3
      • NOTIMP = 4
      • REFUSED = 5
      • YXDOMAIN = 6
      • YXRRSET = 7
      • NXRRSET = 8
      • NOTAUTH = 9
      • NOTZONE = 10
      • BADVERS = 16

      RCODE Response code – this 4-bit field is used for responses. The values have the following interpretations:

      • 0 No error condition.
      • 1 Format error – The name server was unable to interpret the query.
      • 2 Server failure – The name server was unable to process this query due to a problem within itself.
      • 3 Name error – Only relevant for responses from an authoritative name server, this code means that the domain name referenced in the query does not exist.
      • 4 Not implemented – The name server does not support the type of query requested.
      • 5 Refused – The name server refuses to perform the specified operation for policy reasons. For example, a name server may not want to provide information to a particular requester, or a name server may not want to perform a particular operation (e.g., a zone transfer) for particular data.