Maybe we can consider adding a solution to the problem of cache stampede
wf58585858 opened this issue · 1 comments
wf58585858 commented
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 commented
Hi,
- 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).
- External recomputation - this could (and should) be solved in a userland
- Probabilistic early expiration - i like this idea