Summary of differences between Redis and Memcache

Source: Internet
Author: User

Conclusion 1:

Official definition of memcache

Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.

Official definition of redis

Redis is an 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

Both use the bsd Protocol. Projects that use it can be used for commercial users. You do not need to publish the code that is modified twice, but you can modify the source code.

Data Type

Apsaradb for redis supports a wide range of data types, including set liset.
Memcache supports simple data types and requires the client to process complex objects by itself.

Durability

Redis supports persistent data storage
Memcache does not support persistent data storage.

Distributed Storage

Redis supports master-slave replication Mode
Memcache can be distributed using consistent hash

Different value sizes

Memcache is a memory cache with a key length less than 250 characters and a single item storage less than 1 MB. It is not suitable for virtual machines.

Different Data Consistency

Redis uses a single-threaded model to ensure that data is submitted in order.
Memcache uses cas to ensure data consistency. CAS (Check and Set) is a mechanism to ensure concurrency consistency and belongs to the "optimistic lock" category. The principle is simple: Take the version number, operate, compare the version number, and operate if it is consistent, if they are inconsistent, discard any operation.

Cpu utilization

The single-threaded redis model can only use one cpu, and multiple redis processes can be enabled

Conclusion 2:

1. In Redis, not all data is stored in the memory, which is the biggest difference from Memcached.
2. Redis not only supports Simple k/v data, but also provides storage of data structures such as list, set, and hash.
3. Redis supports data backup, that is, data backup in master-slave mode.
4. Redis supports data persistence. Data in the memory can be stored on the disk and loaded again during restart.
I personally think the most essential difference is that Redis has database characteristics in many aspects, or is a database system, while Memcached is just a simple K/V cache.

Conclusion 3:

The difference between redis and memecache is:

1. Storage Method:
Memecache stores all the data in the memory. After the power is down, the data cannot exceed the memory size.
Some redis instances are stored on the hard disk to ensure data persistence.
2. supported data types:
Redis has more data support than memecache.
3. Use different underlying models:
The new version of redis directly builds its own VM mechanism, because the general system calls system functions, it will waste a certain amount of time to move and request.
4. Different runtime environments:
Currently, redis only supports LINUX, saving support for other systems. In this way, you can focus more on the optimization of the system environment, after that, a Microsoft team wrote patches for it. But not on the trunk

Memcache can only be used as a cache.
Redis content can be implemented, that is, it is similar to mongodb, and redis can also be used as a cache, and master-slave can be set.

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.