-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
plugin/cache: add a new keepttl option #5879
Conversation
It seems like setting the maximum TTL to the longest allowed TTL may be an easier way to solve that situation with the currently available options. It would leave the TTL unchanged, but also keep record in cache per their original TTL value thus sparing requests to the back end more so than caching for a shorted period of time. |
Hi! thanks for the quick reply :). I am not exactly sure what you mean though. The TTL seem to be always computed by subtracting the time in the cache plugin AFAIU: Line 98 in d3e4fc7
We are trying to do something similar to the dontAge option from dnsdist (https://dnsdist.org/reference/config.html?highlight=dontage):
EDIT: I just updated the doc it might be slightly clearer like that |
Thanks for the clarification. I think the feature would be problematic applied to any other situations. E.g. when caching responses retrieved from upstream servers. I think we should also add a note in the README that enabling this feature could result in downstream caching stale answers from upstream servers. Or perhaps that we don't recommend using this option for caching answers from upstream dns servers. IOW, it should not be used when caching records CoreDNS is not authoritative for because it could result in downstream clients using stale answers. |
Indeed better documentation is always good :D. I just added a note in the cache plugin readme like you advised! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just suggesting some tweaks to the wording.
Thanks for the wording suggestions, looks indeed better this way! |
Whenever CoreDNS is used as an authoritative server it could be useful to serve a consistent TTL (not decreased based on time) to clients and still use caching to spare request to the backend. This commit adds a new option `keepttl` to the cache plugin to do just that. This new option doesn't update any caching logic but just override the cache plugin answer. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## master #5879 +/- ##
==========================================
+ Coverage 55.70% 57.28% +1.58%
==========================================
Files 224 245 +21
Lines 10016 15738 +5722
==========================================
+ Hits 5579 9015 +3436
- Misses 3978 6175 +2197
- Partials 459 548 +89
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
adds a new option `keepttl` to the cache plugin Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
1. Why is this pull request needed and what does it do?
Whenever CoreDNS is used as an authoritative server it could be useful to serve a consistent TTL (not decreased based on time) to clients and still use caching to spare request to the backend.
This commit adds a new option
keepttl
to the cache plugin to do just that. This new option doesn't update any caching logic but just override the cache plugin answer.2. Which issues (if any) are related?
3. Which documentation changes (if any) need to be made?
To the cache plugin (included in this PR)
4. Does this introduce a backward incompatible change or deprecation?
no