Cache penetration, cache, and cache avalanche breakdown

1. Cache penetration

1.2 Description of the problem

When the user requests that the cache data corresponding to the breakdown of the query result in the database is empty, the result is not cached, causing each query would access the database is empty

1.2 Solution

Query the database to null the key is also cached, set a certain expiration date, so that only the key failure of the amount of time to access the database, the database can reduce stress

2. Cache avalanche

2.2 Description of the problem

At the same time, a large number of key failures, leading to these key access rests on the database, causing huge pressure on the database

2.2 Solution

Randomly setting key of the expiration time , so that the key expiration time evenly distributed, thereby dispersing pressure database

3. Cache breakdown

3.2 Description of the problem

Failure frequently accessed hot data, resulting in a large number of hot data access time fall on the database, the database may lead to collapse

3.2 Solution

Hot frequently accessed data can not be set to a permanent failure


Subsequent updates java + redis + springboot implementation code

Published 17 original articles · won praise 1 · views 647

Guess you like

Origin blog.csdn.net/c_c_y_CC/article/details/104124446