Memcached and Redis Cache

Source: Internet
Author: User
Tags message queue

Memcached:lru

Reasons for high concurrency support: multiplexed IO (message notification mode), multithreaded mode (number of cores in CPU)

Distributed scenarios:

# normal hash distribution (modulo)

# Consistent hash distribution (0-232 rings)


Redis

LRU: Remove one of the least recently accessed keys from the database

Random elimination algorithm: delete a key from the database randomly

TTL elimination algorithm: delete one of the fastest expired keys from the database


Object counter: Reference to Counter plus 1, reference Invalid-1, 0 Delete, can avoid concurrency problems.


Type of support:

String:

List: Doubly linked list (implements Message queue, head out, tail put)

Set: Unordered collection (poll, no duplicates)

Sorted set: Ordered set (number of top-post orders)

Hash: Hash table, similar to database tables (save user information)


Transaction processing


Persistence:

#内存快照: Depositing binary files

#日志追加


Master-Slave synchronization: No persistence is allowed on primary, slave can

Step: Slave Active connection master;slave SYCN command to Master request synchronization, master Backup to rdb;master the Rdb file to slave;slave empty the database, the RDB import.


Virtual Memory: When physical memory is low.


Clear data:

#定时清除

#用户获取数据时

Memcached and Redis Cache

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.