From the following several dimensions, the Redis, Memcache, MongoDB made a comparison, welcome to shoot Bricks
1. Performance is relatively high, performance for us should not be the bottleneck overall, the TPS () aspect of Redis and Memcache is about the same, more than MongoDB
2. Ease of operation MEMCACHE data structure single Redis rich, data manipulation, Redis better, less network IO times MongoDB supports rich data expression, index, most similar relational database, support query language is very rich
3. The size of the memory space and the size of the data the Redis has added its own VM features after the 2.0 release, breaking the limits of physical memory; You can set the expiration time (like memcache) on key value Memcache can modify the maximum available memory. Using the LRU algorithm MongoDB suitable for large data storage, relying on operating system VMs to do memory management, eat memory is also more severe, service not with other services together
4. Availability (single point of issue)
For a single point of issue:
Redis, relying on the client to achieve distributed read and write, master-slave replication, every time from the node reconnect to the main node to rely on the entire snapshot, no incremental replication, because of performance and efficiency problems, so the single point of the problem is more complex, does not support automatic sharding, need to rely on the program to set the consistent hash mechanism. An alternative is to use your own proactive replication (multiple storage) instead of Redis's own replication mechanism, or change it to incremental replication (you need to implement it yourself), and the tradeoff between conformance and performance Memcache itself without a data redundancy mechanism, and no need; for fault prevention, The problem of jitter caused by single point of failure is solved by using a mature hash or loop algorithm. MongoDB supports Master-slave,replicaset (internal using Paxos election algorithm, automatic fault recovery), auto sharding mechanism, blocking the failover and segmentation mechanism to the client.
5. Reliability (persistent)
For data persistence and data recovery,
Redis Support (snapshot, AOF): dependent on snapshot for persistence, AOF enhanced reliability, performance impact memcache not supported, usually used in cache, improve performance; MongoDB starts with the 1.8 version of Binlog to support persistent reliability
6. Data Consistency (transactional support) Memcache in concurrent scenarios, using CAs to ensure consistent redis transaction support is weaker, only to ensure that each operation in the transaction continuously executes MongoDB does not support transactions
7. Data Analysis
MongoDB has built-in data analysis capabilities (MapReduce), others do not support
8. Application Scenario Redis: More performance operation and operation on Memcache: for reducing database load in dynamic system, improving performance, caching, improving performance (suitable for read and write less, large data volume, can use sharding)
MongoDB: The main solution to the massive data access efficiency problem
Turn from and http://blog.sina.com.cn/s/blog_9c581bd30101d5s8.html