In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail the methods to ensure that the data in redis are hot data. The content of the article is of high quality, so I hope you can get something after reading this article.
When the memory used by redis exceeds the set maximum memory, redis's key elimination mechanism is triggered. There are six elimination strategies in redis 3.0:
Noeviction: do not delete the policy. When the maximum memory limit is reached, an error message is returned directly if more memory is needed. (redis default phase-out strategy)
Allkeys-lru: priority is given to deleting the most recently used (less recently used, LRU) key in all key.
Allkeys-random: randomly delete a portion of the key in all key.
Volatile-lru: priority is given to deleting the least recently used (less recently used, LRU) key in the key with the timeout (expire) set.
Volatile-random: randomly delete a portion of the key in the key where the timeout (expire) is set.
Volatile-ttl: in the key where the timeout (expire) is set, the key with short remaining time (time to live,TTL) is deleted first.
Scene:
There are 1000W data in the database, but only 50w data in redis. How to ensure that the 10w data in redis are all hot data?
Scheme:
Limit the memory occupied by Redis, and Redis will leave hot data to memory according to its own data elimination policy. So, calculate the approximate memory consumption of 50W of data, then set the Redis memory limit, and set the elimination policy to volatile-lru or allkeys-lru.
Set the maximum memory usage of Redis:
Open the redis configuration file and set the maxmemory parameter. Maxmemory is the bytes byte type.
# In short... If you have slaves attached it is suggested that you set a lower# limit for maxmemory so that there is some free RAM on the system for slave# output buffers (but this is not needed if the policy is' noeviction'). # # maxmemory maxmemory 268435456
Set the expiration policy:
The above maxmemory-policy volatile-lru is the way to ensure that the data in redis are all hot data. is there anything to gain after reading it? If you want to know more about it, you are welcome to follow the industry information. Thank you for reading.
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.