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

Broadcast VC requests in parallel and fix subscription error #6223

Merged
merged 5 commits into from
Aug 7, 2024

Conversation

michaelsproul
Copy link
Member

@michaelsproul michaelsproul commented Aug 5, 2024

Issue Addressed

Closes:

Proposed Changes

Use join_all to run futures in parallel.

This seemed a bit cleaner than using JoinSet, and is similarly efficient. Each loop iteration should be quick because .status().await just checks an rwlock, it doesn't actually make any requests to the BN.

This PR also fixes a bug whereby we wouldn't mark subscriptions as sent if any node failed. This meant that in the case of 1 offline node, subscriptions would continue getting spammed at the BN right up to the duty slot, which would result in the infamous warning:

WARN Not enough time for a discovery search

This is fixed in 2 ways:

  • We check if we are too close to the duty slot in should_send_subscription_at
  • We mark subscriptions as sent as long as one node receives them (we also just log a warning in this case rather than an error).

Along the way I also added a 500ms timeout for subscription requests, which previously had no timeout! I'm open to tweaking this timeout or putting it in another PR.

Additional Info

This improvement should help the performance of clusters of nodes when one of them goes AWOL due to an issue like:

@michaelsproul michaelsproul added ready-for-review The code is ready for review optimization Something to make Lighthouse run more efficiently. v5.3.0 Q3 2024 release with database changes! labels Aug 5, 2024
michaelsproul added a commit that referenced this pull request Aug 5, 2024
Squashed commit of the following:

commit 763a6ae
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Mon Aug 5 13:27:55 2024 +1000

    Broadcast VC requests in parallel
Copy link
Member

@realbigsean realbigsean left a comment

Choose a reason for hiding this comment

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

LGTM

@michaelsproul
Copy link
Member Author

This isn't working as well as expected (we still seem to have requests getting massively delayed), so I'm trying some improvements

@michaelsproul michaelsproul added work-in-progress PR is a work-in-progress and removed ready-for-review The code is ready for review labels Aug 6, 2024
michaelsproul added a commit that referenced this pull request Aug 6, 2024
Squashed commit of the following:

commit f0b4a0a
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Tue Aug 6 11:58:56 2024 +1000

    Try some things

commit e2f1875
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Tue Aug 6 11:50:35 2024 +1000

    Remove outdated comment

commit 763a6ae
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Mon Aug 5 13:27:55 2024 +1000

    Broadcast VC requests in parallel
michaelsproul added a commit that referenced this pull request Aug 6, 2024
Squashed commit of the following:

commit d85687b
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Tue Aug 6 15:12:32 2024 +1000

    Remove junk logging

commit 1126795
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Tue Aug 6 15:10:28 2024 +1000

    Fix subscription error

commit f0b4a0a
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Tue Aug 6 11:58:56 2024 +1000

    Try some things

commit e2f1875
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Tue Aug 6 11:50:35 2024 +1000

    Remove outdated comment

commit 763a6ae
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Mon Aug 5 13:27:55 2024 +1000

    Broadcast VC requests in parallel
@michaelsproul michaelsproul changed the title Broadcast VC requests in parallel Broadcast VC requests in parallel and fix subscription error Aug 6, 2024
@michaelsproul michaelsproul added ready-for-review The code is ready for review and removed work-in-progress PR is a work-in-progress labels Aug 6, 2024
@michaelsproul
Copy link
Member Author

I think I've fixed the bug in 1126795

Rolling out now

@jimmygchen
Copy link
Member

Random fact:

The probability of getting the first 9 characters of a Git commit hash as digits (0-9) is approximately 1.455%

@michaelsproul
Copy link
Member Author

@mergify queue

Copy link

mergify bot commented Aug 7, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at a68f34a

mergify bot added a commit that referenced this pull request Aug 7, 2024
@mergify mergify bot merged commit a68f34a into sigp:release-v5.3.0 Aug 7, 2024
28 checks passed
AgeManning pushed a commit to AgeManning/lighthouse that referenced this pull request Sep 3, 2024
* Broadcast VC requests in parallel

* Remove outdated comment

* Try some things

* Fix subscription error

* Remove junk logging
@michaelsproul michaelsproul deleted the vc-parallel-broadcast branch October 16, 2024 22:30
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-review The code is ready for review v5.3.0 Q3 2024 release with database changes!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants