Redis primary key Failure Mechanism

Source: Internet
Author: User

What are the differences between memcached's primary key deletion method and redis?

First, memcached also uses a negative method when deleting an invalid primary key, that is, memcached does not monitor whether the primary key is invalid, but checks whether it has expired only when it accesses the primary key through get. Second, the biggest difference between memcached and redis in the primary key invalidation mechanism is that memcached does not actually Delete the invalid primary key as redis does, but simply recycles the space occupied by the invalid primary key. In this way, when new data is written to the system, memcached will give priority to those spaces with invalid primary keys. If the space for the invalid primary key is used up, memcached can use the LRU mechanism to reclaim the space that is not accessible for a long time. Therefore, memcached does not need to perform periodic deletion operations like redis, this is also determined by the memory management mechanism used by memcached. At the same time, it should be noted that redis can also configure the maxmemory-policy parameter to determine whether to use the LRU mechanism to reclaim memory space when OOM occurs.

Impact of redis primary key failure mechanism on system performance

Through the above introduction to the redis primary key invalidation mechanism, we know that although redis regularly checks the primary key with the expiration time set and deletes the primary key that has expired, however, by limiting the number of databases processed each time, the number of executions of the activeexpirecycle function in one second, the CPU time limit allocated to the activeexpirecycle function, and the percentage of expired primary keys that continue to be deleted, redis has greatly reduced the impact of primary key failure mechanisms on the overall system performance, however, in practical applications, if a large number of primary keys expire in a short period of time, the system's response capability will be reduced. Therefore, this situation should be avoided.

There are two primary key deletion methods for redis:

Passive way: if the primary key is accessed and it becomes invalid, delete it.

The active method periodically selects some expired primary keys from the primary keys with the expiration time set.

 

Http://redis.io/commands/expire
Http://redis.io/topics/latency
Http://www.cppblog.com/richbirda... 1/11/29/161184 .html
Http://www.cnblogs.com/tangtianf.../05/02/2479315.html

Redis primary key Failure Mechanism

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.