In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you what avalanche and penetration in redis means, I believe most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!
Cache avalanche
For system A, assuming that there are 5000 requests per second during the peak period every day, the cache can handle 4000 requests per second during the peak period, but the cache machine goes down unexpectedly. The cache is suspended, at this time 5000 requests per second all fall into the database, the database must not be able to bear, it will call the police, and then hang up. At this time, if there is no special solution to deal with this failure, DBA is in a hurry to restart the database, but the database is immediately killed by new traffic.
This is the cache avalanche.
About three years ago, a well-known Internet company in China lost tens of millions of dollars because of a cache accident that led to an avalanche and a complete collapse of the back-end system, which lasted from that afternoon to 3: 4 a.m. in the evening.
The solutions for caching avalanches before and after are as follows.
Beforehand: redis highly available, master-slave + Sentinel, redis cluster, avoid complete collapse.
In the event: local ehcache cache + hystrix current limit & downgrade to avoid MySQL being killed.
After the event: redis persistence, once restarted, automatically load data from disk, quickly recover cached data.
The user sends a request. After receiving the request, system A first checks the local ehcache cache, and then checks the redis if it is not found. If neither ehcache nor redis is available, check the database and write the results in the database to ehcache and redis.
Current-limiting component, you can set requests per second, how many can pass through the component, and what about the rest of the failed requests? Let's go! downgrade! You can return some default values, or friendly tips, or blank values.
Benefits:
The database will never die, and the current limiting component ensures that only how many requests can be passed per second.
As long as the database is not dead, that is to say, for the user, the request of 2DB 5 can be processed.
As long as there are 2Accord 5 requests can be processed, it means that your system is not dead, for users, it may be that a few clicks can not bring up the page, but a few more times, you can brush it out.
Cache penetration
For system A, assume 5000 requests per second, and 4000 of them are malicious attacks made by hackers.
The 4000 attacks sent by hackers can't be found in the cache, and every time you check in the database, you can't find them.
Give me a chestnut. The database id starts from 1, and as a result, all the requests sent by hackers are negative id. In this way, it will not be in the cache, and each request will query the database directly "as if it is cached in nothing". The cache penetration of this malicious attack scenario will directly kill the database.
The solution is simple: each time system A writes a null value to the cache as long as it is not found in the database, such as set-999 UNKNOWN. In this way, you can go to the cache next time.
The above is all the content of this article "what is the meaning of avalanche and penetration in redis". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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: 231
*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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.