The advantages of Redis relative to Memcached in terms of functionality and features have become apparent. For performance, the Redis authors say that the performance is average to a single core, and Redis is better with little data. Why do you say that, the reason is that Redis is a single-threaded operation.
Because it is single-threaded, the overall performance will certainly be low compared to Memcached multithreading.
Because it is single-threaded, IO is serialized, network IO, and memory Io, so performance is affected when the single data is too large to be followed up by waiting for all of the IO of a command to complete for subsequent commands.
In terms of memory usage, Redis now combines Tcmalloc and jemalloc two memory analyzers, which are basically not the same as Memcached. If it is a simple and regular key value storage, then use the REDIS hash structure to do, the memory usage will be surprisingly small, the advantage is very obvious.
And Memcached is closer to Redis. They are memory-based database, data storage in memory, through the direct TCP access, the advantage is fast, high concurrency, the disadvantage is that the data type is limited, the query function is not strong, generally used as a cache.
Compared to Memcached:
1. Redis has a persistence mechanism that can periodically persist the data in memory to the hard disk.
2, Redis has the Binlog function, can write all operations to the log, when the Redis failure, can follow the Binlog data recovery.
3, Redis support virtual memory, you can limit the size of RAM, when the data exceeds the threshold, the most infrequently used data in memory is saved to the paging file of the hard disk by an algorithm similar to LRU.
4. Redis native supports more data types and uses more space for imagination.
Memcached and Redis