Redis data elimination mechanism

Source: Internet
Author: User
Tags allkeys

tag: CTI time C information of I/O file data

1. when a GB file is read and written to redis, The Machine resources are insufficient and the process is killed by the system. redis string theory supports 1 GB
2. scenario: the VM function has been deprecated in redis 2.6 and later versions. The redis persistence function has been disabled in the configuration file when the reids occupy more memory than the allocated memory.
1. volatile-LRU: Selecting the least recently used data from a data set with an expiration time out of redis is not a guarantee to obtain the least recently used key-value pairs in all datasets, only a few key-value pairs are randomly selected. When the memory reaches the limit, data sets with non-expiration time cannot be written.
2. volatile-TTL: Selecting expired data from a data set with an expiration time out of redis does not guarantee that the key-value pairs that will expire recently in all data sets will be obtained, only a few key-value pairs are randomly selected. When the memory reaches the limit, data sets with non-expiration time cannot be written.
3. volatile-random: has been set from Select any data in the data set during the specified period. When the memory reaches the limit, data cannot be written to a non-expired data set.
4. allkeys-LRU: selects the least recently used data from the dataset. When the memory reaches the limit, selects the least recently used data for all datasets for elimination, new dataset can be written
5. allkeys-random: selects any data from the dataset. When the memory reaches the limit, selects random elimination for all data sets and writes data to new data sets. no-enviction: Prohibit data eviction when the memory reaches the limit, no data is eliminated, no data can be written into any data set other redis support dynamic configuration change, no need to restart. Use config set X to set the option value.
Use config get X to obtain the option value. Run the dynamic configuration command: config set maxmemory 100000 (set the maximum memory)
config set maxmemory-policy noeviction (set the elimination policy to prohibit eviction)
info view redis real-time information used_memory memory used

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.