-
Notifications
You must be signed in to change notification settings - Fork 43
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
Introduce Peer Management #594
Comments
Hi there, thanks for this! gowaku indeed needs some peer management. I would focus on the following for peer management:
Not sure we need this. Perhaps service peers should be used on demand. You need something, you get it and the connection is closed. Like this, we are also nicer to the network, since we dont occupy connections that we are not using. Pure req/resp.
Not sure I would implement this peer priority idea, at least right now. With gossipsub scores it should be enough by now. tldr: we indeed need better peer management and on top of what you have mentioned, i would focus on peer management strategies to prevent being DoSed and ensure the network can serve light protocols. |
This would be a good feature, will include it.
Understood, but you are referring to service node. Since go-waku is also used by mobile and light clients, will have to think of how to address those cases as well.
Understood, there is already a basic IP based limit check and disconnection. Just have to bring it under peer manager.
Good idea to have some rate-limiting for service nodes. Probably per service basis.
My idea of priority was to decide when to prune or degrade a peer's priority based on various factors(something similar to https://github.com/prysmaticlabs/prysm/tree/develop/beacon-chain/p2p/peers/scorers). Also, this would give flexibility for users/applications using waku to define their own scoring mechanism and set priority for peers. Not sure how much this would be of a requirement for an app like Status. @richard-ramos , maybe can shed some light on this.
This is mainly required for service-nodes, but for light-clients peer management would mostly involve how to manage in/out connections as per bandwidth and other requirements. |
Regarding these suggestions from @alrevuelta:
This should be already covered by the connection gater: https://github.com/waku-org/go-waku/blob/master/waku/v2/connection_gater.go#L55-L66
This I think we can manage by using go-libp2p scaling limit config, for example here we can see the limits set by go-libp2p for the default services it provides: https://github.com/libp2p/go-libp2p/blob/master/limits.go#L15 . We should be able to control the maximum number of streams allocated to each service and memory. |
This i think it might not be really necessary. We connect to services on demand, so as long as as we chose a
This idea i do like. One problem go-waku test fleet has is that sometimes wakucanary has trouble connecting to the nodes since all the slots are already allocated to other peers. I imagine having a % allocated to services should help with this scenario (not so much for cases when wakucanary attempts relay connection and all gossipsub slots are already busy :) )
No requirement defined for this, as far as i know. |
@richard-ramos golibp2p limits looks very nice, had no idea about this. With a quick look it doesnt seem we can enforce served bytes/sec, but perhaps memory is just enough. Or well, we can always do it on top. prysm approach seems also interesting, using a leakybucket: https://github.com/prysmaticlabs/prysm/blob/e9b5e52ee219d058ab587f5187732281505f5b2b/beacon-chain/sync/rate_limiter.go#L36
Yep, agree with the feature but would say its just a nice to have right now. imho peer management for DoS protection is prio 1 right now. The shard that a peer supports will be part of this "score" in the future, since automatic sharding will add an extra dimension to this.
Not sure this flexibility is i) needed or ii) if it will be used at all. Defining a custom scoring mechanisim requires depth knowledge on waku/gossipsub/libp2p and doing it wrong can have a huge impact on both the network and the node itself. I don't imagine anyone in Ethereum writing their own peer scoring algorithm. The only thing that afaik people configure here is staticnodes, which are nodes that the protocol always stays connected to. So, "scoring" (or some criteria beyond just gossipsub), yes. But I wouldn't overengineer it at this stage. Something as simple as gossipsub scoring + keep staticnodes connected + just connect to shards we are interested should be enough imho. |
Thanks @richard-ramos and @alrevuelta for your comments and suggestions. Based on the above discussion, following are conclusions
Peer Manager Capabilities
|
@chaitanyaprem are you happy to update the description of this issue to match this template? waku-org/pm#40 |
Weekly Update
|
@alrevuelta, Was going through the comments again and had noticed this point mentioned by you Can you please elaborate on this as i could not understand what needs to be done here? Because as far as i understand, we don't need to maintain any persistent connections towards static nodes unless they are being used constantly. Otherwise it would result in connection timeout and connections can be established on demand. |
@chaitanyaprem Wouldn't say its an strict requirement but static nodes are nodes that are manually configured from the cli, which are considered as trusted. So it would make sense to stay connected to them. |
@chaitanyaprem Where do you got that from? iirc nwaku doesn't have that implemented. Either way, don't have a strong opinion on this feature. But its something that I have seen in some blockchains. |
You have mentioned here #594 (comment) in the last statement. As an initial thought, even it made sense to me as well that we need to be connected to nodes that are statically configured(as they are trusted).
We can have a CLI flag which indicates that we need to maintain persistent connections to specific nodes(probably because they are trusted), in which case we need more mechanism to ensure connections to these trusted nodes should not be pruned and given some sort of priority. I am not sure if there is such a use-case as of now. |
@chaitanyaprem Lets leave it by now, since its not that important. Note thought that by "keep connected" I mean keep a relay connection (aka using relay protocol) so not really related to store filter, etc. Note also that ideally "disc nodes" aka bootstrap nodes should not really run any waku protocol but just discv5. In other words, you shouldn't be able to "connect" to a disc node, because it shouldn't support any waku protocol (relay, store, etc). Ofc this is not the case, but its something that imho we should strive for. A disc node (bootstrap node) should just give you other peers, but not provide any other service. (at least imho). |
Got it, understood. We should ensure relay nodes have connections for all shards. Agreed that it would be good to have separate discovery nodes so that they only handle discovery traffic. But, practically we will have to see how it is going to be in the network. |
Weekly Update
|
Weekly Update
|
Weekly Update
|
Closing this issue as dogfooding has been done in following ways:
Any issues that would be reported, will be addressed separately |
Planned start date:
Due date: 31st-Aug-2023
Summary
Implement basic peer management which helps in protecting the node from Dos and also to limit number of connections. This would primarily be helpful for Status Desktop(which runs a relay node) and the service node.
Ensure items from waku-org/nwaku#1353 are covered.
Acceptance Criteria
Tasks
RAID (Risks, Assumptions, Issues and Dependencies)
Dependent on Dogfooding of the new peer management via status desktop.
The text was updated successfully, but these errors were encountered: