Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unbound cache is lost upon container restart #217

Open
preethamvishy opened this issue Aug 24, 2023 · 1 comment
Open

Unbound cache is lost upon container restart #217

preethamvishy opened this issue Aug 24, 2023 · 1 comment

Comments

@preethamvishy
Copy link

When the pihole-unbound container is recreated/restarted, unbound appears to be building cache from scratch and there's a high number of cache misses compared to cache hits. Since you really reap the benefits of unbound's cached DNS resolution once the cache builds up, a restart of the container for any reason appears to undo the cache built up.

Is there a way to persist the unbound cache across restarts?

total.num.queries=584
total.num.queries_ip_ratelimited=0
total.num.cachehits=57
total.num.cachemiss=527
total.num.prefetch=2
total.num.expired=0
total.num.recursivereplies=527
total.requestlist.avg=3.0794
total.requestlist.max=44
total.requestlist.overwritten=0
total.requestlist.exceeded=0
total.requestlist.current.all=0
total.requestlist.current.user=0
...
time.up=883.899163
time.elapsed=883.899163
@burnbabyburn
Copy link
Contributor

burnbabyburn commented Aug 31, 2023

By default unbound stores cache in memory and thus it's normal to loose cache on restart. You need cachedb as described in the unbound documentation and ofc need a seperate docker volume to store unbound cachedb or an additional redis container. If you want to change default behaviour, you would have to invest some time (especially for the 2 container version in this repo)

But LMGTFY
Check if unbound has been compiled with --enable-cachedb
Setup cachedb config with or without redis backend - official documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants