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: Sharded peer management - Relay #764

Merged
merged 12 commits into from
Sep 27, 2023
Merged

Conversation

chaitanyaprem
Copy link
Collaborator

@chaitanyaprem chaitanyaprem commented Sep 22, 2023

Description

Ensure healthy relay peer connections for pubSub topics or shards subscribed to by the node.
Refer to issue #727 for overall scope.

Changes

  • Handle new topic subscription by identifying and connecting to peers if required
  • Handle topic unsubscription and tearing down connections to peers if they don't support any other shards.
  • Maintain healty relay peer connections per shard
  • Discovered peers are connected immediately until minThreshold peers are reached, post which they are added to peerStore only. Peer connection management is handled by peerManager.

Tests

  • Ran all unit tests
  • Ran a serviceNode with single topic and observed topic being identified as unhealthy and moved to healthy by establishing more conns. Connected 10 other nodes to this node to validate connection pruning.

@chaitanyaprem chaitanyaprem changed the title feat: Sharded peer management for relay feat: Sharded peer management - handle topic sub/unsub Sep 22, 2023
@status-im-auto
Copy link

status-im-auto commented Sep 22, 2023

Jenkins Builds

Click to see older builds (54)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ ee213c6 #1 2023-09-22 07:21:04 ~2 min nix-flake 📄log
✔️ ee213c6 #1 2023-09-22 07:21:17 ~2 min linux 📦deb
✔️ ee213c6 #1 2023-09-22 07:22:04 ~3 min tests 📄log
✔️ ee213c6 #1 2023-09-22 07:22:22 ~3 min tests 📄log
✔️ ee213c6 #1 2023-09-22 07:22:54 ~4 min android 📦tgz
✔️ ee213c6 #1 2023-09-22 07:23:19 ~4 min ios 📦tgz
✔️ ed1d279 #2 2023-09-22 07:22:24 ~1 min linux 📦deb
✔️ ed1d279 #2 2023-09-22 07:23:01 ~1 min nix-flake 📄log
✔️ ed1d279 #2 2023-09-22 07:23:43 ~1 min tests 📄log
✔️ ed1d279 #2 2023-09-22 07:24:30 ~1 min tests 📄log
✔️ ed1d279 #2 2023-09-22 07:24:30 ~4 min ios 📦tgz
✔️ ed1d279 #2 2023-09-22 07:26:00 ~3 min android 📦tgz
✔️ cbb8506 #3 2023-09-22 08:31:18 ~50 sec tests 📄log
✔️ cbb8506 #3 2023-09-22 08:31:30 ~1 min linux 📦deb
✔️ cbb8506 #3 2023-09-22 08:32:20 ~1 min nix-flake 📄log
✔️ cbb8506 #3 2023-09-22 08:33:29 ~2 min tests 📄log
✔️ cbb8506 #3 2023-09-22 08:33:48 ~3 min android 📦tgz
✔️ cbb8506 #3 2023-09-22 08:34:00 ~3 min ios 📦tgz
✔️ ebe012d #4 2023-09-22 11:10:45 ~1 min nix-flake 📄log
✔️ ebe012d #4 2023-09-22 11:10:49 ~1 min tests 📄log
✔️ ebe012d #4 2023-09-22 11:11:10 ~2 min linux 📦deb
✖️ ebe012d #4 2023-09-22 11:11:30 ~2 min tests 📄log
✔️ ebe012d #4 2023-09-22 11:11:59 ~3 min ios 📦tgz
✔️ ebe012d #4 2023-09-22 11:12:10 ~3 min android 📦tgz
✔️ 0058a27 #5 2023-09-25 07:48:11 ~1 min linux 📦deb
✔️ 0058a27 #5 2023-09-25 07:48:56 ~1 min nix-flake 📄log
✔️ 0058a27 #5 2023-09-25 07:50:13 ~3 min tests 📄log
✔️ 0058a27 #5 2023-09-25 07:50:16 ~3 min tests 📄log
✔️ 0058a27 #5 2023-09-25 07:51:03 ~4 min android 📦tgz
✔️ 0058a27 #5 2023-09-25 07:53:50 ~6 min ios 📦tgz
✔️ f5e1467 #6 2023-09-25 07:49:17 ~1 min linux 📦deb
✔️ f5e1467 #6 2023-09-25 07:51:29 ~2 min nix-flake 📄log
✔️ f5e1467 #6 2023-09-25 07:51:53 ~1 min tests 📄log
✔️ f5e1467 #6 2023-09-25 07:52:22 ~2 min tests 📄log
✔️ f5e1467 #6 2023-09-25 07:53:35 ~5 min ios 📦tgz
✔️ f5e1467 #6 2023-09-25 07:54:09 ~3 min android 📦tgz
✔️ 7ae1f78 #7 2023-09-25 10:27:33 ~1 min tests 📄log
✔️ 7ae1f78 #7 2023-09-25 10:27:38 ~1 min nix-flake 📄log
✔️ 7ae1f78 #7 2023-09-25 10:27:49 ~2 min linux 📦deb
✔️ 7ae1f78 #7 2023-09-25 10:30:00 ~4 min android 📦tgz
✔️ 7ae1f78 #7 2023-09-25 10:30:09 ~4 min tests 📄log
✔️ 7ae1f78 #7 2023-09-25 10:34:26 ~8 min ios 📦tgz
✔️ 536b775 #8 2023-09-27 04:58:34 ~1 min linux 📦deb
✔️ 536b775 #8 2023-09-27 04:59:01 ~1 min tests 📄log
✔️ 536b775 #8 2023-09-27 04:59:22 ~1 min nix-flake 📄log
✔️ 536b775 #8 2023-09-27 04:59:31 ~1 min tests 📄log
✔️ 536b775 #8 2023-09-27 05:00:52 ~3 min ios 📦tgz
✔️ 536b775 #8 2023-09-27 05:00:57 ~3 min android 📦tgz
✔️ eb0c09b #9 2023-09-27 05:17:50 ~1 min linux 📦deb
✔️ eb0c09b #9 2023-09-27 05:18:21 ~1 min tests 📄log
✔️ eb0c09b #9 2023-09-27 05:18:41 ~1 min nix-flake 📄log
✔️ eb0c09b #9 2023-09-27 05:18:50 ~1 min tests 📄log
✔️ eb0c09b #9 2023-09-27 05:20:23 ~3 min android 📦tgz
✔️ eb0c09b #9 2023-09-27 05:20:23 ~3 min ios 📦tgz
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 632ad6a #10 2023-09-27 05:20:12 ~1 min linux 📦deb
✔️ 632ad6a #10 2023-09-27 05:20:43 ~1 min tests 📄log
✔️ 632ad6a #10 2023-09-27 05:21:03 ~1 min nix-flake 📄log
✔️ 632ad6a #10 2023-09-27 05:21:14 ~2 min tests 📄log
✔️ 632ad6a #10 2023-09-27 05:22:44 ~3 min ios 📦tgz
✔️ 632ad6a #10 2023-09-27 05:23:30 ~3 min android 📦tgz
✔️ 359b28a #11 2023-09-27 06:43:16 ~1 min tests 📄log
✔️ 359b28a #11 2023-09-27 06:43:40 ~2 min tests 📄log
✔️ 359b28a #11 2023-09-27 06:43:40 ~2 min nix-flake 📄log
✔️ 359b28a #11 2023-09-27 06:43:52 ~2 min linux 📦deb
✔️ 359b28a #11 2023-09-27 06:45:02 ~3 min android 📦tgz
✔️ 359b28a #11 2023-09-27 06:45:13 ~3 min ios 📦tgz

