Delay in reflecting the new sequence in _changes URL of sync gateway admin


I am facing an issue in reflecting the sequence info of user’s new changes in Sync Gateway Admin URL ‘/db/_changes’ OR ‘/db/_changes?feed=websocket’. When a user added/updated some data from mobile app and CouchLite, its taking 4 min to sync the new/updated sequence details as like below in ‘/db/_changes’ OR ‘/db/_changes?feed=websocket’ URL -

seq: “26171004”,
id: “DocumentMobileChanges::nithya.arumugham”,
changes: [
rev: “30-9823e3dd4423f9c89620e64b6915bad5b412de3d”}]

This is only coming in a case, as in every 30 min we are updating most of documents of CouchBase database and when any app user performs some write operation from mobile app between that time duration, then its taking 4 mins to reflect the sequence number in Sync Gateway Admin URL ‘/db/_changes’ OR ‘/db/_changes?feed=websocket’. I am using Couchbase Enterprise Vesrion 5.0 & Sync Gateway 2.1. Can any one have faced this kind of challenge and what could be the solution for the same? Is it something causing from sync gateway config OR mobile app framework (Xamarin) with CouchLite? Need your suggestion here. Thanks in advance.

There’s not enough detail provided to narrow down where this delay is coming from. There are several steps that need to happen across multiple products between a document being mutated on a Lite client, and seeing it appear in a Sync Gateway _changes feed.

I would advise you try to analyse the logs around each of these points to narrow down where the problem actually is.

  1. [CBL] Mutating a document in CBL
  2. [CBL/SG] Pushing the mutations
  3. [SG] Running through the sync function
  4. [SG/CBS] Writing to Couchbase Server
  5. [CBS] Sending mutation over DCP back to Sync Gateway
  6. [SG] Recieving DCP mutation and storing in caches
  7. [SG] Building/sending the changes feed

A lot of these can be inferred just from the Sync Gateway logs. But for the time between steps 1 and 2 you’ll have to look at from both the client and sync gateway logs to determine if Lite is sending mutations in a reasonable time.

Thanks bbrks for replying. Data is updating instantly in Couchbase Server and also in sync gateway URL in respective document, but not the sequence in ‘/_changes’ URL. Also verified the sync gateway running through sync function its fine there.

OK great. Narrowing down your focus to look at the sync gateway logs for steps 5-7 above would definitely be the next thing to do. It indicates that Sync Gateway may be taking a while to get or process DCP feed events.

Thanks to reply bbrks. Can you please tell me, how can i validate this in logs that Sync Gateway may be taking a while to get or process DCP feed events? And what could be the solution for the same? is it applicable in the Sync Gateway version 2.1 or not?