After a couple of the couchdb developers commented on my earlier post about binary data and couchdb, I took their advice in the next round of testing. I upgraded to CouchDB pre-0.9.0 from svn, then wrote read/write tests for storing data using byte, base64 String, and byte via attachment. The updated code is available in the same github gist. These tests were not scientific. I ran each combination of data type over n threads for 100 iterations and compared the total times. I averaged the results when using more than one thread for the total. Consider the data completely empirical, but the relationship stands. The binary attachments are fast. That’s all we wanted to know.
So fast even I can’t get consistent numbers and the java libraries throw “httpMethodBase.getResponseBody – Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.” I left the ‘attach read’ out of the graph to keep the numbers on a closer scale.