Skip to content

Conversation

@0xKarl98
Copy link
Contributor

@0xKarl98 0xKarl98 commented Nov 14, 2025

Short Summary on solving the issue #19705 :

  • Introduced per-peer pending queues with event-driven scheduling: announcements, request failures, and completions , now immediately trigger try_schedule_pending_fetches, eliminating reliance on poll-time budgets.

  • Factored the request-packing logic into a reusable RequestBuilder that enforces hash/byte dual limits (mirroring geth’s scheduleFetches) and added boundary unit tests.

  • Removed the legacy search_breadth_budget_* and related constants; per-peer scheduling is enabled by default and exposed through the CLI/config.

  • Enhanced observability with new metrics (peer queue size/hash count) and Prometheus panels so the new scheduler’s health is visible at a glance.

Geth inspiration:

  • State-machine layout with per-peer queues.

  • Request construction governed by both hash count and estimated payload size.
    Immediate, event-driven scheduling plus richer instrumentation.

cc @mattsse @Rjected @klkvr @shekhirin

@0xKarl98 0xKarl98 marked this pull request as draft November 14, 2025 05:08
@0xKarl98 0xKarl98 marked this pull request as ready for review November 14, 2025 05:39
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

cool, all of this looks very good

need a bit more time to review this in detail, but we can move forward with this

Comment on lines +413 to +417
fn try_request_via_peer_queue(
&mut self,
peers: &HashMap<PeerId, PeerMetadata<N>>,
search_durations: &mut TxFetcherSearchDurations,
) -> bool {
Copy link
Collaborator

Choose a reason for hiding this comment

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

could we add some additional docs to this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have updated

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 15, 2025

CodSpeed Performance Report

Merging #19738 will degrade performances by 29.02%

Comparing 0xKarl98:tx_hash_packing (8f283c6) with main (fce0825)

Summary

❌ 1 regression
✅ 80 untouched

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
remove_leaf[1000] 193.4 µs 272.5 µs -29.02%

@0xKarl98 0xKarl98 requested a review from mattsse November 17, 2025 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants