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.
The difference and choice between memcached and Redis