Skip to content
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

Feat/peer manager #596

Merged
merged 18 commits into from
Aug 3, 2023
Merged

Feat/peer manager #596

merged 18 commits into from
Aug 3, 2023

Conversation

chaitanyaprem
Copy link
Collaborator

@chaitanyaprem chaitanyaprem commented Jul 6, 2023

Introduce peer manager as per #621

  1. connection pruning for inRelay peers as per max default.
  2. add new flag --max-connections to set max number of peers to be allowed
  3. Control number of outRelayPeers to be connected based on max connections as per feat: limit relay connections below max conns nwaku#1813.

Tested pruning of incoming relay peer connections based on configuration.
Tested outRelay Peers limit based on configuration.

Not sure if this will impact service peer connectivity, since that has not yet been tested.
If so, then will implement service slots next which should take care of that.

@status-im-auto
Copy link

status-im-auto commented Jul 6, 2023

Jenkins Builds

Click to see older builds (50)
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ 7b75d04 #1 2023-07-06 11:52:47 ~2 min nix-flake 📄log
✔️ 7b75d04 #1 2023-07-06 11:53:43 ~3 min linux 📦deb
✔️ 7b75d04 #1 2023-07-06 11:55:15 ~5 min tests 📄log
✔️ 7b75d04 #1 2023-07-06 11:56:38 ~6 min android 📦tgz
✔️ 7b75d04 #1 2023-07-06 12:08:10 ~18 min ios 📦tgz
✔️ 8011ee4 #2 2023-07-07 01:59:46 ~1 min linux 📦deb
✔️ 8011ee4 #2 2023-07-07 01:59:58 ~1 min nix-flake 📄log
✔️ 8011ee4 #2 2023-07-07 02:01:11 ~3 min tests 📄log
✔️ 8011ee4 #2 2023-07-07 02:02:07 ~4 min android 📦tgz
✔️ 8011ee4 #2 2023-07-07 02:15:55 ~17 min ios 📦tgz
✔️ 77f06d3 #3 2023-08-03 07:17:20 ~1 min linux 📦deb
✖️ 77f06d3 #3 2023-08-03 07:17:48 ~1 min tests 📄log
✔️ 77f06d3 #3 2023-08-03 07:18:11 ~2 min nix-flake 📄log
✔️ 77f06d3 #3 2023-08-03 07:20:27 ~4 min android 📦tgz
✔️ 77f06d3 #3 2023-08-03 07:20:29 ~4 min ios 📦tgz
✔️ ec479a9 #4 2023-08-03 07:20:07 ~36 sec linux 📦deb
✖️ ec479a9 #4 2023-08-03 07:21:10 ~1 min tests 📄log
✔️ ec479a9 #4 2023-08-03 07:21:23 ~1 min nix-flake 📄log
✔️ ec479a9 #4 2023-08-03 07:23:26 ~3 min ios 📦tgz
✔️ ec479a9 #4 2023-08-03 07:24:14 ~3 min android 📦tgz
✔️ 87695c1 #5 2023-08-03 07:36:05 ~1 min linux 📦deb
✖️ 87695c1 #5 2023-08-03 07:36:16 ~1 min tests 📄log
✔️ 87695c1 #5 2023-08-03 07:36:43 ~1 min nix-flake 📄log
✔️ 87695c1 #5 2023-08-03 07:38:15 ~3 min android 📦tgz
✔️ 87695c1 #5 2023-08-03 07:38:30 ~3 min ios 📦tgz
✔️ 6eeb6cc #6 2023-08-03 09:07:37 ~31 sec linux 📦deb
✔️ 6eeb6cc #6 2023-08-03 09:08:40 ~1 min tests 📄log
✔️ 6eeb6cc #6 2023-08-03 09:08:59 ~1 min nix-flake 📄log
✔️ 6eeb6cc #6 2023-08-03 09:10:22 ~3 min android 📦tgz
✔️ 6eeb6cc #6 2023-08-03 09:10:44 ~3 min ios 📦tgz
✔️ 1ebc74f #7 2023-08-03 11:20:56 ~35 sec linux 📦deb
✔️ 1ebc74f #7 2023-08-03 11:22:04 ~1 min tests 📄log
✔️ 1ebc74f #7 2023-08-03 11:22:16 ~1 min nix-flake 📄log
✔️ 1ebc74f #7 2023-08-03 11:24:28 ~4 min android 📦tgz
✔️ 1ebc74f #7 2023-08-03 11:24:40 ~4 min ios 📦tgz
✖️ 1b4c08f #8 2023-08-03 12:56:44 ~1 min tests 📄log
✔️ 1b4c08f #8 2023-08-03 12:56:49 ~1 min nix-flake 📄log
✔️ 1b4c08f #8 2023-08-03 12:57:24 ~2 min linux 📦deb
✔️ 1b4c08f #8 2023-08-03 12:58:24 ~3 min android 📦tgz
✔️ 1b4c08f #8 2023-08-03 13:04:03 ~9 min ios 📦tgz
124b28b #9 2023-08-03 13:36:51 ~34 sec linux 📄log
✖️ 124b28b #9 2023-08-03 13:37:13 ~53 sec tests 📄log
✖️ 124b28b #9 2023-08-03 13:37:29 ~1 min nix-flake 📄log
124b28b #9 2023-08-03 13:38:03 ~1 min android 📄log
124b28b #9 2023-08-03 13:42:52 ~6 min ios 📄log
1cb528c #10 2023-08-03 13:37:16 ~18 sec linux 📄log
✖️ 1cb528c #10 2023-08-03 13:37:39 ~19 sec tests 📄log
✖️ 1cb528c #10 2023-08-03 13:38:30 ~55 sec nix-flake 📄log
1cb528c #10 2023-08-03 13:39:32 ~1 min android 📄log
1cb528c #10 2023-08-03 13:46:53 ~9 min ios 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ 6ad7668 #11 2023-08-03 13:40:57 ~25 sec tests 📄log
✔️ 6ad7668 #11 2023-08-03 13:41:07 ~37 sec linux 📦deb
✔️ 6ad7668 #11 2023-08-03 13:42:24 ~1 min nix-flake 📄log
✔️ 6ad7668 #11 2023-08-03 13:43:50 ~3 min android 📦tgz
✔️ 6ad7668 #11 2023-08-03 13:49:48 ~9 min ios 📦tgz
✔️ a548307 #12 2023-08-03 13:47:09 ~34 sec linux 📦deb
✔️ a548307 #12 2023-08-03 13:48:16 ~1 min tests 📄log
✔️ a548307 #12 2023-08-03 13:48:26 ~1 min nix-flake 📄log
✔️ a548307 #12 2023-08-03 13:49:39 ~3 min android 📦tgz
✔️ a548307 #12 2023-08-03 13:51:45 ~5 min ios 📦tgz

