Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | SDKs | SDKs

Java client: understanding set and get operations

3 replies [Last post]
  • Login or register to post comments
Tue, 11/13/2012 - 10:13
johannesch
Offline
Joined: 11/13/2012
Groups: None

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

Top
  • Login or register to post comments
Wed, 11/14/2012 - 10:38
mikew
Offline
Joined: 03/14/2011
Groups:

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?

Top
  • Login or register to post comments
Thu, 11/15/2012 - 03:02
johannesch
Offline
Joined: 11/13/2012
Groups: None

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

Top
  • Login or register to post comments
Fri, 11/16/2012 - 16:53
mikew
Offline
Joined: 03/14/2011
Groups:

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.

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker