caching icon indicating copy to clipboard operation
caching copied to clipboard

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

Open wf58585858 opened this issue 4 years ago • 1 comments

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

wf58585858 avatar Nov 18 '20 07:11 wf58585858

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

matej21 avatar Nov 19 '20 13:11 matej21