Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB vs CouchDB (Speed optimization)

I made some tests of speed to compare MongoDB and CouchDB. Only inserts were while testing. I got MongoDB 15x faster than CouchDB. I know that it is because of sockets vs http. But, it is very interesting for me how can I optimize inserts in CouchDB?

Test platform: Windows XP SP3 32 bit. I used last versions of MongoDB, MongoDB C# Driver and last version of installation package of CouchDB for Windows.

Thanks!

like image 786
Edward83 Avatar asked Jun 02 '10 04:06

Edward83


1 Answers

Just to iterate on the sockets vs HTTP and fsync vs in-memory conversation.

By default, MongoDB doesn't return a response on a write call. You just write your data to the socket and assume it's in the DB and available. Under concurrent load this could get backed up and there isn't a good way to know how fast Mongo really is unless you use an optional call that will return a response for the write once the data is available.

I'm not saying Mongo insert performance isn't faster than Couch, inserting in to memory is a lot faster than fsyncing to disc, the bigger difference here is in the difference in goals MongoDB and CouchDB have about consistency and durability. But all the "performance" tools I've seen for testing Mongo use the default write API so you aren't really testing insert performance you're testing how fast you can flush to a socket.

I've seen a lot of benchmarks that show Mongo as faster than Redis and memcached because they fail to realize that Redis and Memcached return a response when the data is in memory and Mongo does not. Mongo definitely is not faster than Redis :)

like image 131
mikeal Avatar answered Sep 22 '22 15:09

mikeal