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

feat(PE-6695/PE-6696): remove resolver, add redis support for arns cache #200

Merged
merged 10 commits into from
Sep 10, 2024

Commits on Sep 9, 2024

  1. feat(arns): remove resolver, add redis support for arns cache

    With on-demand resolution, we no longer need to support the arns-resolver. We can effectively fetch and cache arns resolutions quickly via AO and cache them locally or in redis. This replaces the default `MemoryArNSCache` with a configurable KvBufferStore that supports `redis` or a local `node-cache`. When resolving an arns name, the `CompositeArNSResolver` will check the provided cache and the TTL of the record, if it is not in the cache it will then use the available arns resolvers (on-demand and/or another gateway) to get resolution data. If an operator would like to disable caching of arns names, and always resolve to the latest they can set ARNS_CACHE_TTL_SECONDS to 0.
    
    Additionally, prometheus metrics are available for hit/miss rate for the arns cache and total resolution times.
    dtfiedler committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    037417e View commit details
    Browse the repository at this point in the history
  2. chore(kv): create abstract KvArnsStore to handle the hashing keys f…

    …or arns in cache
    
    This is to avoid doing it in the composite resolver
    dtfiedler committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    3b09c9e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ecb7574 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    379e027 View commit details
    Browse the repository at this point in the history
  5. chore(logs): add url to redis kv store

    dtfiedler committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    0041495 View commit details
    Browse the repository at this point in the history

Commits on Sep 10, 2024

  1. Configuration menu
    Copy the full SHA
    f1bd0cf View commit details
    Browse the repository at this point in the history
  2. feat(arns): add a promise cache for arns middleware

    This protects against multiple calls to `nameResolver.resolver(name)` while resolving a single name. The cache is given a short TTL and requests are removed after they are resolved. The best way to verify this behavior is trigger concurrent requests to resolve an arns name (e.g. using `hey`) and observing the logs to resolve the name only appear once for all the requests. Once the original promise is resolved, every outstanding request is resolved with the result and the name & promise are removed from the request cache.
    dtfiedler committed Sep 10, 2024
    Configuration menu
    Copy the full SHA
    d114821 View commit details
    Browse the repository at this point in the history
  3. feat(arns): add circuit breaker for calling the IO network process

    This should help avoid slamming AO when there are intermittent issues
    dtfiedler authored and dtfiedler committed Sep 10, 2024
    Configuration menu
    Copy the full SHA
    410cb5f View commit details
    Browse the repository at this point in the history
  4. fix(arns): update circuit breaker default timeouts

    dtfiedler authored and dtfiedler committed Sep 10, 2024
    Configuration menu
    Copy the full SHA
    b8afa1c View commit details
    Browse the repository at this point in the history
  5. fix(arns): returned cached resolution data if failed to fetch from re…

    …solvers
    
    If we have the resolution in the cache, and we fail to fetch new data from the resolvers, returned the cached resolution data. This data will expire based on the the ARNS_CACHE_TTL_SECONDS config variable.
    dtfiedler committed Sep 10, 2024
    Configuration menu
    Copy the full SHA
    b9e4fe6 View commit details
    Browse the repository at this point in the history