Redis cache penetration and avalanche

A cache avalanche

1. Cache hung up, all requests to the database

2. Cache did not hang, but at the same maturity, just put all the caches are deleted, all requests to the database

3. All requests to the database, the database is likely to hang out

 

Second, the buffer solution avalanche

1. caches hanging case

a front incident: redis achieve high availability (master-slave + sentinal + cluster)

b incident: local cache + restrictor (Hystrix)

c After the incident:. Redis persistence, after the restart to load data from disk, quick recovery

 

Third, the cache penetration

1. Every time a query data does not exist, because there is no found from the database, not into the cache, so there is no data to the database query to be

2. The requested data is not a lot of hits in the cache, resulting in a request to the database, called cache penetration

 

Fourth, the cache penetrating solution

1. calibration parameters

2. Empty objects are also placed in the cache, and set a shorter expiration time

 

Guess you like

Origin www.cnblogs.com/june0816/p/11463036.html
Recommended