on device syncing question

20 views
Skip to first unread message

Jeremy Kelley

unread,
Mar 13, 2015, 5:21:59 PM3/13/15
to mobile-c...@googlegroups.com
- tl;dr version - 
slow initial sync with little notification about what's going on
QUESTION - Any recommendations on ways to get a little more introspection into the sync process?

- longer version -

On iOS.

For certain cases, I am forcing the user to sit at a spinning screen on app launch while I do a full sync that's available to them.  I need all the data coming down to build some reports and showing an empty screen isn't desirable.

I'm watching kCBLReplicationChangeNotification on both the push and pull object for changes. Every time, I seem to get to about 80%, it just hangs for a minute or two. I have tried watching both kCBLDatabaseChangeNotification and kCBLDocumentChangeNotifications.  These also seem to stop firing.

I am trying to give the users feedback so they don't close the app if it sits for a minute or two just hung. 

QUESTION - Any recommendations on ways to get a little more introspection into the sync process?

My hunch is there may be some issue with sqlite performing batch inserts? (just spit balling).

Maybe over the weekend, I can try with the new forestdb and see what performance is like.

-j



Jens Alfke

unread,
Mar 16, 2015, 12:21:58 PM3/16/15
to mobile-c...@googlegroups.com
On Mar 13, 2015, at 2:21 PM, Jeremy Kelley <jer...@33ad.org> wrote:

QUESTION - Any recommendations on ways to get a little more introspection into the sync process?

Turn on logging; try the “Sync” keyword, if that doesn’t give you enough info go to “SyncVerbose”.

I'm watching kCBLReplicationChangeNotification on both the push and pull object for changes. Every time, I seem to get to about 80%, it just hangs for a minute or two. I have tried watching both kCBLDatabaseChangeNotification and kCBLDocumentChangeNotifications.  These also seem to stop firing.

Hm, that’s not good. Two possibilities I can think of:
(a) Some very large documents being downloaded, where ‘large’ is the sum of JSON body size + all attachments;
(b) Very large numbers of deleted documents in the server database (for completeness’ sake the ‘tombstone’ markers for these do need to be downloaded on first sync.)

My hunch is there may be some issue with sqlite performing batch inserts? (just spit balling).

There shouldn’t be. The inserts are done in parallel with downloads and in not-too-large batches that should take only a fraction of a second apiece.

—Jens
Reply all
Reply to author
Forward
0 new messages