Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between cache breakdown, penetration and avalanche in html

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is about what is the difference between cache breakdown, penetration, and avalanche in html. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Cache breakdown (some hot spot key cache is invalid)

If there is no data in the cache but some data in the database, if it is hot data, key will have a large number of requests at the same time when the cache expires. These requests will break through to DB, resulting in a large number of instantaneous DB requests and increasing pressure.

The difference between caching avalanches and caching avalanches is that this is for a particular key cache, which is a lot of key.

Prevention: set hotspot data not to expire, update cache regularly for scheduled tasks, or set mutexes.

Cache traversal (query does not have data)

Query a data that does not exist, because the cache does not hit, and for fault tolerance, such as initiating an id of "- 1" does not exist.

If the data cannot be found from the storage layer, it will not be written to the cache, which will cause the non-existent data to go to the storage layer every time.

Query, lost the meaning of the cache. If there are a large number of queries that do not exist, DB may be dead, which is also a way for hackers to frequently attack applications with non-existent key.

Prevention: the interface layer adds verification, data rationality verification, and data that cannot be cached can not be obtained in the database. In this case, you can also write the key-value pair as key-null, and set the expiration time of the short point to prevent the same key from being attacked all the time.

Cache avalanche (multiple hotspots key expired)

A large number of key set the same expiration time, resulting in the failure of all caches at the same time, resulting in a large amount of instantaneous DB requests, a sudden increase in pressure, and an avalanche.

Prevention: the expiration time of the stored data is set randomly to prevent the expiration of a large number of data at the same time, the hot spot data is never expired, and the scheduled task is updated regularly.

Thank you for reading! This is the end of the article on "what is the difference between cache breakdown, penetration and avalanche in html". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report