Sync Statistics (Number of documents synced to device daily)

Hi,

We have constructed an ios app using couchbase-lite for a mobile device (Scenario - Couchbase Server <=> Sync gateway <=> Couchbase-Lite).We need to know how the modified documents get compared and synced everyday to each and every mobile device from sync gateway.

How do we find the statistics about the amount of data received to a mobile device from sync gateway also the amount of data sent from a mobile device to sync gateway everyday? Are there any tools or any proper way to identify the amount of data populating everyday to a device. We are handling documents with attachment of heavy load so we are trying to optimize the process and improve the sync performance between sync gateway and mobile device, please let us know as quickly as possible.

Thanks in Advance!

Siva.

It is a interesting question.
I think may be there are two ways to collect the numbers of docs synced to device daily. and I am not sure it can work. just post my ideas here to discuss with you.

  • Collect the numbers of docs synced to device daily from device

From every device, when the docs synced to the device, From the _changes REST API,such as

HTTP GET http://127.0.0.1:5984/cbl_db/_changes?include_docs=all&since=[last_day_last_seq]

the value of [last_day_last_seq] can be 0 if there is no [seq_number] value, or the [seq_number] that app remembered.
we can get the following info from response

"last_seq": [seq_number],

and

response.results.length

so, the numbers of docs synced to device since [last_day_last_seq] should be response.results.length.
then app should remember [seq_number] (may be can store on local doc) , when the docs changed, the last_seq will be change.

Now the device can collect the numbers of docs synced to device daily and report the numbers to server.
Note: Don’t consider How to collect the info when cbl has deleted.

  • Collect the numbers of docs synced to device daily from Sync Gateway
    you can use the similar logic to collect the numbers of docs synced to device daily,
    but the init [last_day_last_seq] and [seq_number] value may be can get from sync_gateway_error.log(you should configurate “Changes” log)
    Note:there will be a lot of logs.

may be there is some better way to collect the numbers of docs synced to device daily.
may be from View of Couchbase Server (Sync Gateway use View of Couchbase Server to calculate channel)?

1 Like