I have CNAME DNS records with 60 minutes as the TTL but dnsmasq is caching the DNS records only for a period of 5 minutes leading to too many DNS calls every 5 minutes when the cache entry expires.
I set the max-cache-ttl
option with 1 hour to see if it extends the maximum ttl value for dns records but didn’t see any difference.
I also tried enabling --use-stale-cache
option to have the cache refresh happen in background but it makes the performance of my application only worse.
Is anyone aware if there are any limitations in dnsmasq in caching DNS with more than 5 minutes of ttl value. Additionally is it possible to have dnsmasq only expire DNS records when there are no requests for the DNS record for a period of 5 minutes (LRU kind of cache).
Sharing my application’s dnsmasq configuration below
listen-address=127.0.0.1
port=5400
bind-interfaces
pid-file=/var/run/dnsmasq/dnsmasq5400.pid
resolv-file=/etc/resolv.dnsmasq
cache-size=10000
neg-ttl=600
min-cache-ttl=60
cache-rr=ANY
max-cache-ttl=36000
log-queries=extra
log-async=100
log-facility=/tmp/dnsmasq.log