-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PeerStore improvements #582
Comments
@hugomrdias do you have any updates on metrics collection via testground? 🙏 |
Not yet, i only plan to start working on that next week. |
I did a small benchmark to get initial metrics, while we do not have testground support for js. Bear in mind that this was a hacky benchmark on my machine and it does not replace proper benchmark once we have the testground. I created a scenario with a network of 5 peers that discover each other and get connected. Once all the nodes are connected with the other ones, one of the nodes is stopped and started again, so that we can benchmark the difference of having the PeerStore being persisted. MDNS Discovery (node.js environment)On 10 different runs, we got the following average results for performing the entire test:
For this case, having a persisted PeerStore was around 1.2x faster to have connectivity with all the other peers. When we are in the wild, with latencies for discovering and communicating with others peers, it is expected that the persisted PeerStore will bring better results, since we do not have to communicate over the wire to get to know peers before trying to connect with them. Moreover, adding more peers to the network should also show more significant improvements on Webrtc-star Discovery (browser environment)On 10 different runs, we got the following average results for performing the entire test:
Restarting a node with persistence takes longer when persistence is enabled, while the discovery part was the same. Once again, with latencies for discovering and communicating with others peers, it is expected that the persisted PeerStore will bring better results. |
Closed as already implemented |
PeerStore improvements
Goal: Road to PeerStore v2 and improve browser connectivity
Milestones
0) Gather relevant metrics -- testground
1) AddressBook and ProtoBook
2) Deprecate peerInfo
3) Backed Datastore
4) keybook and libp2p-keychain
5) MetadataBook
6) Multiaddr confidence
7) Peers Priority
Open minor issues
Problem
In
js-libp2p
, we are currently relying onpeer-info
to track the information of a peer, like its addresses and running protocols. We are moving differentPeerInfo
objects around, which in some cases are also not properly updated when theidentify-push
/identify-delta
are triggered, instead of having a single source of truth to handle this metadata, i.e. the PeerStore. After the release of[email protected]
(async refactor) we got some improvements on this, but it was just an initial step.PeerStore provides us several opportunities to improve peers' connectivity and connection management. From peer scoring, to multiaddr confidence, there are several improvements that we can get from a store to manage peers metadata.
Opportunities
Persistence
Centralizing all the information a peer has about its environment enables us to easily persist this data. This will have a big impact on browser nodes, which will be able to connect to the previous peers they were connected to.
With persistence, we will also be able to have Less load on the bootstrap nodes as we can immeditaly connect to other peers without them.
Connection Management / Protocol topology
When
js-libp2p
reaches a certain treshold of open connections, it needs to trim some connections so that the node continue its healthy operation. PeerStore can provide input to the connection management about its most important peers, since it has information about the protocols each peer runs. This might be an important factor for a peer scoring function combined with the protocol topologies previously introduced.Dialer efficiency
When
js-libp2p
dials a peer, it tries to dial several known addresses of a peer in parallel. We use a token based dialer to not use a lot of resources to a single connection. However, we don't have a good way of deciding which subset of addresses we should try first. If we gather metrics from peer addresses stored in the PeerStore, we can create a scoring function for the addresses.Peer exchange protocol
With a PeerStore with new capabilities, we can also start working on designing and implementing a peer exchange protocol to improve the discovery capabilities of the peers. New discovery mechanisms are really important for browser nodes.
PeerStore components
WIP NOTES:
Goals
Multiaddr confidence
Metrics
Gather metrics on initial startup to get a set of peers connected (bootstrap nodes + browser peers setup with stardust/webrtc-star).
This will allow us to measure average time to have all peers connected, with and without persistence, compare stardust and webrtc-star, among other useful metrics.
Milestones
libp2p-keychain
Relevant references and previous discussions
libp2p/specs#164
libp2p/go-libp2p-core#123
#556
The text was updated successfully, but these errors were encountered: