Replication latency

#1

Hi all,

I’m developing an app with CouchBase Lite using C# and a sync gateway.

When replicating documents via the Sync Gateway, I’ve got latencies of more than 10 seconds for a document with less than 1KB.

In the sync gateway I’ve to databases configured, one using walrus and the other using couch base server and latencies are very similar.

Is there a way to reduce that time?

Thanks, regards.

#2

That’s unexpected — latency should be under 1s, assuming a functioning network connection and the server isn’t heavily loaded.

Can you use logging or packet-sniffing to identify where in the chain the delays are happening?

#3

Hi,

Network connectivity is fine. When I configure an in-memory database in the sync gateway, response time is about 3-4 seconds, but when I replicate with a database that is in a couchbase server, latency grows to more than 10 seconds. Do I need to configure something on the CouchBase server?

The Couchbase usage is very simple, listen to a live query for items matching a condition. I suppose the view is created on the local database of the couchbase lite client. If I create the same view on the couchbase server, will the overall performance improvement?

This is my sync function in the gateway:
function(doc, oldDoc) {
if (doc.group) {
channel(doc.group)
} else if (oldDoc.group) {
channel(oldDoc.group)
}
}

Thanks. Regards!

#4

Hi all,

Could anyone explain to me what the Sync gateway or couchbase server are doing in the following lines:

09:57:04.892156 2016-06-28T09:57:04.892Z HTTP:  #109: POST /canvas/_revs_diff
09:57:04.991248 2016-06-28T09:57:04.991Z HTTP+: #109:     --> 200   (99.1 ms)
09:57:05.123498 2016-06-28T09:57:05.123Z HTTP:  #110: POST /canvas/_bulk_docs
09:57:05.195500 2016-06-28T09:57:05.195Z CRUD+: Invoking sync on doc "{a6718ab8-365b-428a-b269-0bc7ef6f6c29}" rev 1-a502e799c166a20023793d6b45a2cd93
09:57:05.195500 2016-06-28T09:57:05.195Z CRUD: 	Doc "{a6718ab8-365b-428a-b269-0bc7ef6f6c29}" in channels "{canvas-asdf}"
09:57:05.195500 2016-06-28T09:57:05.195Z Cache: SAVING #29
09:57:05.196499 2016-06-28T09:57:05.196Z CRUD: Stored doc "{a6718ab8-365b-428a-b269-0bc7ef6f6c29}" / "1-a502e799c166a20023793d6b45a2cd93"
09:57:05.196499 2016-06-28T09:57:05.196Z HTTP+: #110:     --> 201   (73.0 ms)
09:57:08.922005 2016-06-28T09:57:08.922Z Cache: Received #29 after 3726ms ("{a6718ab8-365b-428a-b269-0bc7ef6f6c29}" / "1-a502e799c166a20023793d6b45a2cd93")
09:57:08.922005 2016-06-28T09:57:08.922Z Cache:     #29 ==> channel "canvas-asdf"
09:57:08.922005 2016-06-28T09:57:08.922Z Cache:     #29 ==> channel "*"
09:57:08.922005 2016-06-28T09:57:08.922Z Changes+: Notifying that "canvas" changed (keys="{*, canvas-asdf}") count=17
09:57:08.922005 2016-06-28T09:57:08.922Z Changes+: MultiChangesFeed: channels expand to channels.TimedSet{"canvas":channels.VbSequence{VbNo:(*uint16)(nil), Sequence:0x1}, "profiles":channels.VbSequence{VbNo:(*uint16)(nil), Sequence:0x1}, "canvas-asdf":channels.VbSequence{VbNo:(*uint16)(nil), Sequence:0x1}} ... 
09:57:08.922005 2016-06-28T09:57:08.922Z DIndex+: [changesFeed] Found 0 changes for channel canvas

In this line “09:57:08.922005 2016-06-28T09:57:08.922Z Cache: Received #29 after 3726ms (”{a6718ab8-365b-428a-b269-0bc7ef6f6c29}" / “1-a502e799c166a20023793d6b45a2cd93”)" it takes more than three seconds to do an operation. Sync gateway and Couchbase Server 4.1.1 are running in the same Azure machine. Thanks in advance.

Regards