Server side implementation of set document operation with Replicate value greater zero


#1

I’m working with Couchbase (Java SDK) more than one year and from the beginning I was very worried about one question: why set documents with Replicate.ONE SO slow? I have reached only ~10-15 sets per second. I worked with two nodes of Couchbase and on very good application servers, so such perfomance is not hardware problem.

I noticed, that with Persist.ONE perfomance equals to perfomance with Replicate.ONE. I suggest, that response on set operation with Replicate.ONE from server returns only when document writes to disk. I want to verify my suggestion or see how such mechanism implements by see sources of Couchbase Server. Looking on github, I can’t find implementation of this functionality, so I ask for help from developers to show me module, that implements this.

Many thanks in advance.


#2

Hi,

first, make sure you use both a recent server and client version, if you go with the latest ones they both should have decent performance in that area.

Replication takes some time, although it should never be in the upper second range as you reported. Can you give us more information about your setup, workload and intended behavior? Also, feel free to raise a JCBC ticket and we can take it from there.

We have lots of users using this feature in production and are happy with the performance it provides.


#3

Hello, daschl

I forgot to say at my question that I need sync kind of operations. So at my code I’m using follow:

client.set(key, doc, PersistTo.ZERO, ReplicateTo.ONE).get();

I try last Java SDK (1.4.3) and Couchbase Server 2.5.1. When I’m using sync variant I’m get 5-10 sets per second. When I’m using

client.set(key, doc, PersistTo.ZERO, ReplicateTo.ONE);

count of sets per second equals several tens of thousands.
Maybe when you tell about good perfomance you mean perfomance of async operations?

Unfortunately I need to use sync operations because I can’t lose any changes of document in case, when one server of cluster fails. Async operations return positive response when I document doesn’t replicate to another cluster. I test it by following part of code:

client.set(key, doc, PersistTo.ZERO, ReplicateTo.ONE);
Object object = client.getFromReplica(key);
if (object == null) {
System.out.println(val);
}

I get 90% when object is null. So if server fails data will be losed.

Tell me please if I’m wrong in my arguments.

Also I’d appreciate it if you tell what value of perfomance were achieved for sync operation “set” with ReplicateTo.ONE