The comparison between MongoDB and Redis

Source: Internet
Author: User

Both MongoDB and Redis are NoSQL, using structured data storage. There are some differences between the two in the usage scene, which is mainly due to the process of the memory mapping, and the persistence processing method is different.

MongoDB recommended cluster deployment, more considering the cluster scenario, Redis is more emphasis on process sequential write, although the support cluster, but also limited to the master-slave mode.

Compare indicators MongoDB (v2.4.9) Redis (v2.4.17) Comparison notes
Implementation language C++ C + + -
Agreement BSON, Custom Binary Class Telnet -
Performance Memory dependent, higher TPS Memory dependent, TPS very high Redis is better than MongoDB
operability Rich data expression, index, most similar to relational database, support rich query statement Data-rich, less IO MongoDB is better than Redis
Memory and Storage Suitable for large data volume storage, dependent on system virtual memory, image file storage, high memory consumption ratio, the official recommended independent deployment in 64-bit system REDIS2.0 supports virtual memory features (VMS) Beyond physical memory limits, data can be set to timeliness, similar to Memcache Different application scenarios
Availability of Support Master-slave,replicatset (internal use of Paxos election algorithm, automatic failback), auto sharding mechanism, blocking the failover and slicing mechanism to the client Rely on the client to implement the distributed read and write, master-slave replication, every time from the node reconnect to the primary node to rely on the entire snapshot, no incremental replication; auto sharding is not supported, need to rely on the program to set the consistency hash mechanism MongoDB is better than Redis; On a single point problem, MongoDB application is simple, relative user transparent, Redis is more complex, need the client to actively solve. (MongoDB is typically combined with replicasets and sharding, replicasets focus on high availability and high reliability, sharding focus on performance, horizontal scaling)
Reliability Support for persistence in Binlog mode (MySQL-like) since version 1.8 Rely on snapshots for persistence; AOF enhances reliability and enhances performance while impacting access

Consistency Transactions are not supported, guaranteed by the client Support transactions, more brittle, only ensure that operations in the transaction are executed sequentially Redis is better than MongoDB
Data analysis Built-in data analysis capabilities (MapReduce) Not supported MongoDB is better than Redis
Application Scenarios Increased access efficiency for massive data Performance and operation of smaller data volumes MongoDB is better than Redis

The comparison between MongoDB and Redis

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.