Compare the performance of MongoDB and SQL Server 2008

In the following article, we will point out the difference in performance of the relatively new database management system, which is MongoDB and one of the popular systems like SQL Server (MySQL or Oracle). Most of the data is given here in the form of charts, so we can easily imagine the advantages and disadvantages of MongoDB as well as other database management systems.

TipsMake.com - In the article below, we will point out the difference in performance of the relatively new database management system, which is MongoDB and one of the popular systems like SQL Server (MySQL or Oracle). Most of the data is given here in the form of charts, so we can easily imagine the advantages and disadvantages of MongoDB as well as other database management systems.

Compare the performance of MongoDB and SQL Server 2008 Picture 1Compare the performance of MongoDB and SQL Server 2008 Picture 1
The chart is controversial about MongoDB inserting data more than 100 times faster than SQL Server

Imagine that you are establishing a system of online payment websites, which involves many different data units. If there is a database management system that operates faster than SQL Server many times, free of charge, it is easy to monitor and handle, your entire application system with LINQ (translated as query language Integrated into programming languages, MongoDB will certainly be a better choice.

And when there is such a database management system, we can deploy and operate on most of today's popular hardware devices, rather than high-end and dedicated server devices. It means that there is no need to buy or rent servers as before, and of course the initial cost must be much lower, while the profit or revenue is almost unchanged.

Another factor before we went into testing, member Kristina Chodorow from 10Gen organized a MySQL seminar in San Francisco with the Dropping ACID with MongoDB topic.

Here, Kristina has described quite specifically about SourceForge 's deployment experience in moving databases from MySql to MongoDB . On MySql platform, SourceForge has reached the limit of performance with a certain number of users. But with some changes in MongoDB options, the system has become much more stable.

Test model:

An intensive database model for online applications is enhanced to improve the ability to support as many users as possible. There will be many user accounts from online web applications, from API functions and many other related applications. Technically, users will interact directly with data by executing query statements, each of which corresponds to small pieces of data throughout the system. However, reality and theory are completely different, the above model is just what we are imagining.

Compare Insert function:

This is the most obvious difference between MongoDB and SQL Server :

Compare the performance of MongoDB and SQL Server 2008 Picture 2Compare the performance of MongoDB and SQL Server 2008 Picture 2

This process is done by inserting 50,000 independent objects using NoRM of MongoDB and LINQ to SQL for SQL Server 2008 . The sample model is as follows:

Compare the performance of MongoDB and SQL Server 2008 Picture 3Compare the performance of MongoDB and SQL Server 2008 Picture 3
MongoDB

Compare the performance of MongoDB and SQL Server 2008 Picture 4Compare the performance of MongoDB and SQL Server 2008 Picture 4
SQL Server

Then, run 5 client applications into the database with the insert function:

Compare the performance of MongoDB and SQL Server 2008 Picture 5Compare the performance of MongoDB and SQL Server 2008 Picture 5
MongoDB

Compare the performance of MongoDB and SQL Server 2008 Picture 6Compare the performance of MongoDB and SQL Server 2008 Picture 6
SQL Server

And look closely at the most important piece of information shown here, which is the execution time:

Compare the performance of MongoDB and SQL Server 2008 Picture 7Compare the performance of MongoDB and SQL Server 2008 Picture 7
MongoDB

Compare the performance of MongoDB and SQL Server 2008 Picture 8Compare the performance of MongoDB and SQL Server 2008 Picture 8
SQL Server

Easy, you can see the difference between 2 seconds - MongoDB and 205 seconds - SQL Server. To ensure the authenticity of the results, we re-implemented the program based on ADO.NET, and the speed of SQL was raised to about 1.5 to 3 times the previous one. Making a simple calculation, MongoDB is still about 30-50 times faster than SQL.

Query speed comparison:

Next, we move on to the process of separating data from the same object in the ID field of each record:

Compare the performance of MongoDB and SQL Server 2008 Picture 9Compare the performance of MongoDB and SQL Server 2008 Picture 9

Looking at the chart above, it is clear that MongoDB still outperforms SQL in terms of performance (about 3 times). To continue, let's standardize a slightly more complex data table with foreign keys - Foreign Key and join:

Compare the performance of MongoDB and SQL Server 2008 Picture 10Compare the performance of MongoDB and SQL Server 2008 Picture 10
MongoDB

Compare the performance of MongoDB and SQL Server 2008 Picture 11Compare the performance of MongoDB and SQL Server 2008 Picture 11
SQL Server

The results shown here are similar to previous tests without having to join:

Compare the performance of MongoDB and SQL Server 2008 Picture 12Compare the performance of MongoDB and SQL Server 2008 Picture 12

All tests are done on Lenovo T61 laptop, 64-bit Windows 7 operating system with 2.8 GHz processor, using 64 bit version of SQL Server 2008 Standard and MongoDB. The entire sample you can download via MediaFire.

3.8 ★ | 12 Vote