@chaitanyaprem chaitanyaprem marked this pull request as ready for review August 3, 2023 12:54
Copy link
Member

@richard-ramos richard-ramos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice PR!


// TODO: Move all the protocol IDs to a common location.
// WakuRelayIDv200 is protocol ID for Waku v2 relay protocol
const WakuRelayIDv200 = protocol.ID("/vac/waku/relay/2.0.0")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this constant can be obtained from relay package

Copy link
Collaborator Author

@chaitanyaprem chaitanyaprem Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If i do that, it was causing some circular import issue.
I think we will have to move all protocol constants to a common file so that they can be imported wherever we want.

waku/v2/peermanager/peer_manager.go Outdated Show resolved Hide resolved
waku/v2/peermanager/peer_manager.go Outdated Show resolved Hide resolved
waku/v2/peermanager/peer_manager.go Outdated Show resolved Hide resolved
if inRelayPeers.Len() > int(pm.InRelayPeersTarget) {
//Start disconnecting peers, based on what?
//For now, just disconnect most recently connected peers
//TODO: Need to have more intelligent way of doing this, maybe peer scores.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of using peer score for choosing which peer to remove!

chaitanyaprem and others added 4 commits August 3, 2023 19:05
Using peerstore's supportedProtocols method

Co-authored-by: richΛrd <[email protected]>
Review comment, use context to pause connectivity loop during node shutdown.

Co-authored-by: richΛrd <[email protected]>
@chaitanyaprem chaitanyaprem merged commit 34de294 into master Aug 3, 2023
@chaitanyaprem chaitanyaprem deleted the feat/peer-manager branch August 3, 2023 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants