DnsLibs icon indicating copy to clipboard operation
DnsLibs copied to clipboard

Allow persisting the DNS cache

Open ameshkov opened this issue 4 years ago • 4 comments

This is quite important on mobile devices since they often change networks and this triggers new DNS queries. Persisting DNS cache would allow us to save quite a lot.

However, we should also allow:

  1. Easily clearing this (API? or just removing the file?).
  2. This feature should be optional.

ameshkov avatar Feb 18 '21 22:02 ameshkov

@ameshkov Shouldn't we flush the cache on network change anyway?

ngorskikh avatar Mar 30 '21 15:03 ngorskikh

@ngorskikh what's important is whether the upstream DNS server changed. If it didn't then we can reuse the cache.

ameshkov avatar Mar 30 '21 20:03 ameshkov

@ameshkov I think, if upstream server is anycast or use ECS, resolve result may be different after network change even with the same upstream.

sfionov avatar Mar 31 '21 07:03 sfionov

@sfionov well, yes, but would it cause any issues? I honestly doubt it.

The question is how much would the savings be if we employ a persistent cache (ideally -- persistent + optimistic caching). Can we run a simple experiment on an Android device and see what the savings are?

ameshkov avatar Mar 31 '21 08:03 ameshkov