Sync extremely slow, how to control what's happening?


I’m working on my project with a couchbase server 5.0, sync gateway 1.5 and couchbase lite 2.0, db19, in a Xamarin forms solution, UWP project active.

I’m displaying the status of my replicator, and the numbers (humanly incomprehensible) found in the status progress : Total and Completed.

I first started by inserting 18 documents in my bucket. The sync work find in few secondes, the numbers Total and Completed was equals, and I was able to read my documents from my couchbase lite.

Well, proud of my work, I inserted 59600 documents, (with 2 dates and 5-6 strings), nothing big. It took my program 3 minutes to insert the documents.

That was the begining of the problems.

The numbers Total and Completed are nevers equals anymore, the sync status is always Busy. After 30 minutes, I stopped my program, and restarted it, it just inserted 6000 documents.

After 2 and half hours, I can count only 21000 records inserted.

I don’t understand why it’s so long.

What can I give you for you to understand this problem ?




I add to my post that I just need few seconds to access the entire documents thru the Rest APi of Sync gateway.

Here is my connection code

			Uri target = new Uri("blip://");
			ReplicatorConfiguration replicationConfig = new ReplicatorConfiguration(_dataBaseGetter.Get(), target);
			replicationConfig.Continuous = true;
			replicationConfig.ReplicatorType = ReplicatorType.PushAndPull;
			replicationConfig.Authenticator = new BasicAuthenticator("MyUser", "MyPassword");
			_replicator = new Replicator(replicationConfig);
			if (CrossConnectivity.IsSupported && CrossConnectivity.Current.IsConnected)
			_replicator.StatusChanged += _replicator_StatusChanged; 


Did you wrap an inBatch block around the insertions? If not, every document gets written inside a separate data-store transaction, which is much slower. I have a performance test that can add 12k small documents in a few seconds.

The numbers Total and Completed are nevers equals anymore, the sync status is always Busy.

Sounds like a replicator bug with detecting when replication is complete. How long does it take for the Completed value to stop updating? That’s probably the true time to replicate.

If you could send a copy of the database (the .cblite2 directory), I can try to reproduce this.

I wonder if this bug has something to do with it. If I remember correctly, it was fixed in db020.


No, I didn’t. But I will look how I can add that. Thank you for the tip !

I suspected that it could be a bug that could be corrected in DB20 or db21. That’a why I wanted to upgrade to DB21.

I will begin to upgrade first, test again and come back to you.
Thank you again for your help guys.



So, now I’m using the DB21 version, and I uninstalled my app from my computer and started back from scratch with my replication.

The status of the replicator is more realistic, It shows me that the replication stopped. At least, it shows what I thought it was doing in db19.

After few seconds of busy status, and an increasing of the Total progress number, the replicator status goes to stopped, and never came back to busy, not even Idle.

Each time I’m starting my application, same scenario, and the count of my documents increase a little, but the replication don’t do his job.

I tried to cut my connectivity and start it back, and force the call of the raplicator.Start() methode, but it seems it’s not the way to do it.

I finaly find that the LastError Exception is now into the status, under the name of Error. So I displayed it and I have this exception : Message = “LiteCoreException (1005): no status code received”

Don’t have any Idea of how to correct that. any help ?



Temporaraly, I found a dirty solution : each time the replicator catch an exception, I stop it, dispose and restart.

My sync of 59600 document is very quicker. It confirmes that the replicator shows a Busy status but do nothing.

It would be great to be able to deal with this exceptions : “LiteCoreException (1005): no status code received”

And to know too the best practice to deal with replicator exceptions ?

How can I help ?




In my Last post, I said that I had Exception “LiteCoreException (1005): no status code received”, this is the way With the Xamarin UWP project.

I tested with the xamarin Android project, and I had no exception, but the problem with the replicator showing a Busy Status, and doing nothing.

For what I can understand, the replicator isn’t slow, it just stop working, but shows a busy status.

What can we do to correct that ?