【Quanyou app】Why use MongoDB database? What kind of data is suitable for storing in MongoDB database?

Why use MongoDB database?

The circle (dynamic) function involved in this project, users will like and comment on the circle of friends; then as the number of users continues to increase, information such as comments, likes and collections will also continue to increase; relatively speaking, users read these information More, less writing, that is, more reading and less writing; and it doesn’t matter if there is more or less data such as the number of comments/likes, it has no impact, and the value of the data is low; and the follow-up also involves a function, the display of nearby people , will also involve geographical location related data; all of the above, this project involves the processing of massive data, and read more and write less, the value of the stored data is low, and it also needs to include geographical location related data , etc.; if at this time It is inappropriate to use mysql or redis, and cannot efficiently process massive data, so the MongoDB database is used here.


What kind of data is suitable for storing in MongoDB database?

data characteristics

Large amount of data storage, even massive data;

Previously there were two options: MySQL and redis

redis: It is a memory-based database that can store massive amounts of data, but the cost is extremely high; if you want to store 1TB of data, then redis must prepare at least 1TB of memory, which is very expensive. therefore exclude

mySQL: can store massive data

Response requirements for data reading and writing are high

mysql: Although mysql can handle a large amount of data, as the data continues to increase, the speed of query or storage will gradually decrease; of course, it can also be optimized, which will consume a lot of manpower for sql tuning; then this Sometimes it takes a lot of time and manpower for some data that is not too important, which is a bit of a waste of resources. So exclude mysql

Some data security requirements are not high, and errors within a certain range are acceptable

Therefore, based on the above three requirements, mongodb database can be used to store data

Guess you like

Origin blog.csdn.net/zsy3757486/article/details/130500091