Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What's the difference between redis and mongodb?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

What's the difference between redis and mongodb? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!

MongoDB is more similar to MySQL, supporting field index and cursor operation, its advantage is that the query function is relatively powerful, good at querying JSON data, can store massive data, but does not support transactions.

The efficiency of Mysql decreases significantly when there is a large amount of data, and MongoDB is more often used as an alternative to relational databases.

Mongodb eats more memory, because when mongo finds that there is not enough memory, it applies for memory at an exponential level of 2. Therefore, it is generally recommended to put the mongodb alone.

In fact, it can be said that redis is more like a caching mechanism, cookie, you can also set the expiration time of data, of course, it can be stored permanently (but it seems to be a little inferior? ). Mongodb is document storage.

Memory management mechanism:

All Redis data is stored in memory and written to disk periodically. When there is not enough memory, you can choose the specified LRU algorithm to delete the data.

MongoDB, like mysql, only puts the index file in memory. Implemented by the linux system mmap, when there is not enough memory, only the hot data is put into memory, and other data is stored on disk.

Supported data structures:

Redis supports a variety of data structures, including hash, set, list and so on.

MongoDB data structure is relatively simple, but supports rich data expression, index, most similar to relational database, and supports a wide range of query languages.

Performance:

Redis is more suitable for the performance and operation of small data volume.

Mongodb has better performance under the access of massive data.

Reliability:

Both support persistence.

Cluster:

MongoDB cluster technology is relatively mature, Redis has supported clusters since 3. 0.

Does not apply to scenarios:

Operations that need to use complex sql

A transactional system

Applicable scenarios:

Redis best application scenario: suitable for applications with fast data changes and database size (suitable for memory capacity).

MongoDB: the best application scenario: suitable for applications that need dynamic query support; need to use indexes instead of map/reduce functions; need to have performance requirements for large databases; and need to use CouchDB but fill up memory because data changes too frequently.

Thank you for reading! After reading the above, do you have a general understanding of the difference between redis and mongodb? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report