Adding Peer to Peer support to online sync

17 views
Skip to first unread message

parvez....@decurtis.com

unread,
Apr 14, 2017, 9:34:25 AM4/14/17
to Couchbase Mobile
While seeing the peer to peer implementation in the branch bonjour-sync-swift2 of Grocery-Sync-iOS project, I do have several questions in my mind:
  1. Can we use peer to peer in parallel with online sync (where sync gateway & couchbase server will also come in scene) ? It seems to me that we will be having two sets of push-pull replications. One for peer to peer syncing and another for online replication, right ? The database will be same in both of the replications.
  2. If the answer to point #1 is Yes then is the couchbase lite SDK along with listener will be handling all kinds of sync stuff that includes conflict resolutions, right?
  3. How will be the performance in this case?
  4. Is there any limit on how many peers can be connected at a time?

Thanks

Jens Alfke

unread,
Apr 14, 2017, 4:19:43 PM4/14/17
to mobile-c...@googlegroups.com
On Apr 14, 2017, at 6:34 AM, parvez....@decurtis.com wrote:

  1. Can we use peer to peer in parallel with online sync (where sync gateway & couchbase server will also come in scene) ?
Yes; the replication protocol is multi-master, which means it can be used in arbitrary topologies, not just the typical star (client-server.)
  1. If the answer to point #1 is Yes then is the couchbase lite SDK along with listener will be handling all kinds of sync stuff that includes conflict resolutions, right?
Yes.

  1. How will be the performance in this case?
It depends. P2P gets complicated, and we don’t (yet) have a high-level system for it. The biggest performance issue is topology. If you just have every peer replicating with every other peer, you get an O(n^2) growth in the amount of replication, and there will be a lot of useless traffic like “do you have this revision yet?” “Yes, I do.”. To get around this you want to get closer to something like a spanning tree, which has the minimum number of connections, but organizing those dynamically is challenging.

  1. Is there any limit on how many peers can be connected at a time?
No, other than performance. (Well, and the number of simultaneous open TCP sockets, which is something like 50,000.)

—Jens
Reply all
Reply to author
Forward
0 new messages