Set(key, doc, persistTo) sychronous or asychronous?


#1

We are doing some proof of concepts and are testing different parts of couchbase. We have about 2.9 million documents that we are loading. I noticed that when I switched from set(key, value) to set(key, value, PersistTo.ONE) the performance plummetted (normal run time was 5 minutes now its about 2 hours). I thought i read that the PersistTo was updated to be asychronous but I can’t see how.

Can you guys help me out?

Also, because we are doing a proof of concept we need to account for every document. To do this we create a list of FutureObjects. After the list.size() > 999 we iterate through the list and ensure that future.getStatus().isSuccess() == true. This does not slow the application down with the set(), but could be what is slowing it down with the PersistTo.

Sorry for the long winded, the big question is if set(key, value, PersistTo.ONE) is asynchronous or not?

Thanks,

Edit: After more digging i found this: http://www.couchbase.com/wiki/display/couchbase/Observe … This would be perfect but it seems that the implementation of this is not yet released, is that true? Can we get an estimate on this feature?


#2

Hi,

the observe-based persist/replicate implementations have been changed from a sync variation to a completely async one from 1.3 onward. So go use 1.4.1 and they are async.

If you have to to a lot of them, go consider full async with callbacks so you can utilize IO and your threads as much as possible. The lower level observe methods are exposed on CouchbaseClient, but its not recommended to use them directly since there can be a lot of edge cases (and with 1.3+ its not really needed anymore).