Reids cache penetration and avalanches and solutions

1. Cache penetration

Memory refers to the redis not in the database, the process of obtaining access to data persistence layer.

solution:

1. Bloom filter. The hash all possible data to a large enough bitap, there is no time to be intercepted this bitmap out, thus avoiding the pressure to access the persistence layer.

2. Set an empty value method to query the data is blank or abnormal, the value of this set of data is empty into redis, the next time will be the value from the cache.

2. Buffer avalanche

Refers to a certain time period, the buffer concentration expired.

solution:

1. Increase the cache expiration time

2. a cache for each cache tag corresponding increase in data, the recording buffer is invalid. If a cache miss, then update the data cache.

3. cache warming

System startup, will need to cache data loaded into the cache

4. cache update

1. clean up the timing of the expired cache.

2. When a request to check the cache has expired, expired, then update the cache.

5. Cache downgrade

When Sheremetyevo, through a number of programs, give up some data caching mechanism, to ensure the normal function of the normal operation of the cache.

6. Cache hot key

  1. mutex

  2. Never Expires

 

 

Guess you like

Origin www.cnblogs.com/baoyi/p/redis-error.html