Repository navigation
BUGFIX: Never expire Redis tag sets and warn about allkeys eviction policies - #3637
gradinarufelix wants to merge 1 commit into
Conversation
|
We already discussed that the case is real and a problem, however looking at this again, I wonder, shouldn't we just make sure the (tag) list entries never get a TTL and then document that you cannot use any "allkeys" policy for eviction if you want this to work and instead need to use "volatile" policies? Beach would obviously switch to that ASAP, now that I am thinking about it. Might be the cleaner way? IDK, both seem sensible I just fear this increases complexity a lot. For reference the "volatile" policies only evict entries with a set TTL, everything else cannot be evicted. So "volatile-lru" or "volatile-ttl" might be good fits (either least recently used or shortest remaining TTL) |
…olicies With an allkeys-* eviction policy, Redis can evict a tag set and keep its entries, which then can no longer be flushed by tag. Volatile-* policies only evict keys with an expiry time, so tag sets must never get one.
64a74cc to
3a767a0
Compare
|
Agreed, I switched the PR to your approach. Tag sets never get an expiry time now, and |
|
Thanks for picking this up. I'd ask to hold the Beach switch for a different reason: "tag sets never expire + finite lifetime + What happenedAll our Redis caches had a finite The current code already does almost what this PR does: Why never-expiring tag sets leak under
|
With an
allkeys-*eviction policy, Redis can evict a tag set and keep the entries it points to.flushByTag()then misses those entries, and their outdated content is served until they expire. We hit this on a Neos 8.4 site whose content cache runs on Redis withallkeys-lru.volatile-*policies only evict keys with an expiry time. Tag sets now never get one, so under such a policy Redis only evicts cache entries.getStatus()warns aboutallkeys-*policies, which shows up in./flow cache:listand./flow cache:show, and the documentation describes the setup.set()also stops looking up the expiry time of every tag set, which saves two Redis round trips per tag.Related: #2992 asks for tag sets to expire, which this change rules out.
Upgrade instructions
If your Redis server uses an
allkeys-*policy, switch tovolatile-lruorvolatile-ttl. Give caches that can outgrow the memory limit a finitedefaultLifetimefirst, because Redis rejects writes once it is full and has no key with an expiry time left to evict.Review instructions
Tag sets that still carry an expiry time from older versions lose it on their next write. On a 4 MB Redis with 3000 entries,
allkeys-lruleft 163 of 435 remaining entries unflushable by tag, whilevolatile-lruwith a 30 day lifetime evicted 2603 entries and kept every tag set.Checklist
FEATURE|TASK|BUGFIX!!!and have upgrade-instructions