Idiots Abound

There everywhere! They're everywhere!

23
Jan 2010

Did I mention #MongoDb is fast?!?! Way to go @mongodb

So now that I've got a bunch of data in the database, I figured might as well see what queries looked like.  Let me just say WOW.  The details speak pretty much for themselves, but here's a little background on the tests. 

I setup MySQL, MongoDb, and CouchDb on one virtual machine.  I ran a script to insert 100,000 documents I pulled down from wikipedia.  Mysql had a single table with 4 columns. MongoDb and CouchDb were schema-less, but their docs had the exact same four properties.  For MongoDb and Mysql I did a query for the individual document id's. For CouchDb I directly selected the document via their CouchDb id.  In both mysql and MongoDb I indexed the id columns.   Then it was time to do 100,000 queries.

+-------------------------------------------------------------------------+
|                         100000 Indexed Queries                          |
+-------------------------------------------------------------------------+
|           | Average   | Median    | Deviation | Lap Total  | Total      |
+-------------------------------------------------------------------------+
| MongoDb   | 0.00025   | 0.00021   | 0.00019   | 24.99955   | 291.38463  |
| CouchDb   | 0.01098   | 0.01067   | 0.00972   | 1097.85109 | 1101.09003 |
| MysqlDb   | 0.00199   | 0.00032   | 0.00518   | 199.32546  | 201.88513  |
+-------------------------------------------------------------------------+

Let me just say WOW!!!!  MongoDb is ridiculously fast.  I mean really, come on already, that's crazy.  When looking at the totals, the "Lap Total"  will be the one you want to look at.  That is the total of just the individual queries.  The "Total" time spent includes the time doing other things inside the code. In the example above during the Mongo test i was also writing to memcache for the next test.

Now if you are really ready to be impressed, take a look at this.  I dropped the indexes in both MongoDb and Mysql.  I expected these to be a good bit slower, so I did a much smaller result set.  I really don't know what to say to these numbers.

+-----------------------------------------------------------------------+
| 100 Non-Indexed Queries |
+-----------------------------------------------------------------------+
|           | Average   | Median    | Deviation | Lap Total | Total     |
+-----------------------------------------------------------------------+
| MongoDb   | 0.05662   | 0.03704   | 0.19267   | 5.66164   | 5.95255   |
| CouchDb   | 0.04619   | 0.03035   | 0.04323   | 4.61948   | 4.62373   |
| MysqlDb   | 1.99975   | 1.68468   | 1.99266   | 199.97469 | 199.97834 |
+-----------------------------------------------------------------------+


Last but not least, I did one more test.  This time I pre-populated memcache with the records, so I could compare really fast speeds with a known really fast storage medium.  At this point I'm going to stop typing because I can only say "fast" so many times.

+-----------------------------------------------------------------------+
|                             1000 Queries                              |
+-----------------------------------------------------------------------+
|           | Average   | Median    | Deviation | Lap Total | Total     |
+-----------------------------------------------------------------------+
| MongoDb   | 0.00035   | 0.00032   | 0.00022   | 0.35469   | 2.77333   |
| CouchDb   | 0.0164    | 0.01495   | 0.02076   | 16.39814  | 16.42793  |
| MysqlDb   | 0.00772   | 0.00826   | 0.00557   | 7.71744   | 7.73784   |
| Memcached | 0.00015   | 8.0E-5    | 0.00026   | 0.15356   | 1.9688    |
+-----------------------------------------------------------------------+

 

Filed under  //   Code   CouchDb   MongoDb   Mysql  
23
Jan 2010

How'd that Mongo get so fast??????

So we are working on a new large site at work, and we are evaluating different database. To do some comparisons, I downloaded a few million documents from the web (thanks wikipediea ;)) and wrote a little testing suite. The basic take away is wholly crap Mongodb is fast.

So I setup MongoDb, CouchDb, Mysql and Memcached on a local VM. I opened a few hundred thousand documents and inserted them into the various dbs. I indexed the same fields on mysql and mongo, but since memcache and couch don't have indexing, they were just inserted. Next I proceeded to insert 100,000 documents. All I can say is wow. No really wow. Mongo is actually getting faster writes than memcached. That's just plain amazing. Tomorrow I will run the select test against this data.

+------------------------------------------------------------------------+
| 100000 Inserts |
+------------------------------------------------------------------------+
| | Average | Median | Deviation | Lap Total | Total |
+------------------------------------------------------------------------+
| MongoDb | 0.00011 | 7.0E-5 | 0.00012 | 10.70719 | 1712.42024 |
| MysqlDb | 0.00083 | 0.00041 | 0.00792 | 82.8752 | 1712.42737 |
| CouchDb | 0.0064 | 0.00462 | 0.05921 | 639.94759 | 1712.41974 |
| Memcached | 0.00279 | 1.0E-5 | 0.00996 | 278.66401 | 1712.39775 |
+------------------------------------------------------------------------+

 

Filed under  //   Code   CouchDb   MongoDb   Mysql