Java client: understanding set and get operations
Hi all,
I would like to understand, why the java client obviously (observed via the web UI - it states half the number of ops beeing reads and the other half beeing writes) tries to get the entry for the key I want to set via the clients set(key, expiry, value) method. I would have assumed that the set operation does not require a previous get operation on the key since the docs say it overwrites any existing entry for the same key. So why the get?
Could someone clarify please?
Thanks,
Johannes
Yes, of course.
I'm using 1.8.1 community edition (build-937). I have one server with a cluster quota of 14GB, one Couchbase bucket with a quota of 12GB. High water mark is 9.66GB, low water mark is 7.73GB (defaults). I am using the setup to cache 64Bit keys with no values. I write them in a loop with cb_client.set(key, 1800, ""); and the java client.
I can see now that sets are always asynchronous?! Is that true? I would like to cut back on the overhead for a set operation since there are quite many of them...
Thanks,
Johannes
If you are running in a tight loop with only the set command then you should not be doing any gets from the java SDK. If you are seeing get requests then it is either from some other application or it is just a bug in the stats reporting (although I have not seen it before). I also feel like that is something we would have noticed pretty easily before releasing. One option is to uninstall and re-install to see if the problem persists. This shouldn't be a big deal if you don't have a lot of data in Couchbase or you are just doing development.
Also, set operations are async in the java SDK, but I would store the OperationFuture object that the set function returns and check to make sure that the sets completed properly so that you can make sure all of the data is actually persisted into Couchbase.
Can you tell me which version of the server you are using, what your cluster setup looks like, and post a sample of the code your using?