Kristina Chodorow's Blog
CouchDB vs. MongoDB Benchmark
Edit (9/1/10): this benchmark is old, silly, and should probably be ignored in favor of more recent and representative ones. I don’t want to take it down for historical purposes, but seriously people, it was never a good benchmark, it’s over a year old at this point, and both databases have changed a lot.
Edit (12/6/09): this is the #1 Google result for “mongodb benchmark”, so I figure I’ll do some community service: if you’re interested in benchmarks, you might want to look at the 3rd party ones listed on the mongodb.org website.
Felix Geisendörfer did a benchmark in PHP that was super-easy for me to port into MongoDB. You can see his post on his blog.
And now… comparing his results for CouchDB with mine for MongoDB’s (I did the graph in Open Office, which is why the quality sucks):

As you can see, MongoDB does, uh, slightly better. Here are the numbers:
| # of Inserts | Couch Total Time (sec) | Couch Time/Doc (ms) | Mongo Total Time (sec) | Mongo Time/Doc (ms) |
|---|---|---|---|---|
| 1 | .0015 | 1.46 | .0005 | .5 |
| 2 | .0015 | .75 | .0004 | .2096 |
| 3 | .0017 | .56 | .0005 | .1604 |
| 4 | .0017 | .44 | .0005 | .1190 |
| 5 | .0018 | .36 | .0005 | .1060 |
| 6 | .0019 | .32 | .0006 | .0931 |
| 7 | .0021 | .3 | .0006 | .0847 |
| 8 | .0022 | .27 | .0007 | .0789 |
| 9 | .0023 | .25 | .0007 | .0734 |
| 10 | .0025 | .25 | .0007 | .0721 |
| 50 | .0072 | .14 | .0024 | .0476 |
| 100 | .0136 | .14 | .0044 | .0442 |
| 500 | .0687 | .14 | .0253 | .0505 |
| 1000 | .1361 | .14 | .0372 | .0372 |
| 2500 | .4686 | .19 | .0278 | .0371 |
| 5000 | .9165 | .18 | .0488 | .0098 |
| 7500 | 1.5116 | .2 | .0835 | .0111 |
| 10000 | 2.3111 | .23 | .1065 | .0107 |
| 25000 | 6.8684 | .27 | .2711 | .0108 |
| 50000 | 15.8227 | .32 | .5430 | .0109 |
| 100000 | 35.3071 | .35 | .1.7697 | .0177 |
| 250000 | 104.0009 | .42 | 6.4533 | .0258 |
| 500000 | 230.6021 | .46 | 11.7684 | .0235 |
| 750000 | 352.7959 | .47 | 17.0473 | .0227 |
| 1000000 | 487.3284 | .49 | 18.4376 | .0184 |
Please let me know if I made any mistakes, all the values were hand-copied.
I ran these tests using the PHP driver on Ubuntu 9.04 on my MacBook Pro. You can see the test script I forked at http://github.com/beaddy1238/couchdb-benchmarks/tree/master.
A little analysis: Both DBs start with some overhead, but by 1000 inserts CouchDB seems to be chugging along nicely. MongoDB takes slightly longer to hit its groove, hitting its peak around 10000. They both slow a little near the end, as MongoDB starts spending most of its time allocating files and, although I know almost nothing about CouchDB’s structure, I’d guess it’s doing something similar.
| This entry was posted by kristina on June 29, 2009 at 2:36 pm, and is filed under Uncategorized. Follow any responses to this post through RSS 2.0. You can skip to the end and leave a response. Pinging is currently not allowed. |
Comments are closed.

about 1 year ago
http://jan.prima.de/~jan/plok/archives/175-Benchmarks-You-are-Doing-it-Wrong.html
Cheers,
Jan
–
about 1 year ago
I would second the vote for getting kv store benchmarks out there.
And, as you requested, MongoDB data out to 10 million records:
http://snailinaturtleneck.com/downloads/couch.vs.mongo.csv
about 2 months ago
CouchDB's performance is terrible. Query performance doesn't get much better.
In recent benchmarks for a client, Mongo is the fastest, Cassandra is slower but presumably some of the overhead is the p2p autosharding, and CouchDB is absurdly slow compared to the two leaders. Futon looks pretty tho.
about 1 month ago
this is an absolutely absurd comparison. you are talking about running two very different datastores on a *single* node (a MacBook Pro at that), with a bunch of other non real-world assumptions. show me the following performance benchmark: replicated mongo on 10 nodes vs couch on 10 nodes. then show me performance when the network goes down or there is a disk failure. (see my point?)
about 1 month ago
Of course it's absurd, but I didn't write it. I converted a CouchDB benchmark someone did because I hate writing benchmarks. I used a MacBook Pro because that's what I had.
You propose an interesting benchmark. If you implement it in CouchDB, I'll implement it in MongoDB
I don't know much about CouchDB's failover, it might outperform Mongo's (but I doubt it). Only one way to find out!
about 1 month ago
2500 inserts, MONGO TIME/DOC (MS) should be 0.0111.
about 1 month ago
I like this kind of smartness on you .. thanks, you made my day …
about 1 month ago
I'm not sure what you mean, can you clarify?