-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
IPNS record TTL/caching improvements #7564
Comments
This comment has been minimized.
This comment has been minimized.
@zot there are some good thoughts here, but I'd like to separate them out to make sure we're on the same page. The issue here is that the TTL serves two purposes:
This dual usage is what's causing the confusion, since By the way it's worth noting that:
There's actually an unlimited number number of results that can come through the channel. ResolveAsync for IPNS calls There are a number of IPNS/Namesys API things to fix, especially now that IPNS over PubSub can function independently from the DHT. IMO what would be better for our TTL problems here is to:
|
iirc in the past namesys cache was hardcoded to keep things for 1 minute. Kubo 0.24 improves things and leverages TTL of IPNS record for cache eviction (release notes). IPNS publisher now can control both @zot does this provide enough flexibility you've been looking for? Or are you looking into having an option to resolve with equivalent of stale-while-revalidate behavior from HTTP, where the best valid result is returned from cache immediately, but if TTL expired, the cache is updated asynchronously, without blocking requests? |
Namesys creates a cache with no eviction callback. This means that Namesys does nothing when records are dumped from the cache because their TTL expires.
So, if an IPNS record's TTL has expired, the peer dumps the record and fetches from the DHT. This means that even if the record hasn't actually changed the peer still has to wait for the fetch from the DHT. There's not a clear way for requesting peers to determine TTL or lifetime for IPNS records so that makes implementing alternate behavior difficult.
What about this behavior for ResolveAsync (maybe activated with a special ResolveOpt)?
When a record's TTL has expired but lifetime has not:
I think it'd just need a secondary cache based on lifetime for this and an eviction callback on the current lru that transfers records with expired TTLs to the secondary cache. The alternative ResolveAsync behavior could consult the secondary cache for records with expired TTL but not expired lifetime.
The text was updated successfully, but these errors were encountered: