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

Maybe we can consider adding a solution to the problem of cache stampede #61

Open
wf58585858 opened this issue Nov 18, 2020 · 1 comment

Comments

@wf58585858
Copy link

In a high-concurrency system, at the moment of cache failure, a large number of requests will enter the database, which can easily cause the database to crash

reference:
https://www.wikiwand.com/en/Cache_stampede
https://symfony.com/doc/current/components/cache.html

@matej21
Copy link
Contributor

matej21 commented Nov 19, 2020

Hi,

  1. Locking - although it is not mentioned in documentation, if you use a second argument of load - generator callback, it actually uses a lock (if the storage supports locks - afaik redis does not support native locks and they must be emulated in some way).
  2. External recomputation - this could (and should) be solved in a userland
  3. Probabilistic early expiration - i like this idea

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

No branches or pull requests

2 participants