Analysis of the difference between Redis and memcache

Source: Internet
Author: User
Tags cas memcached value store

1. In Redis, not all data is stored in memory, which is the biggest difference compared to memcached.

2. Redis not only supports simple k/v types of data, but also provides storage of data structures such as List,set,hash. Memcached based on a hashmap that stores key/value pairs

3. Redis supports backup of data, that is, Master-slave mode of data backup.

4. Redis support data persistence, can keep the in-memory data on disk, restart can be loaded again for use.

Summary one:

Memcache Official definition Free & open source, High-performance, distributed memory object caching system, generic in nature, and in Tended for use with speeding up dynamic Web applications by alleviating database load.

Redis is the official definition of Redis is a open source, BSD licensed, Advanced Key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets. The same copyright they are used by the BSD protocol, the use of its projects can be used for commercial users, do not have to publish two modified code, you can modify the source code.

Data type Redis data type rich, support set Liset and other types memcache support simple data types, require clients to handle complex object persistence redis support data ground-floor persistent storage Memcache does not support data persistent storage distributed storage Redis supports Master-slave replication mode memcache can use consistent hash to do distributed value size is different memcache is a memory cache, key is less than 250 characters in length, a single item storage is less than 1M, not suitable for virtual machine use Data consistency different Redis uses a single-threaded model, which ensures that the data is submitted sequentially.

Memcache need to use CAS to ensure data consistency. CAS (Check and Set) is a mechanism for ensuring concurrency consistency and belongs to the "optimistic lock" category; The principle is simple: take the version number, operation, contrast version number, if the same operation, inconsistent on the abandonment of any operation CPU using the Redis single-threaded model can only use one CPU, Multiple Redis processes can be turned on.

Summary two:

1.Redis, not all of the data has been stored in memory, which is the biggest difference compared with memcached.

2.Redis not only supports simple k/v types of data, but also provides storage of data structures such as List,set,hash.

3.Redis backup of supporting data, i.e. Master-slave mode data backup.

4.Redis support data persistence, you can keep the in-memory data on the disk, restart the time can be loaded again for use. I personally think that the most fundamental difference is that Redis has a database feature in many ways, or a database system, and memcached is simply a k/v cache

Summary three: The difference between Redis and Memecache is that:

1, storage mode: Memecache The data all exist in memory, power off will hang up, the data can not exceed the memory size Redis has some of the hard disk, this can guarantee the durability of the data.

2. Data support type: Redis has much more data support than Memecache.

3, using the underlying model is different: The new version of Redis directly built the VM mechanism, because the general system calls system functions, it will waste a certain amount of time to move and request.

Analysis of the difference between Redis and memcache

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.