Hi there, apologies if this has been raised already but I'm a bit confused by the performance of DNS resolution I'm seeing for the pihole.
Expected Behaviour:
Environment:
Raspberry Pi 4B 4GB
Ubuntu 22.10
Pi-hole version is v5.16.2 (Latest: v5.16.2)
AdminLTE version is v5.19 (Latest: v5.19)
FTL version is v5.22 (Latest: v5.22)
Using cloudflared tunnel and DoH; upstream is not cloudflare, though.
I expect that the latency for a DNS request to the pihole should be faster than going to the internet when a response is cached
Actual Behaviour:
If I compare the performance using dig I can see that if I make a query such as:
❯ dig -u -t A ubuntu.com @ns1
; <<>> DiG 9.18.12-0ubuntu0.22.10.1-Ubuntu <<>> -u -t A ubuntu.com @ns1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54018
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;ubuntu.com. IN A
;; ANSWER SECTION:
ubuntu.com. 59 IN A 185.125.190.29
ubuntu.com. 59 IN A 185.125.190.20
ubuntu.com. 59 IN A 185.125.190.21
;; Query time: 4026 usec
;; SERVER: 192.168.178.50#53(ns1) (UDP)
;; WHEN: Fri Apr 28 17:34:55 BST 2023
;; MSG SIZE rcvd: 87
After one or (often) two executions the query time settles down to about 4ms (I was using nanoseconds above as I was comparing to the 1.1.1.1 resolver).
I have tried re-running the command at n-seconds after the first execution:
10 seconds = same
20 seconds = same
30 seconds = 15-20ms
The web admin UI indicates that no cache evictions are happening.
When I look at the query log in the web UI I can see that two record types are being resolved for, say, ubuntu.com in the UNCACHED state: A and DS
The DS record is forwarded to my router (not sure why??) on port 53 and returns NODATA in 14.2ms
The A record is forwarded to localhost#5053 and returns IP in 28.8ms
In the cached scenario I see only the A record returned and it's from the cache.