DNS Cache behavior, missed cache hits

DNS Cache behavior, missed cache hits

DNS Cache behavior, missed cache hits
DNS Cache behavior, missed cache hits
Friday - last edited Friday
Tags: #DNS
Model: ER707-M2  
Hardware Version: V1
Firmware Version: 1.2.1

Router: ER707-M2 v1.0 1.2.1

Controller: OC200 2.0 5.13.30.20

 

DNS Proxy: Enable

Proxy Type: DoH NextDNS

 

DNS Cache: Enable

TTL: 90 seconds

 

I'm trying to understand the DNS Cache behavior I am observing.

 

I have a container running UptimeKuma polling the router DNS every 60 seconds by requesting google.com which should be an extremely common domain I would expect to almost always be in the cache. Well, it should absolutely be in the cache is the polling is every 60 seconds but the TTL exceeds that at 90 seconds. Unless the cache is being flushed within that 60 second polling window.

 

When cache is OFF the router DNS response is ~24ms. Immediately after turning the cache on the router DNS response is ~1ms which seems to support the cache is working as intended and getting matching cache hits. So far so good.

 

However, after some amount of time, definitely less than 24 hours, the cache seems to stop working properly and every other poll seems to miss a cache hit based on the reported response times. It could be that the cache table has reached capacity and is being flushed. But my controller has exactly 0 logging related to the cache behavior. Even if that were the case I wouldn't expect it to appear to reliably flip-flop like this and during some extended periods it would happen to retain the cache. Particularly since google.com is such an active domain.

 

 

At the time I write this my DNS Cache table has less than 100 records total. With a 90 second TTL they expire reasonably quickly.

 

I am using a DNS proxy setup using DoH NextDNS. I have another monitor making the same DNS request for google.com but bypassing the router and directly accessing the NextDNS server directly by IP and that specific server has an average response of ~10ms. The summary says "ping" but it's a DNS lookup and you can see some of the historical IP resolution in the table below the chart. This isn't necessarily the same server the DNS Proxy is always using as the proxy is setup using a hostname not IP. But it's a datapoint for comparison and I mostly provide it here to illustrate any non-cache lookup by my router cannot be any faster than the response time from NextDNS.

 

 

Honestly, I just enabled this as an experiment to see how it performed. As a human I certainly don't notice any performance difference between 1ms and 24ms DNS lookups. So I can certainly continue to live without this feature like I was before DNS Cache was made available.

 

Thoughts? 

 

Is there some additional logging available that would help me understand how the DNS cache is being handled?

  0      
  0      
#1
Options
1 Accepted Solution
Re:DNS Cache behavior, missed cache hits-Solution
Friday - last edited Friday

I think the issue is my lack of understanding on how cache works. Watching the monitor and the cache list illustrated it is working exactly as designed.

 

- TTL 90 means the cache entry expires after 90 seconds. Period

- The fact things are querying the same domain is irrelevant, the cache entry will expire after 90 seconds

- Once it expires the next device that makes a DNS request for google.com will generate a fresh cache entry, and then that new try will then expire after 90 seconds

- So with a 90 second TTL my 60 second monitor polling will often be making its next request after the entry has expired

 

 

Recommended Solution
  1  
  1  
#2
Options
1 Reply
Re:DNS Cache behavior, missed cache hits-Solution
Friday - last edited Friday

I think the issue is my lack of understanding on how cache works. Watching the monitor and the cache list illustrated it is working exactly as designed.

 

- TTL 90 means the cache entry expires after 90 seconds. Period

- The fact things are querying the same domain is irrelevant, the cache entry will expire after 90 seconds

- Once it expires the next device that makes a DNS request for google.com will generate a fresh cache entry, and then that new try will then expire after 90 seconds

- So with a 90 second TTL my 60 second monitor polling will often be making its next request after the entry has expired

 

 

Recommended Solution
  1  
  1  
#2
Options

Information

Helpful: 0

Views: 30

Replies: 1

Tags

Related Articles