Skip to content

Updates global cache#1394

Merged
matsduf merged 5 commits intozonemaster:developfrom
matsduf:makes-global-chache-unexperimental
Nov 12, 2024
Merged

Updates global cache#1394
matsduf merged 5 commits intozonemaster:developfrom
matsduf:makes-global-chache-unexperimental

Conversation

@matsduf
Copy link
Contributor

@matsduf matsduf commented Oct 30, 2024

Purpose

This PR does three things about global (Redis) cache:

  1. Updates how and what caching time an item gets (more below).
  2. Changes the logic when TTL==0 by not saving to cache instead of setting TTL to 1 and chache that.
  3. Removes the experimental status of global cache.

Caching time and default for that

A DNS response can be of three type (when it comes to caching):

  1. Normal response with data in answer section, NXDOMAIN or NODATA. In these cases a TTL can be extracted from the DNS packet.
  2. Another response such as REFUSED or SERVFAIL where no TTL can be extracted from the packet.
  3. No response at all.

For response type 1 the extracted TTL value was used, but limited to cache.redis.expire (default 300 seconds, but much higher is needed to get full effect). For type 2 and 3 cache.redis.expire was used.

With this PR the logic for response type 1 is kept as it. For responses of type 2 and 3 a fixed value of 1200 seconds is used. The plan is to create a new profile element for type 2 and 3 to make that caching time settable.

Context

Global cache was introduced in release v2023.2 and has shown no issues. With this PR together with zonemaster/zonemaster#1303 it will become stable.

Fixes #1338

How to test this PR

  1. Review.
  2. Install Redis and activate.
  3. Update a profile with Redis and set expire not equal to 1200.
  4. Run an undelegated test with --ns that points at something outside that does not respond on port 53.
  5. Use redis-cli KEYS '*', redis-cli TTL KEY and redis-cli flushall
  6. for key in $( redis-cli KEYS '*' | cut -f2 ) ; do redis-cli TTL $key ; done

@matsduf matsduf added the A-Documentation Area: Documentation only. label Oct 30, 2024
@matsduf matsduf added this to the v2024.2 milestone Oct 30, 2024
@matsduf matsduf added the V-Minor Versioning: The change gives an update of minor in version. label Oct 30, 2024
@matsduf
Copy link
Contributor Author

matsduf commented Nov 6, 2024

@tgreenx, @marc-vanderwal, @mattias-p and @MichaelTimbert: now the global chache return without saving to cache when TTL==0.

marc-vanderwal
marc-vanderwal previously approved these changes Nov 7, 2024
tgreenx
tgreenx previously approved these changes Nov 7, 2024
@matsduf matsduf dismissed stale reviews from tgreenx and marc-vanderwal via a5d0ce2 November 7, 2024 16:15
@matsduf matsduf changed the title Removes the experimental status of global cache Updates global cache Nov 7, 2024
@matsduf
Copy link
Contributor Author

matsduf commented Nov 11, 2024

@marc-vanderwal and @tgreenx, please review.

Co-authored-by: tgreenx <96772376+tgreenx@users.noreply.github.com>
@matsduf matsduf requested a review from tgreenx November 12, 2024 10:33
@matsduf
Copy link
Contributor Author

matsduf commented Nov 12, 2024

@marc-vanderwal and @tgreenx, please re-review.

@matsduf matsduf merged commit e4e89b4 into zonemaster:develop Nov 12, 2024
@matsduf matsduf deleted the makes-global-chache-unexperimental branch November 12, 2024 14:05
@tgreenx tgreenx added the S-ReleaseTested Status: The PR has been successfully tested in release testing label Dec 4, 2024
@tgreenx
Copy link
Contributor

tgreenx commented Dec 4, 2024

Release testing v2024.2: no issues found.

@tgreenx tgreenx linked an issue Dec 9, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Documentation Area: Documentation only. S-ReleaseTested Status: The PR has been successfully tested in release testing V-Minor Versioning: The change gives an update of minor in version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove Redis caching when TTL is 0

4 participants