Skip to content
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

Lru cache #6354

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Lru cache #6354

wants to merge 2 commits into from

Conversation

alanprot
Copy link
Member

@alanprot alanprot commented Nov 21, 2024

What this PR does:

Previously, the postings cache used a FIFO (First-In, First-Out) strategy for expiring items.

This PR updates the expiration strategy to LRU (Least Recently Used).

The implementation remains largely the same, with the key difference being that items are now moved to the back of the list whenever they are accessed. (items are expired from the front of the queue).

https://github.com/cortexproject/cortex/compare/master...alanprot:lru-cache?expand=1#diff-2fbd6f34014d2c606685456d6f0ff05de42c9df131c81bc28c6e225a89f5b7ecR343

I will keep this in draft for now.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@alanprot
Copy link
Member Author

cc @GiedriusS that is implementing the same in thanos.

Signed-off-by: alanprot <[email protected]>
@GiedriusS
Copy link
Contributor

Have you considered using some alternative and perhaps more efficient admission/eviction policies like TinyLFU or some others?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants