Redis and Memcached difference

  • Memcached is multi-threaded and single-threaded use Redis. (Memcached think on reading and writing processing speed because the Redis)
  • Memcached using pre-allocated memory pool embodiment, the Redis manner using a field memory to store application data, and may configure the virtual memory.
  • Redis can achieve persistent (that is redis often need to synchronize the data in memory to the hard drive to ensure persistent), master-slave replication, failover and failback.
  • Memcached simply key and value, but more support Redis data types. It comprises a string (string), list (list), set (collection), zset (sorted set - ordered set) and hash (hash type).

Redis supports two persistent ways:

   (1): snapshotting (snapshot) is the default mode (make a backup of the data, the data stored in the file).

   (2) Append-only file (abbreviation aof) way 

   A snapshot is the default persistence approach, which is the memory data as a snapshot writes binary file, the default file name is dump.rdb. Snapshots can be done automatically by persistent way configuration settings. We can redis disposed within n seconds, if more than m key keys do automatically modify the snapshot.

   aof way: As the snapshot approach is to do a certain interval of time, so if redis accidentally fall down, they would lose all changes after the last snapshot. aof better than snapshots lasting resistance, due to the use aof, redis will each write command received by the write function are added to the file, when redis will restart by re-executing file saved write command to rebuild your entire database in memory. 

Published 224 original articles · won praise 14 · views 40000 +

Guess you like

Origin blog.csdn.net/xulong5000/article/details/104922132