Skip to content

Gate sync peer selection on per-protocol concurrent-request limit#9456

Merged
mergify[bot] merged 7 commits into
sigp:unstablefrom
dapplion:sync-load-balancing
Jun 21, 2026
Merged

Gate sync peer selection on per-protocol concurrent-request limit#9456
mergify[bot] merged 7 commits into
sigp:unstablefrom
dapplion:sync-load-balancing

Conversation

@dapplion

Copy link
Copy Markdown
Collaborator

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.

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.
@dapplion dapplion requested a review from jxs as a code owner June 11, 2026 16:16
Hoist ActiveRequestsPerPeer out of the per-column loop and account for
in-round assignments via columns_to_request_by_peer.
@dapplion dapplion requested review from eserilev and pawanjay176 June 17, 2026 13:26
@dapplion dapplion added the ready-for-review The code is ready for review label Jun 17, 2026
@mergify

mergify Bot commented Jun 18, 2026

Copy link
Copy Markdown

Some required checks have failed. Could you please take a look @dapplion? 🙏

@mergify mergify Bot added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-review The code is ready for review labels Jun 18, 2026

@eserilev eserilev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Comment thread beacon_node/network/src/sync/network_context.rs Outdated
dapplion added 2 commits June 18, 2026 10:21
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.
@dapplion dapplion added ready-for-merge This PR is ready to merge. and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Jun 18, 2026
@mergify mergify Bot added the queued label Jun 18, 2026
@mergify

mergify Bot commented Jun 18, 2026

Copy link
Copy Markdown

Merge Queue Status

This pull request spent 32 minutes 9 seconds in the queue, including 25 minutes 33 seconds running CI.

Waiting for
  • check-success=local-testnet-success
  • check-success=test-suite-success
All conditions

Reason

The merge conditions cannot be satisfied due to failing checks

Hint

You may have to fix your CI before adding the pull request to the queue again.
If you update this pull request, to fix the CI, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

mergify Bot added a commit that referenced this pull request Jun 18, 2026
@mergify mergify Bot added dequeued and removed queued labels Jun 18, 2026
@dapplion

Copy link
Copy Markdown
Collaborator Author

@Mergifyio queue

@mergify

mergify Bot commented Jun 21, 2026

Copy link
Copy Markdown

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

@mergify mergify Bot added queued and removed dequeued labels Jun 21, 2026
mergify Bot added a commit that referenced this pull request Jun 21, 2026
@mergify mergify Bot merged commit b05badb into sigp:unstable Jun 21, 2026
38 checks passed
@mergify mergify Bot removed the queued label Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants