Optimistic caching - what is it?

I read about optimistic caching on reddit, but i can't find the thread again. Here are a few questions.

What is optimistic caching?
How do i enable it on pi hole (not unbound)?
How much extra ram does it take up?
Do i have to increase 10000 caches?

Thanks for the help in advance.

This appears to be a term used by AdGuard Home to describe their implementation of DNS serve-expired:

  • cache_optimistic (since v0.107.0) — Make AdGuard Home respond from the cache even when the entries are expired and also try to refresh them. Before v0.108.0-b.5 the TTL for such responses is 60 seconds and since v0.108.0-b.5 it's 10 seconds.

Pi-hole does not offer this option, nor does it appear to be a dnsmasq option. You can do it in unbound with the serve-expired: and serve-expired-TTL options.

Likely very little.

Likely not. If you find that you get cache evictions, then you may need to increase your cache size, but this is rarely the case (i.e. almost never).

1 Like

@jfb Oh, ok. Since I am not interested in setting up unbound, is there a way to increase caching? My pi reboots every night, and I am at the default cache level (10000). How can I get it to cache more (it currently responds to 20% of queries from cache, and there are 0 evictions)?

You don't need a larger cache if you have no cache evictions.

https://docs.pi-hole.net/ftldns/dns-cache/#dns-cache-evictions

The amount of response from cache is generally unrelated to cache size - it is driven by the TTL of each reply from the nameserver. A shorter TTL is held in cache for a shorter period of time.

Nameservers define a TTL for each domain so the data does not become stale.

You will find that almost all TTL's are 5 minutes or less.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.