In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
How to solve the problem of too much redis data and too much memory? In view of this problem, this article gives the corresponding analysis and answers, hoping to help more friends who want to solve this problem to find a more simple and feasible way.
There is no doubt about the high performance and stability of redis as an in-memory database, but we put too much data into redis and too much memory, so if something goes wrong, it may bring us catastrophe.
The online business over the past few years shows that there is no doubt about the high performance and stability of redis, an in-memory database, but there is too much data and too much memory in redis, so if something goes wrong, it may bring us catastrophe (I think many companies have encountered it). Here are some of the problems we have encountered:
The main library is down
Let's take a look at the disaster recovery process of the main database downtime, as shown in the following figure:
When the main database is down, our most common disaster recovery strategy is "cut the master". Specifically, select a slave library from the remaining slave library of the cluster and upgrade it to the master library, and then mount the remaining slave library to become its slave database, and finally restore the whole master-slave cluster structure.
The above is a complete disaster recovery process, and the most costly process is the re-mounting of the slave database, rather than the switching of the master database.
Solution.
The solution, of course, is to try to reduce memory usage, which is what we usually do:
1 set expiration time
Set the expiration time for the timely key, through the redis's own expired key cleaning policy to reduce the memory consumption of the expired key, at the same time, it can also reduce the trouble of the business, and there is no need to clean up regularly.
2 do not store garbage in redis
This is nonsense, but is there anyone who feels sorry for us?
(3) clean up useless data in time.
For example, an redis carries the data of three businesses, and after a period of time, two businesses are offline, so you can clean up the data related to these two businesses.
4 compress the data as much as possible
For example, for some data in the form of long text, compression can greatly reduce memory footprint.
5 focus on memory growth and locate high-capacity key
Whether you are a DBA or a developer, if you use redis, you must focus on memory, otherwise, you are actually incompetent. Here you can analyze which key in the redis instance is larger to help the business quickly locate abnormal key (unexpected growth of key is often the source of the problem)
6 pika
If you really don't want to be so tired, then migrate the business to the new open source pika, so you don't have to pay too much attention to memory, and the problems caused by too much redis memory are not a problem.
This is the way to solve the problem of too much redis data and too much memory. I hope the above content can be helpful to you and 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.
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.