catchup: improve classBasedPeerSelector on small peer sets#6277
Merged
algorandskiy merged 5 commits intoalgorand:masterfrom Mar 14, 2025
Merged
catchup: improve classBasedPeerSelector on small peer sets#6277algorandskiy merged 5 commits intoalgorand:masterfrom
algorandskiy merged 5 commits intoalgorand:masterfrom
Conversation
gmalouf
reviewed
Mar 14, 2025
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6277 +/- ##
==========================================
- Coverage 51.71% 51.69% -0.02%
==========================================
Files 647 647
Lines 86888 86907 +19
==========================================
- Hits 44934 44927 -7
- Misses 39095 39119 +24
- Partials 2859 2861 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
gmalouf
reviewed
Mar 14, 2025
jannotti
previously approved these changes
Mar 14, 2025
Contributor
jannotti
left a comment
There was a problem hiding this comment.
I made a suggestion, but ready to approve even if you don't like it!
gmalouf
reviewed
Mar 14, 2025
gmalouf
previously approved these changes
Mar 14, 2025
Contributor
gmalouf
left a comment
There was a problem hiding this comment.
Sprinkle of comments, but this looks good to me.
gmalouf
approved these changes
Mar 14, 2025
jannotti
approved these changes
Mar 14, 2025
This was referenced May 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Per #6152 there was an issue with catchup on P2P networks that ended up to be a peer selector (
classBasedPeerSelector) issue. Suppose there are only two Relays and no Archival nodes, and only one of the relays have all the blocks, and a node in question does not have DHT enabled. In this case it will only getConnectedOutandPhonebookRelaypeers (that are the same) and attempts to catchup from them. The following will happen:peerSelectorhas a special logic to penalize a node as it is used in order to distribute load more evenly.classBasedPeerSelectorinstance determinesConnectedOutclass had too many failures, and it is time to temporary disable this class. It advances toPhonebookRelayand the process repeats.agreement.defaultDeadlineTimeout) seconds again.Fixed by decrementing failures counter in
classBasedPeerSelectorso that a single failing node does not prevent the entire class to give up on - the underlyingpeerSelectorwill punish it harder and harder until its rank passes the usage saturation bound (rank=23 for more context).Additionally:
rankSamplesa linked list with node reusage instead of a slice => no extra mem allocs on long catchups.fetchAndWritelogging.Peer selector / catchup updates:
Closes #6152
Test Plan