Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Clean cached data quickly #133

Closed
wenhaocs opened this issue Apr 20, 2022 · 1 comment
Closed

Clean cached data quickly #133

wenhaocs opened this issue Apr 20, 2022 · 1 comment

Comments

@wenhaocs
Copy link
Contributor

Hi,

We are using cachelib in a storage system with RAFT consensus. We are thinking of a way to invalidate all cache items in the cache quickly on partition leader change, to avoid cache incoherence. Since it's leader change, the callback must finish quickly, maybe 1s.

I am wondering whether cachelib can (1) support removing all keys in the cache with one function call (2) do this quickly. Our goal is just to make sure those keys are not found when calling cache.find(). It may be achieved by clearing all meta data or data in cachelib.

Thanks

@sathyaphoenix
Copy link
Contributor

The easiest way to do this would be to have an epoch for all the cache items that is bumped up on version change and let your application code do epoch checks after find() while having some background thread purge expired epochs or let them fall out of cache as the reads taper off. This does not accomplish your goal as you outline it above on how it can be done, but wonder if this meet the application level requirement to wipe out the cache. Few more questions

  1. what's the intent with clearing the cache on leader change ? Is it purely for coeherence to avoid stale reads from being served while routing change propagates ?

  2. do you have additional requirement to reclaim the cache space within a certain timeframe to make space for new data ?

@facebook facebook locked and limited conversation to collaborators Apr 20, 2022
@sathyaphoenix sathyaphoenix converted this issue into discussion #134 Apr 20, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants