What are the differences between Redis, Memcache, and MongoDB (reproduced)

Source: Internet
Author: User
Tags memcached

Reproduced:

Http://leandre.cn/database/64.html

Memcached

Advantages of memcached :

The memcached can take advantage of multicore advantages, with a very high single-instance throughput of hundreds of thousands of QPS (depending on key, the byte size of value, and server hardware performance, which is around 4-6w in the daily environment). Suitable for maximum carrying capacity.

Supports direct configuration for session handle.

Less pits.

Limitations of memcached :

Only simple KEY/VALUE data structures are supported, unlike Redis, which supports rich data types.
Cannot be persisted, data cannot be backed up, it can only be used for cache use, and data is lost after reboot.

Data synchronization cannot be performed and data in the MC cannot be migrated to another instance of MC.

Memcached memory allocation uses the slab allocation mechanism to manage memory, which causes memory utilization to decrease when the value size distribution is large, and causes problems such as kicking out when low utilization occurs. Users need to focus on value design.

Redis
Advantages of Redis :
Supports multiple data structures such as String (string), list (doubly linked list), Dict (hash table), set (set), Zset (sort set), Hyperloglog (cardinality estimation)

Support persistent operation, AOF and RDB data can be persisted to disk, so as to carry out data backup or data recovery operations, better prevent data loss means.

Support the data replication through replication, through the master-slave mechanism, can be in real-time synchronous replication of data, support multi-level replication and incremental replication, master-slave mechanism is an important means of Redis ha.

Single-threaded requests, all commands are executed serially, and there is no need to consider data consistency issues in the concurrency scenario.

Support PUB/SUB Message subscription mechanism, can be used for message subscription and notification.

Supports simple transaction requirements, but industry usage scenarios are rare and immature.

Limitations of Redis :
Redis can only use a single thread and performance is limited to CPU performance, so the single instance CPU can reach 5-6wqps per second (depending on data structure, data size and server hardware performance, and the QPS peak in daily environments is around 1-2w).

Support simple transaction requirements, but the industry use of the scene is very small, immature, both advantages and disadvantages.

Redis consumes more memory on string types, and can use Dict (hash table) to compress storage to reduce memory consumption.

Add
Both MC and Redis are key-value types, are not suitable for establishing relationships between different datasets, and are not suitable for query search. For example, Redis's keys pattern, a matching operation, is a disaster for redis performance.

Mogodb
Mogodb is a document-type database. First explain the database of the document, that is, you can store XML, JSON, Bson type of data. These data are self-describing (self-describing), presenting hierarchical tree-like data structures. Redis can store simple relational data in hash.
MOGODB Store JSON-formatted data.

Suitable for scenarios: event logging, content management or blogging platforms, such as commenting systems.

There are a lot of nosql products, and the architect's choice is mainly based on the following two factors:

1) Suitable for the application of the use of the scene, such as the comment system is more appropriate to use MOGODB, and MC can also be implemented (the application to convert data into JSON, but some data update inconvenient)

2) The team develops familiar technologies, such as a team that has been using MC for a limited selection of MC rather than Redis.
In the middle of a serious situation, the development team has been using MOGODB to continue to select Mogodb in a scenario suitable for KV nosq.

What are the differences between Redis, Memcache, and MongoDB (reproduced)

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.