1,Redissupport for server-side data operations:Rediscompared toMemcached, with more data structures and support for richer data operations, typicallyMemcachedyou need to get the data to the client to make similar changes andSetgo back. This greatly increases the networkIOthe number of times and the volume of data. In theRedis, these complex operations are usuallyGet/setas efficient. So, if a cache is needed to support more complex structures and operations, thenRediswould be a good choice.
2, memory use efficiency comparison: Using simple key-value storage,Memcached Memory utilization is higher, and if Redis using hash structure to do key-value Storage, because of its combined compression, its memory utilization will be higher than Memcached .
3, performance comparison: Due toRedisonly single cores are used, andMemcachedMulti-core can be used, so on average each coreRediswhen storing small dataMemcachedHigher performance. And in100kin the above data,Memcachedperformance is higher thanRedis, thoughRedishas recently been optimized for the performance of storing big data, butMemcached, or slightly inferior.
specifically why the above conclusions appear, the following is the information collected:
1. Data types support different
with theMemcachedsupports only simpleKey-valuethe data record of the structure is different,Redisthe supported data types are much richer. The most commonly used data types are mainly five kinds:String,Hash,List,Setand theSorted Set. Redisinternal use of aRedisobjectobject to represent all theKeyand thevalue.
2. Different memory management mechanism
in theRedis, not all data is stored in memory all the time. This is andMemcachedcompared to one of the biggest differences. When the physical memory is exhausted,Rediscan be a long time useless to thevalueswap to disk. Redisonly caches all theKeythe information, ifRedisIt is found that memory usage exceeds a certain threshold and will triggerSwapthe operation,Redisaccording to"swappability = Age*log (size_in_memory)"figure out whichKeycorresponding to thevalueneed toSwapto disk. And then put theseKeycorresponding to thevaluepersisted to disk and purged in memory at the same time.
3. Data Persistence support
Although Redis is a memory-based storage system, it natively supports the persistence of memory data and provides two main persistence strategies:RDB snapshots and AOF logs. the memcached does not support data persistence operations.
4, the different cluster management
Memcached is a full-memory data buffering system,althoughRedis supports data persistence, but full memory is the essence of its high performance. As a memory-based storage system, the size of the machine's physical memory is the maximum amount of data the system can hold. If the amount of data that needs to be processed exceeds the physical memory size of a single machine, it is necessary to build a distributed cluster to extend the storage capacity.
This article is from the "11628205" blog, please be sure to keep this source http://11638205.blog.51cto.com/11628205/1917194
Learn the difference between Redis and Memcached