dnsdist: keepStaleData is not that useful; entries expiring when servers online #16666
karelbilek
started this conversation in
Ideas
Replies: 2 comments 5 replies
-
|
I am making WIP draft on this branch https://github.com/karelbilek/pdns/tree/kb/alwaysKeepStaleData I will make it into a MR when I test it a bit more |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I realized when experimenting it will be better to implement it as LRU cache; so, in case of the cache filling, it will just remove the last accessed; it should be easy to implement with linked list edit: however that changes the locking logic; it doesn't seem like a simple task to keep both the current implementation (for the current behaviour) AND LRU/FIFO cache. Hm... |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In dnsdist, caches have keepStaleData option.
This option is not that useful; if the entries expire while the backends are still online, they are still deleted from the cache.
We need a cache that will keep the stale data there even when the backends are online; while they will not be served when they are online, they will also not be removed. (We need it for a local stub resolver that has the cache as a fallback in the case the actual resolver is down.)
I am currently implementing option called (name work-in-progress 😆 )
alwaysKeepStaleData, that will always keep the stale data.There is a problem though with the cache potentially being full, as nothing gets deleted; what I did is detect full shard and call something similar to
expungeto 1/2 in case it's full. (The expectation - in our case - is, that full cache is relatively rare and should not happen that often; so it's fine.)expungeas currently written just takes the elements ~randomly (the order is implementation detail of std::unordered_map), which is fine I guess? I don't want to spend too much time on sorting the entries by validity and removing the oldest, because that would lock the shard.Not sure if to add this feature as a new option, or to add it to
keepStaleData.Beta Was this translation helpful? Give feedback.
All reactions