NLnetLabs / unbound

Unbound is a validating, recursive, and caching DNS resolver.
https://nlnetlabs.nl/unbound
BSD 3-Clause "New" or "Revised" License
3.02k stars 347 forks source link

about domain prefetch #655

Open ziojacky opened 2 years ago

ziojacky commented 2 years ago

i use redis for cache backend and enable domain prefetch function, but ttl end unbound don't auto prefetch domain, prefetch function only work unbound self cache?

wcawijngaards commented 2 years ago

I thought that prefetch would work for the cachedb backend much like other content. But if the record is only in cachedb and not in the self cache, then the prefetch does not happen. But if there is a time before expiry, and another query comes in, since the query is now in the self cache, it can be prefetched at that time.

ziojacky commented 2 years ago

memory cache how many domain names can be prefetch? i try dig 4000+ domain get cache, wait ttl over have more domain cache will lost but not prefetch.

wcawijngaards commented 2 years ago

The cache can contain many records, and you can configure how much in the config file with the msg and rrset cache sizes. The prefetch happens for entries in the cache, and is based on timers. It can therefore work on all of them. But would only work for entries that are popular. If entries are not queried for they become expired without a prefetch. There is also a feature called serve-expired where unbound serves expired information if it has not updated the information in the mean time.