Conversation
Browsers cache TTL naïvely for 15 sec to 2 min. 12 hours is much too long. Serving stale content for up to half a day isn’t a great user experience. Match Firefox's DNS cache of 400 entries for up to 2 minutes. Mozilla experimented in 2018 with doubling their DNS cache from 400 to 800, but saw negligible improvements in cache hit ratios. https://bugzilla.mozilla.org/show_bug.cgi?id=1475781
|
Thank you for suggesting this change, the insight from Mozilla is quite interesting! There are more moving pieces than it seems, and we may not see the same benefits as Firefox had with raw DNS. Some quick notes why:
That being said, in the future we may start using the actual DNSLink For now, "Optimization potential" lays mostly in go-ipfs, so I am thinking about parking this PR at least until we get insight into DNSLink's TTL. When ipfs/kubo#5884 lands we could switch DNSLink cache to real TTL value + set higher cache for negative DNS responses just like you suggested. [1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1449171 |
Match Firefox's DNS cache of 400 entries for up to 2 minutes. Mozilla experimented in 2018 with doubling their DNS cache from 400 to 800, but saw negligible improvements in cache hit ratios.
12 hours is much too long. Serving stale content for up to half a day isn’t a great user experience. Browsers cache TTL naïvely for 15 sec to 2 min. (See my DNS TTL client survey for details.)
Note that Windows DNS Cache, macOS’ mDNSResponder, and so on may cache DNS responses for up to their TTL so this change shouldn’t be a massive performance reduction. Negative DNS responses (websites without DNSLink) mybe a different story, however as caching is usually limited to just a few seconds to a minute.
Optimization potential: