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 don't care 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 type of data, but also provides the storage of data structures such as List,set,hash.
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.
Analysis of the difference between Redis and memcache