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

Reduce load on validator subscription channels #5311

Merged
merged 4 commits into from
Mar 7, 2024

Conversation

pawanjay176
Copy link
Member

@pawanjay176 pawanjay176 commented Feb 26, 2024

Issue Addressed

N/A

Proposed Changes

Since we now only subscribe to a fixed number of long lived subnets per node, the validator_index field in ValidatorSubscription type is entirely inconsequential to the beacon node.

This PR does 2 things:

  1. Removes the validator_index field from the ValidatorSubscription type. This allows us to filter duplicates which can be quite a lot in high validator count setups.
  2. Instead of sending each subscription from the http api to the network service in a separate message, we send it in one single message.
    I'm not completely sure at what size of the vector we'll start seeing slowness in the channel, but by filtering duplicates, we shouldn't be sending too many.
    Max length of the vector would be max_committees_per_slot * slots_per_epoch * 2(aggregator bit) = 4096 .
    Not super attached to this change, but if we send one by one, then we should probably change the ValidatorSubscriptionMessage to take just a single message instead of a vector for consistency.

@pawanjay176 pawanjay176 added the ready-for-review The code is ready for review label Feb 26, 2024
Copy link
Member

@AgeManning AgeManning left a comment

Choose a reason for hiding this comment

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

Yeah nice. Reducing messages ftw

@pawanjay176 pawanjay176 added the optimization Something to make Lighthouse run more efficiently. label Feb 27, 2024
Copy link
Collaborator

@dapplion dapplion left a comment

Choose a reason for hiding this comment

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

LGTM

@pawanjay176
Copy link
Member Author

@michaelsproul Can we roll this in with #5305 ?

@pawanjay176 pawanjay176 added the v5.1.0 Q2 2024 label Mar 6, 2024
Copy link
Member

@michaelsproul michaelsproul left a comment

Choose a reason for hiding this comment

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

Looks good with the BTreeSet tweak!

Happy to merge and continue testing on infra over the weekend

@pawanjay176 pawanjay176 added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels Mar 7, 2024
@pawanjay176
Copy link
Member Author

@Mergifyio queue

Copy link

mergify bot commented Mar 7, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at 84a902a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimization Something to make Lighthouse run more efficiently. ready-for-merge This PR is ready to merge. v5.1.0 Q2 2024
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants