Synchronization per document or change? TouchDB-Android

33 views
Skip to first unread message

Emil Einarsson

unread,
May 14, 2013, 10:13:54 AM5/14/13
to mobile-c...@googlegroups.com
Hi!

How does the synchronization from couchDB down to the mobile device thru TouchDB really work? As I am seeing it with my tests its always documents being sent back and forth to keep them up to date and where as I was under the impression that only differences where to be sent and therefore faster and use less traffic then other databases. Like for instance if I change a value for a specific key, then only the changes made to that value be sent during the synchronization. Is this possible to do?

Traun Leyden

unread,
May 14, 2013, 3:05:43 PM5/14/13
to mobile-c...@googlegroups.com
Whenever a document changes, the entire body will be re-sent during the replication.  (as opposed to just sending a "delta" of the changes in the document body)  

Only the latest revision of the document body will be sent however, so if there were 10 changes since the latest replication, it won't send 10 versions of the document body.. only the latest revision.

Attachments are treated slightly differently.  Only attachments which have changed will be included with the document during replication.  If none have changed, no attachments will be sent.

I agree, sending the delta's would be more efficient, but I'm assuming there are good reasons why it wasn't done that way.  I don't think there's any easy way to implement that, since it would require a major change to the protocol.




On Tue, May 14, 2013 at 7:13 AM, Emil Einarsson <emil.ein...@gmail.com> wrote:
Hi!

How does the synchronization from couchDB down to the mobile device thru TouchDB really work? As I am seeing it with my tests its always documents being sent back and forth to keep them up to date and where as I was under the impression that only differences where to be sent and therefore faster and use less traffic then other databases. Like for instance if I change a value for a specific key, then only the changes made to that value be sent during the synchronization. Is this possible to do?

--
You received this message because you are subscribed to the Google Groups "Mobile Couchbase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchba...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jens Alfke

unread,
May 14, 2013, 3:19:50 PM5/14/13
to mobile-c...@googlegroups.com

On May 14, 2013, at 12:05 PM, Traun Leyden <traun....@gmail.com> wrote:

I agree, sending the delta's would be more efficient, but I'm assuming there are good reasons why it wasn't done that way.  I don't think there's any easy way to implement that, since it would require a major change to the protocol.

It would be a lot more complex, and it would require databases to keep more historical data. If you’re pulling from me and I have a 12th generation revision of a doc but you only have the 4th, I’d need to have either the 4th revision itself (to be able to compute a delta) or have a set of pregenerated deltas going back to revision 4. It gets even harder when you consider that doc revisions can be a branching tree, not just linear.

It would essentially turn the database into a revision-control system like Git. There’s been a belief in CouchDB (and related systems) that this is a slippery slope of complexity that we should stay off of.

—Jens
Reply all
Reply to author
Forward
0 new messages