@chaitanyaprem chaitanyaprem marked this pull request as ready for review September 25, 2023 09:48
@chaitanyaprem chaitanyaprem self-assigned this Sep 25, 2023
Copy link

@SionoiS SionoiS left a comment

Choose a reason for hiding this comment

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

The logic is good.

In practice it might have problems if there's a lot of node churn.

Until we have something more sophisticated this works.

P.S. can't read Go very well.

@chaitanyaprem chaitanyaprem changed the title feat: Sharded peer management - handle topic sub/unsub feat: Sharded peer management - Relay Sep 26, 2023
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. Looking fwd to see it in action.
I added some minor comments / nitpick (like reducing verbosity of some logs), but overall it looks great

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
waku/v2/peermanager/peer_manager.go Outdated Show resolved Hide resolved
waku/v2/peermanager/topic_event_handler.go Outdated Show resolved Hide resolved
waku/v2/peermanager/topic_event_handler.go Outdated Show resolved Hide resolved
waku/v2/peermanager/topic_event_handler.go Outdated Show resolved Hide resolved
chaitanyaprem and others added 4 commits September 27, 2023 10:27
Co-authored-by: richΛrd <info@richardramos.me>
* chore: add config to limit peerstore capacity

* fix: expire peer addresses discovered dynamically,remove them from peerStore after expiry
@chaitanyaprem chaitanyaprem merged commit 388f56b into master Sep 27, 2023
9 of 11 checks passed
@chaitanyaprem chaitanyaprem deleted the feat/sharded-peer-mgmt branch September 27, 2023 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants