P2P sync and sequence numbers in GrocerySync

26 views
Skip to first unread message

Brendan Duddridge

unread,
Sep 26, 2015, 8:07:22 PM9/26/15
to Couchbase Mobile
Hi,

Looking at the GrocerySync app, the readme states:

* Remember the latestSequenceNumber of each followed peer.

* When the peer is online and publishes a higher sequence number, trigger a one-off pull replication. Then update the saved sequence.


Isn't handling all of that what enabling continuous replication does for you?

Or is it more efficient to do it this way since you're only pulling when you get notified of a change in the sequence numbers of your peers from the NSNetService's txtRecord?

Thanks,

Brendan

Jens Alfke

unread,
Sep 26, 2015, 8:28:56 PM9/26/15
to mobile-c...@googlegroups.com

On Sep 26, 2015, at 5:07 PM, Brendan Duddridge <bren...@gmail.com> wrote:

Isn't handling all of that what enabling continuous replication does for you?

Yeah, but you’d have to have a continuous pull replication running with every peer on the network, for as long as that peer was online. And a continuous pull keeps a TCP socket open as long as it’s active. That’s potentially a lot of TCP connections. Instead, I’m handling the notification of new sequences/revisions using TXT records, which are much lighter weight — they’re multicast IP packets.

There’s still going to be a “thundering herd effect” when someone updates a document, as everyone else simultaneously starts a replication and pulls the new revision. There are ways around that, but they require more sophisticated protocols like gossip or spanning trees.

—Jens
Reply all
Reply to author
Forward
0 new messages