5

I have DNSMasq set up on a relatively idle Pentium D 3.4Ghz Debian Linux machine. When I run dig queries locally, the second result is always 0 ms. When I run dig queries on any other machine on my network, the cached response time is a constant 35ms. This is in spite of the fact that I get LAN ping times back -- under 1ms.

Using DNS Benchmark, I ran a test that shows I can hit my ISP's DNS servers faster than my own for cached queries.

How am I accruing 35ms on cached DNS responses for remote queries but <1ms for local queries at the server's command prompt?

sludge
  • 332
  • 5
  • 10
  • What is the resource usage on the dnsmasq server when you are testing the cache response time? Is the machine swapping? – Andrew B Jan 13 '13 at 19:12
  • 1
    Can you add your `dnsmasq.conf`? Also, from the test machines, are you querying directly (e.g., `dig microsoft.com @192.168.1.1`)? If you're not querying directly, please add the test machines' `resolv.conf`. – Belmin Fernandez Jan 13 '13 at 21:59

2 Answers2

1

I suspect this due to a low amount of memory on your local DNS server and it reading the cache DB entry for the name from the disk causing a slower response time. It could also be a poor quality network card causing a large amount of CPU usage... I would monitor the system resources when you do a look up from the host.

Check to see how much memory is free using the "free" command, you can do "free -h" for a more human readable output.

KJS
  • 186
  • 2
1

I ran into the same issue with my local dnsmasq instance being slower than opendns and many other ISP provided DNS servers. The following finally worked for me resulting in a massive improvement and my dnsmasq being 3X faster than any remote DNS server.

Adjust the cache-size parameter in /etc/dnsmasq.conf. I have set it to 10000.

# Set the cachesize here.
cache-size=10000
sidhant
  • 11
  • 1
  • 2
    That does not sound like a correct answer. It simply cannot explain the symptoms described in the question. – kasperd Oct 16 '16 at 22:11
  • I also tried this on 2 DNSMASQ instances at our office network. It made no difference to poor DNS performance. – Adambean Sep 10 '18 at 09:19