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 language |
Data-rich, less IO |
MongoDB is better than Redis |
Memory and Storage |
Suitable for large data volume storage, relying on system virtual memory management, using image file storage, memory share is high, the official recommendation is independently deployed in 64-bit system (32 bits have the maximum 2.5G file limit, 64 bit no change limit) |
After Redis2.0, the virtual memory feature is added to break the physical memory limit; Data can be set to timeliness, similar to Memcache |
Different application point of view, each has advantages |
Availability of |
Support Master-slave,replicaset (internal use of Paxos election algorithm, automatic fault recovery), auto sharding mechanism, blocking the failover and segmentation 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, automatic sharding is not supported, requires a dependent program to set the consistent 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 replica sets and sharding features, replica sets focuses on high availability and high reliability, while Sharding focuses on performance, easy scalability) |
Reliability |
From the 1.8 release, the binlog approach (MySQL is also used in this way) supports persistence, increasing reliability |
relies on snapshots for persistence, aof enhances reliability, and improves reliability while impacting access performance |
MongoDB is better than Redis |
Consistency |
Do not support things, by the client's own assurance |
To support things, weaker, only to ensure that the operations of things in order to execute |
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
|