The difference between Redis and memcache

Source: Internet
Author: User
Tags memcached

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.

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.

Redis has a database feature in many ways, or a database system, and memcached is simply a k/v cache

Look at the Redis authors vs. Redis and Memcache

Source: Is memcached a dinosaur in comparison to Redis? (compared to redis,memcached really out of date?) )

you Should too much about performances. Redis is faster per core with small values, but memcached was able to use multiple cores with a single executable and TCP p ORT without help from the client. Also memcached is faster with big values in the order of 100k. Redis recently improved a lot of big values (unstable branch) but still memcached are faster in this use case. The point here Is:nor one or the other would likely going to be your bottleneck for the query-per-second they can deliver.

There is no need to be overly concerned about performance, because both are already high enough in performance. Because Redis uses only single cores, and memcached can use multicore, on average, Redis memcached performance when storing small data on a per-core level. In more than 100k of data, memcached performance is higher than Redis, although Redis has recently been optimized for the performance of storing big data, but it is slightly inferior to memcached. Having said so much, the conclusion is that no matter which one you use, the number of requests per second will not be a bottleneck. (such as bottlenecks may be in the network card)

Should care about memory usage. For simple key-value pairs memcached are more memory efficient. If You use Redis hashes, the Redis is more memory efficient. Depends on the use case.

If you want to say that memory usage efficiency, using simple key-value storage, memcached memory utilization is higher, and if Redis uses hash structure to do key-value storage, because of its combined compression, its memory utilization will be higher than memcached. Of course, this is related to your application scenario and data characteristics.

You should care about persistence and replication, and the other features only available in Redis. Even if your goal is to build a cache it helps a upgrade or a reboot your data is still there.

If you have requirements for data persistence and data synchronization, it is recommended that you choose Redis because neither of these features memcached. Choosing Redis is also wise, even if you just want the cached data to be not lost after upgrading or rebooting the system.

Your should care is about the kind of operations for you need. In Redis there is a lot of complex operations, even just considering the caching use case, you often can does a lot more in A single operation, without requiring data to being processed client side (a lot of I/O is sometimes needed). This operations is often as fast as plain GET and SET. So if you don ' t need just get/set and more complex things Redis can help a lot (think at timeline caching).

And, of course, you have to talk about your specific application needs in the end. Redis has more data structures and supports richer data operations than memcached, usually in memcached, you need to get the data to the client for similar modifications and set it back. This greatly increases the number of network IO and the volume of data. In Redis, these complex operations are often as efficient as the general get/set. So, if you need caching to support more complex structures and operations, Redis is a good choice.


1. Redis and memcache all store data in memory, which is the memory database. But memcache can also be used to cache other things, examples, videos, and so on.
2, Redis not only supports simple k/v types of data, but also provides data structures such as List,set,hash storage. 3. Virtual Memory--redis When the physical memory is exhausted, you can swap some long-unused value to disk 4. Expiration policy--memcache is specified when set, such as set Key1 0 0 8, which never expires. Redis can be set through, for example, expire, such as expire name 5, distributed-set memcache cluster, using Magent to do a master more from; Redis can do a master multi-slave. Can be a master one from 6, storage data security--memcache hang up, the data is gone; Redis can be saved to disk periodically (persisted) 7. After the disaster recovery--memcache hangs, the data cannot be recovered; Redis data can be recovered by aof after loss 8, Redis support data backup, that is, Master-slave mode of data backup. You may also like: memcache and Redis difference 2014.03.17 Memcache and Redis differencesThe difference between S and F in thinkphp------Dynamic cache (s method) and fast cache (F method) The difference between S and F in thinkphp------Dynamic cache (s method) and fast cache (F method) The difference between memcached and memcache,memcached 2014.03.17 The difference between memcached and memcache,memcached Win7 under 64-bit system memcache/memcached installation Tutorial Win7 under 64-bit system memcache/memcached installation Tutorial memcached Small examples of use instructions 2012.08.14 memcached Small examples of usage instructions please use memcache correctly and recognize Chu Memcache 2014.05.04 Please use memcache correctly and recognize Chu Memcache memcache Command memcache parameter 2012.06.18 memcache command Memcache parameters PHP Caching Technology PHP technology cache 2012.06.18 PHP Cache technology PHP Technology slow

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

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.