Tech - NOSQL Tutorial - Part 3 (Performance)


​As promised, here are the results of the database shoot out between MongoDB and SQL Server. Before we get into the results, a few things worth noting. The objective of the performance test is a simple use case - search data based on some keys. I have a few self imposed principles to ensure that the test is fair and square -

  • Use the standard configuration for the databases so that it's a fair comparison.
  • Exactly the same data loaded into both the databases, including creating the same kind of indexes too.
  • Exactly the same queries and parameters used for both the databases.
  • Exactly the same client used to execute the queries against both the databases.
  • The same kind of OS and underlying hardware (CPU, RAM etc).


There are 3 separate database servers that have been used here. They are -

  • Server 1 - Windows 2008 R2 (64 bit) physical server running MongoDB (64 bit).
  • Server 2 - Windows 2008 R2 (64 bit) virtual server running MongoDB (64 bit).
  • Server 3 - Windows 2008 R2 (64 bit) virtual server running SQL Server 2008 (64 bit).


And, here are the results. The query times mentioned here include time taken to complete all the steps - open the database connection, execute the query, read the results and close the database connection. To give a better perspective, the min, max and the avg times have also been included. It's interesting to note that the average time that SQL Server took is the maximum time for a MongoDB server. Mind you, SQL Server has not fared that badly except the Max query time, but even on the others I didn't expect MongoDB to be so much quicker than SQL Server.

I personally do like skyscrapers, but in these charts, the shorter the better! I think I have been a bit spoilt now, any reponse time greater than a second by any server is going to feel like a let down. ;)


However, let me again remind that typically NOSQL databases like MongoDB cannot do complex queries, table joins, triggers, ACID and the other features that a typical RDBMS can excel in. If one wants to prove capability of RDBMS, just throw a complex SQL at a MongoDB. But, when it comes to fast reading/writing of data, then NOSQL database probably win hands down. Of course, it also depends on how the overall solution is designed. As I said earlier, horses for the courses.

In a later post, I will probably cover some scenarios where NOSQL databases could be used.

Click here for - Part 4.

Comments

Popular posts from this blog

Meta Prompting for Success

Book Review - The Price of Being Fair

How to create a big picture