Please follow the below template, it will help us to help you!
If you are Experiencing issues with a Pi-hole install that has non-standard elements (e.g you are using nginx instead of lighttpd, or there is some other aspect of your install that is customised) - please use the Community Help category.
Expected Behaviour:
I expect all DNS queries to be answered almost instantly. I am using a Raspberry Pi 3 Model B+ with Raspbian Lite. The Pi is connected through a couple of switches on ethernet. I use the Pi for other things at the same time such as dump1090. I did have to change the lighttpd configs a bit to make the Pi-hole web interface work with the dump1090 web interface and other things but that shouldn't affect the actual DNS server.
Actual Behaviour:
About 5-10% of queries take a long time. I noticed that sometimes, it would take a long time on 'Resolving host' in a browser but other times it would load almost instantly. I opened a command prompt with nslookup and started querying the IP for google.com and sometimes it would either time out or take a second or two. Most of the time it was instant. I found it in the Pi-hole recent queries log:
It is unusual that you'd see response times of well over a second for a cached lookup, they should be answered almost instantly.
For my Zero, cache response times for the last 24 hours average at 5ms, and that's only due to a few peaks where it took about 100ms with the majority of lookups completing in <1ms.
If I recall your previous debug log correctly, it didn't reveal anything that would directly hint at a cause for this.
But as you are running additional software on that RPi:
Would these long response times correlate with high loads or utilisation, potentially not caused by Pi-hole, but e.g. dump1090?
I checked htop while repeatedly querying for google.com and it shows that there was only around 20% CPU utilization so doesn't look like an issue with high CPU load.
Did you experience high DNS response times anytime during that period? That would be key.
Also, 20% is almost maxing one core of your RPi 3 B+ - quite high.
I have a hard time pushing my single core Zero over the 5% mark when mimicking your repeated requests to google.com.
Which process is contributing the most to those 20%?
I showed it in the video I linked. I had htop running on the left hand side and the dns queries on the right. You can see the slow query without any change in CPU usage. It was actually less than 20%, more like 10%.
(It's not required that you video your analysis sessions, I'm fine with just the results. I deliberately don't watch videos - takes too long to get at information that can be conveyed in a few characters instantaneously, and you may easily miss something important in the blink of an eye. As an exception, I just took a glance at yours - the screen it shows is illegible to me.)
My initial question was whether long response times correlate with high loads or utilisation on your 3B+, and if so, which process is causing it.
So far, we've established that some processes are taking a constant(?) 10% to 20% of your CPU, which would already be a lot for just Pi-hole.
It remains open whether there are peaks in CPU during DNS long response times and what process would be causing them.
If you would be able to confirm another process's impact, you could then look for ways to mitigate that. Depending on the program, you may or may not be able to tweak its settings, stop or disable unneeded services, or move it to another machine altogether.
If it would be Pi-hole peaking on long responses, we'd have to find a way to reliably reconstruct this behaviour so a developer would have a chance to analyse that.
If you do not observe any correlation between high cache response times in Pi-hole and CPU at all, I would be out of leads to assist you in nailing your issue.
There is between a constant 10-20% of CPU used, spread quite evenly across all 4 cores. Dump1090 is the main process using the CPU, it is using about 20% spread across all cores. There is no noticeable difference in the CPU loads when the DNS queries go slow.
I'm going to try installing Pi-hole on my Raspberry Pi 1 (as its the only one I have spare) to see if its any faster.