When do you need mongodb in comparison with MySQL?
Original link: When should I with MongoDB rather than MySQL (or other RDBMS): the billing Example (Compile/Zhonghao review/Mao Mengqi)
"Editor's note" with the explosion of data, NoSQL is getting more attention, but does your use case really need to use a NoSQL database? Is it really appropriate to use NoSQL? Recently, Moshe Kaplan, vice president of Bright Aqua Research and Development, took the Billrun system as an example to analyze MongoDB's advantages and usage scenarios:
The following are the translations:
NoSQL has been popular for a long time, so what is the scenario in which you need to use these "new things", like MongoDB? Here are some summaries:
You expect a higher write load
By default, MongoDB is more concerned with high insertion speeds than transaction security. If you need to load a lot of low-value business data, MongoDB will be a good fit for your use case. However, you must avoid using MongoDB in scenarios where high transaction security is required, such as a $10 million transaction.
Unreliable environments guarantee high availability
Setting up a replica set (master-Slave server settings) is not only convenient and fast, but also enables fast, secure, and automated failover of nodes (or data centers) using MongoDB.
There's going to be a big scale in the future.
Database extensions are challenging, and when the single table size reaches 5-10GB, there is no doubt that MySQL table performance will degrade. If you need to Shard and split your database, MongoDB will easily achieve this.
Using location-based data queries
MongoDB supports two-dimensional spatial indexing so that data can be obtained quickly and precisely from a specified location.
The explosion of unstructured data grows
Adding columns to an RDBMS in some cases may lock down the entire database, or increase the load to cause performance degradation, which usually occurs when the table is larger than 1GB (and the pain points in the Billrun system are mentioned below-a few gigabytes in a single table). Given MongoDB's weak data structure pattern, adding 1 new fields will not have any effect on the old table, the whole process will be very fast, so you don't need a dedicated 1 dba to modify the database schema when the application changes.
Lack of professional database administrator
If you don't have a professional DBA and you don't need to structure your data and make a join query, MongoDB will be your first choice. MongoDB is well suited for class persistence, and classes can be serialized into JSON and stored in MongoDB. It is important to note that if you are looking for a larger scale, you must understand some of the best practices to avoid getting into the wrong way.
billrun--using MongoDB billing system |2014 February mug IL (from oc666)Practical use case Learning: Billing
On the last Ilmug, Ofer Cohen proposed Billrun, a next-generation MongoDB-based open-source billing solution. The billing system has been used by the fastest-growing Israeli mobile phone operators to process more than 500 million of CDR (Communication Records) per month, and Ofer shares how the system leverages MongoDB's advantages:
PPT please visit slide Share
- The weak data structure pattern allows the system to quickly introduce new CDR types, and Billrun is responsible for hosting all of the data.
- The Billrun system has managed terabytes of tables, and I/O performance is limited by the addition of new fields and the growth of data volumes.
- Fast replica sets allow for more simple provisioning of multiple data center DRP and HA scenarios.
- Shards allow linear scale-out when I/O is over budget.
- MongoDB is ideal for high-write systems when the CDR insertion reaches 2000 per second. At the same time, you can use Findandmodify (which can affect performance) and 2-phase commit (application level) to resolve transaction issues.
- Developer-oriented queries allow the writing of elegant queries.
- Location-based allows better analysis of user usage to better develop investment points for mobile phone infrastructure.
Summarize
MongoDB is a very good tool, but only in the right scenario to explode an overwhelming advantage, Billrun is a good use case.
Compare MySQL, when exactly when you need MongoDB (turn)