How to improve write/read performance?

I am using Couchbase Net Client to perform CRUD on couchbase.

I have created a bucket and inserting objects using a performance test method. But I notice that the writes being persisted are very less.

There are two cases:
1.) I use get to check existence of object with key. If not found then I create and write.
performance: ~50-80 writes/sec
2.) I only do set by creating a new object skipping the get.
performance: ~250 writes/sec

I am using Instance.StoreJson(StoreMode.Set, key, object, ttl); to perform write and GetJson API for get.

Is there a better practice to do this? I really need your help to fix this problem.

Is it related to the disk usage or RAM Quote of the bucket? For my bucket -

RAM Quota : 16.4MB /300MB
Disk Usage : 17.1MB /17.1MB

Q1) Is couchbase linked to the server size very heavily? By this I mean that I am using very low RAM of my bucket ~300MB only - is it the cause?
Q2) What is the best approach to do writes and reads - CouchBaseClient or MemBaseClient (I am using couch server 2 with couchbase client)?
Q3) What should be the better way of starting a new cluster - couchbase or membase?
Q4) Is it because I am using Windows?



When it comes for checkin for existance and not needing the object there was a feature introduced in 1.2.4 ( You have client.KeyExists (which uses the observe API) as seen in the Github repo here:

Not sure if that is of any help.



For case number one, there’s actually an operation for that. In the .Net client, look for store type of “add”. An add will succeed only if the item doesn’t exist already and it’ll be much quicker.

Also, if your goal is high throughput, you'll need to have a good amount of concurrency. Your use of add should be like case two or better, depending on your systems and setup.

Regarding the questions...
(unnumbered) Depends on the size of your items, I guess. WIth only 300MB, you'll run out of space quickly if the items are large. Then you'll start getting temporary failures as the system persists things to disk to make room for more items.

A1) If this was the cause, you would see temporary OOMs in the web UI. Check for that. Also, what size items are you writing?

A2 & A3) Definitely use CouchbaseClient

A4) It's not because you're using Windows. There are many, many Windows deployments.

Try switching to Add and if you still have bad throughput, can you post some code?

Also, it's not integrated yet, but Daniel (who replied here) authored a great workload generator called Meep Meep. You can browse the code here: