Redis and Memcache comparison and selection
Http://www.cnblogs.com/EE-NovRain/p/3268476.html
In choosing the memory database when exactly when to choose Redis, when to choose Memcache, and then to find the corresponding information below, is from the Redis author's statement (StackOverflow above).
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.
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.
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.
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).
There are netizens translated as follows [1]:
There is no need to pay too much attention to performance. Since Redis uses only single cores, and memcached can use multicore, on average, Redis has a higher performance than memcached for storing small data on a per-core scale. 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.
You need to focus on memory utilization. For simple data storage such as Key-value, memcache memory usage is higher. If the hash structure is used, the memory usage of Redis will be higher. Of course, these depend on the specific application scenario.
You need to focus on data persistence and master-slave replication, only Redis has these two features. If your goal is to build a slow-to-exist upgrade or reboot before the data is not lost, then you can only choose Redis.
You should be concerned about the actions you need. Redis supports a lot of complex operations, and even only consider memory usage, you can often do a lot in a single operation, without having to read the data to the client (this will require a lot of IO operations). These complex operations are basically as fast as pure get and post operations, so Redis can play a big role when you don't just need to get/set but do more.
For the choice of the two or to see the specific application scenario, if you need to cache the data is only key-value such a simple structure, I still use memcache in the project, it is also stable and reliable enough. If you are involved in a series of complex operations such as storage, sorting, and so on, Redis is no doubt chosen.
As for the differences between Redis and memcache, here are some relevant statements for recording:
The difference between Redis and Memecache is [2]:
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 has a part of the hard disk, so as to ensure the persistence of data, support the persistence of data (the author note: There are snapshots and aof log two persistent methods, in the actual application, pay special attention to the configuration file snapshot parameters, or it is likely that the server is frequently loaded dump).
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.
Personal summary, there are persistent requirements or applications with advanced requirements for data structure and processing, choose Redis, other simple key/value storage, choose Memcache.
Redis and memcache comparison and selection