Both MongoDB and Redis are NoSQL and adopt structured data storage. There are some differences between the two in use scenarios. This is mainly because the two have different persistence processing methods in the memory ing process. Apsaradb for MongoDB is recommended for cluster deployment. considering more cluster solutions, apsaradb for Redis focuses more on sequential process writing. Although clusters are supported, it is only limited to master-slave
Both MongoDB and Redis are NoSQL and adopt structured data storage. There are some differences between the two in use scenarios. This is mainly because the two have different persistence processing methods in the memory ing process. Apsaradb for MongoDB is recommended for cluster deployment. considering more cluster solutions, apsaradb for Redis focuses more on sequential process writing. Although clusters are supported, it is only limited to master-slave
Both MongoDB and Redis are NoSQL and adopt structured data storage. There are some differences between the two in use scenarios.
In the memory ing process, the persistence processing methods are different. Apsaradb for MongoDB is recommended for cluster deployment.
It is more focused on process sequential writing. Although clusters are supported, it is also limited to master-slave mode.
Metrics |
MongoDB (v2.4.9) |
Redis (v2.4.17) |
Comparison description |
Implementation Language |
C ++ |
C/C ++ |
- |
Protocol |
BSON, custom binary |
Class Telnet |
- |
Performance |
Dependent memory, high TPS |
Dependent memory, TPS is very high |
Redis is better than MongoDB |
Operability |
Rich data expressions and indexes. It is most similar to relational databases and supports a wide range of query languages. |
Rich data and less IO |
MongoDB is better than Redis |
Memory and storage |
Suitable for storing large amounts of data, relying on system virtual memory management, using image file storage; high memory usage, the official recommendation is to independently deploy in 64-bit systems (32-bit has a maximum file limit of GB, 64-bit unlimited) |
After Redis2.0, the virtual memory feature is added to break through the physical memory limit. data can be set to time-sensitive, similar to memcache. |
Different application perspectives have their own advantages |
Availability |
Support master-slave, replicaset (internal use of paxos Election Algorithm, automatic fault recovery), auto sharding mechanism, shielding the client from failover and splitting mechanisms |
The client is used to implement distributed read/write. During master-slave replication, the entire snapshot is required for every re-connection from the slave node to the master node without incremental replication. Automatic sharding is not supported and consistent hash mechanism needs to be set by the program. |
MongoDB is better than Redis. For single point of failure (spof), The MongoDB application is simple and transparent to users. Redis is complicated and needs to be actively solved by the client. (MongoDB generally uses the replica sets and sharding functions in combination. replica sets focus on high availability and reliability, while sharding focuses on performance and scalability) |
Reliability |
Later than MySQL 1.8, the binlog method (MySQL also adopts this method) is used to support persistence and increase reliability. |
Snapshot-dependent persistence; AOF enhances reliability; enhances reliability while affecting access performance |
MongoDB is better than Redis |
Consistency |
Transactions are not supported. It is ensured by the client itself. |
Transaction support, relatively weak, only ensures that operations in the transaction are executed in order |
Redis is better than MongoDB |
Data Analysis |
Built-in data analysis (mapreduce) |
Not Supported |
MongoDB is better than Redis |
Application scenarios |
Improved access efficiency of massive data |
Performance and computation of small data volumes |
MongoDB is better than Redis |