slow lcb_wait

Hi i have a problem when i call lcb_wait. I have profiled the program that push data very fast on the cb servers and i see that the must part of the time is spent in lcb_wait. I have used memcached before couchbase and using libmemcached the push was very fast. There if i don't call lcv_wait the data is forward as a possible internally or i need to call it anyway?

thanks in advance.

1 Answer

« Back to question.

lcb_wait will drive all your network I/O which includes writing to sockets and waiting for sockets to become available for reading/writing; naturally lcb_wait() will end up being the bottom most frame for most of libcouchbase' APIs.

thanks for replay, is it possible to set the library not waiting the answer of the server? I remember that in libmemcached i could set the property not to wait for the answer. In this way, it performs the set operation very quickly. Is there a way to do the same in libcouchbase?

Unfortunately not currently. The problem is that the write buffer may be full and you would need to invoke lcb_wait() anyway so that the write does not end up blocking.

You can use an asynchronous event loop to make this process quicker (Assuming your application is asynchronous). Additionally you can invoke lcb_store(), lcb_get() etc etc and enqueue the operations to be performed when lcb_wait() itself is finally called after all operations have been enqueued.