Gate sync peer selection on per-protocol concurrent-request limit#9456
Merged
Conversation
Skip peers already at MAX_CONCURRENT_REQUESTS for the protocol being requested and break remaining ties at random, instead of sorting by a peer's total in-flight request count across all protocols.
Hoist ActiveRequestsPerPeer out of the per-column loop and account for in-round assignments via columns_to_request_by_peer.
|
Some required checks have failed. Could you please take a look @dapplion? 🙏 |
eserilev
reviewed
Jun 18, 2026
The map(|_| 1) flag only de-prioritized a peer's second column and is moot since the round batches to one request per peer, matching the by-range path.
Merge Queue Status
This pull request spent 32 minutes 9 seconds in the queue, including 25 minutes 33 seconds running CI. Waiting for
All conditions
ReasonThe merge conditions cannot be satisfied due to failing checks HintYou may have to fix your CI before adding the pull request to the queue again. |
8 tasks
Collaborator
Author
|
@Mergifyio queue |
Merge Queue Status
This pull request spent 1 hour 8 minutes 5 seconds in the queue, including 1 hour 6 minutes 31 seconds running CI. Required conditions to merge
|
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.
When sync picks a peer for a request, it now skips peers that are already at the per-protocol concurrency limit (MAX_CONCURRENT_REQUESTS) for the protocol being requested, and breaks the remaining ties at random. Previously it sorted by each peer's total in-flight request count summed across all protocols.
The per-protocol cap is the only hard limit the RPC layer actually enforces, so gating on it directly avoids handing a request to a peer that will just queue it, while randomness spreads the rest of the load evenly without maintaining any cross-protocol counters. This applies to all the sync peer-selection paths: blocks-by-range, columns-by-range, block lookups, payload lookups, and custody column lookups.
Picks up the ActiveRequestsPerPeer idea from dapplion#81.