Maintained by: NLnet Labs

Questions on unbound_cache.sh

Timo Sigurdsson
Thu Aug 31 10:51:34 CEST 2017


Hi,

I'm looking into ways of improving the performance of unbound after it's just been started by either prefetching names or have some sort of "persistant" cache inbetween restarts. So, I came across the unbound_cache.sh script and have a few questions about that:

1) What's the purpose of the reload function in the script?
As far as I understand, the function does this: It saves the current unbound cache to a file via `unbound-control dump_cache`, then it loads the same file again into memory using `unbound-control load_cache`. But what's the point of this? I tried dumping the unbound cache on my system and when the cache is dumped. it's not cleared or flushed. So, there shouldn't be a need to load the same cache, that was just dumped, into memory again. And if loading the same file again doesn't do anything, then the save function of the script should suffice and the reload function could be dropped.
Am I missing something here?

2) The unbound-control man page warns about loading old cache dumps as it can lead to oudated answers being sent to clients. Is there a way to avoid or minimize that risk, like dropping answers which are expired? Or what would be a resonable maximum timespan beween dumping and loading the cache?
My idea is to save the cache to a file before the system shuts down or before unbound restarts, and then load the saved file if it isn't older than 5 minutes or so. Would that be reasonable or is loading cache data really only recommended for debugging?

3) In case that is a bad or unreasonable idea, I thought about using the warmup.sh script instead to prefetch e.g. the 1000 most used domain names when unbound starts. Is there a way of generating a list of frequently used domain names in my unbound cache sorted by how often these have been queried?

Thank you,

Timo