Skip to content

Re-fetch almost-expired cache records #16586

@g0tar

Description

@g0tar
  • Program: dnsdist
  • Issue type: Feature request

Short description

Apparently dnsdist doesn't have analogue of recordcache.refresh_on_ttl_perc from recursor.

Usecase

Consider dnsdist used to load-balance traffic to non-authoritative forwarders.
When cached response's TTL is going low and some client asks for a record,
I'd like it to be responded from the cache and then (after response) proactively retried (forwarded) to keep the cache warm for next client.

Description

When dnsdist is put before authoritative server there's the dontAge cache setting.
But this can't be used in forwarder setup.

This is even worse, as forwarders age their cached TTLs as well, so for short-TTL-valued domains one can get additional latencies query after query. One can use SetReducedTTLResponseAction() or SetMinTTLResponseAction() to keep this more sane, but eventually every cached entry expires and next client runs into latency spike. The same would happen with packet cache initialized with minTTL value set.

Proposed solution makes every response available from the cache (even stalled ones), but still kept warmer for consecutive queries.
Having multiple forwarders should naturally help, as they wouldn't be all in-sync, so even if one forwarder returns short TTL, next query might hit second one with longer one. When using forwarders dnsdist doesn't know original (authoritative) TTL for a domain, so this setting should use seconds not percents.

When set to values longer than some domain's max, this would forward each and every query into forwarder, but in a more efficient manner than disabling cache entirely - the client would obtain previously cached response first, and only after this the cache would be refreshed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions