Adventures into CouchDB and Rails

September 4, 2009

Getting ready for CouchDB 0.10

Filed under: CouchDB — zdzolton @ 2:59 am

I’ve setup a local copy of CouchDB, from the 0.10 branch, just to see if my application code could handle its awesome powers. Here are my two big takeaways:

Turn on delayed commits

CouchDB 0.10 now defaults to disabling delayed commits, which in your production environment is a great trade of data consistency for write speed. However ensuring all those bits get flushed out to disk can be quite slow. For example, before turning on delayed commits my slowest unit test took over 12 seconds (ouch!), but after it got down to 3.4 seconds. Moreover, the whole test suite went from over 400 seconds (eek!) down to 90 seconds, after turning that option on.

So make sure to put this into your local.ini for your workstations:

[couchdb]
delayed_commits = true

Review your usage of reduce=false

In CouchDB 0.9 one could always specify reduce=false in view queries—even for views that don’t actually define a reduce function. This will now be considered an invalid query, and CouchDB will respond a 400 HTTP status code. I’m not sure I think it necessary to be so strict here, but all you do is review your database queries to make sure you’re passing reduce=false in erroneously.

I think we’re ready!

Other than this, it took very little to prepare my application for CouchDB 0.10—and I’m pretty excited for the _changes API and no downtime deployment of views!

Advertisements

Blog at WordPress.com.