Redis's recycling strategy __redis

Source: Internet
Author: User
Tags allkeys memcached volatile

1. What are the benefits of using Redis?

(1) Fast, because the data exists in memory, similar to the Hashmap,hashmap advantage is to find and manipulate the time complexity is O (1)

(2) Support rich data type, support string,list,set,sorted Set,hash

(3) Support transactions, operations are atomic, the so-called atomicity is to change the data is either fully executed, or all do not execute

(4) Rich features: can be used for caching, messages, set the expiration time by key, will be automatically deleted after expiration


2. What are the advantages of Redis compared to memcached?

(1) memcached All values are simple strings, redis as their replacement, support for richer data types

(2) Redis speed is much faster than memcached

(3) Redis can persist its data


3. Redis Common performance problems and solutions:

(1) Master is best not to do any persistent work, such as RDB memory snapshots and aof log files

(2) If the data is more important, a slave to open aof backup data, the policy is set to sync once per second

(3) In order to master the speed of replication and the stability of the connection, master and slave best in the same LAN

(4) As far as possible to avoid the pressure of a large main library to increase from the library

(5) Master-slave copy do not use a graph structure, with one-way linked list structure more stable, namely: Master <-Slave1 <-Slave2 <-Slave3 ...

Such a structure facilitates the resolution of a single point of failure and realizes the replacement of Master slave. If master hangs, you can immediately enable Slave1 to do master, other unchanged.


(a) Redis recycling strategy

VOLATILE-LRU: Select the least recently used data elimination from the set Expiration data set (Server.db[i].expires)

Volatile-ttl: Select the obsolete data set (Server.db[i].expires) from the set expiration date

Volatile-random: Arbitrary selection of data obsolescence from a set of expired data sets (Server.db[i].expires)

ALLKEYS-LRU: Select the least recently used data from the dataset (server.db[i].dict) obsolescence

Allkeys-random: Arbitrary selection of data elimination from datasets (SERVER.DB[I].DICT)

No-enviction (expulsion): Prohibition of expulsion data


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.