The difference between Redis and Memcache 2

Source: Internet
Author: User
Tags cas value store

Summary one:

Memcache official definition

Free & Open Source, High-performance, distributed memory object caching system, generic in nature, and intended for us E in speeding to dynamic Web applications by alleviating database load.

Redis official definition

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.

Same copyright

They are all used by the BSD protocol, using its projects can be used for business users, without having to post two modified code, you can modify the source code.

Data type

Redis data type rich, support set Liset and other types
Memcache supports simple data types and requires clients to handle complex objects themselves

Durability

Redis supports data-on-ground persistent storage
Memcache does not support data persistent storage

Distributed storage

Redis supports Master-slave replication mode
Memcache can be distributed using consistent hash

Value varies in size

Memcache is a memory cache, the key is less than 250 characters in length, and a single item store is less than 1M, not suitable for use by a virtual machine

Data consistency is different

Redis uses a single-threaded model to ensure 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, the operation, the comparison version number, if the same operation, inconsistent to abandon any operation

CPU utilization

The Redis single-threaded model can use only one CPU to open multiple Redis processes

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 all of the data in memory, will be suspended after the power outage, the data can not exceed the memory size
Redis is partially present on the hard drive, which guarantees the data's durability.
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 builds its own VM mechanism, because a system function called by a general system can waste a certain amount of time moving and requesting.
4, the operating environment is different:
Redis currently only supports Linux, eliminating the support for other systems, which can be used to better optimize the environment of the system, although Microsoft has a team to write a patch for it. But not on the trunk.

Memcache can only be cached, cache
Redis content can be landed, which is similar to MongoDB, then Redis can also be used as a cache, and can be set Master-slave

The difference between Redis and Memcache 2

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.