Kaiden Prince
Kaiden Prince

Reputation: 237

P2P network design

I'm attempting to design a P2P network where all peers share the same data, as well as make changes to it. Without getting into the consensus portion (ie assume that only one node will make changes to the data at one time).

How would I make sure that all peers are connected to other peers in a fault tolerant way? I can only think of one way, and that is that each peer can request more peers from another peer, but how do I make sure that connections are distributed as evenly as possible, without one peer overloading on TCP connections, while another peer might barely have any connections? Or even how can I prevent all peers splitting into two separate groups?

Upvotes: 1

Views: 554

Answers (1)

the8472
the8472

Reputation: 43125

Something like bittorrent's canonical peer priority (github link) which calculates a preference-order by hashing identifiers of both endpoints together should allow nodes to reach a pseudo-random layout of the overlay while avoiding nodes being "left out". Hashing both identities together results in a different but globally agreed on ordering from the perspective of each peer, thus constructing a randomized layout. As the number of edges per node increases the chance of the network splitting will rapidly go towards zero.

And you can put a limit on the number of connections that each peer accepts, that will force others to go look elsewhere once it is saturated.

Upvotes: 0

Related Questions