MongoDB vs CouchDB (Speed optimization) MongoDB vs CouchDB (Speed optimization) windows windows

MongoDB vs CouchDB (Speed optimization)


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 :)


For inserting lots of data into the DB in bulk fashion, CouchDB supports bulk inserts which are described in the wiki under HTTP Bulk Document API.

Additionally, check out the delayed_commits configuration option, and the batch=ok option described in the above link. Those options enable similar memory-caching behavior with periodic syncing against he disk.


I don't think that the difference between sockets and http is the only difference. The difference is also related to the disk syncs (fsync). This affects durability. MongoDB stores everything in RAM first and it only syncs to disk at certain intervals, unless you explicitly tell MongoDB to do an fsync.

Read about durability and MongoDB: http://blog.mongodb.org/post/381927266/what-about-durability and fsync: http://www.mongodb.org/display/DOCS/fsync+Command