ibd: cadence assign, peer-slow, hygiene, headers off the event path - #317
Merged
Conversation
The 50ms sleep only fires when the loop is idle. Peer frames re-entered the full housekeeping path at event rate: 64k densify scans, locator_hashes header-table walks, relative-slow, and HashMap hygiene competed with confirm. Drain and confirm-offer stay event-driven. Assign ≤50ms (immediate if inflight empty), header poll ≤500ms (empty path immediate), stall and work-path hygiene ≤1s. Drop the second assign-after-free; 50ms refill is enough for window=1024.
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.
Why
The IBD orchestration loop still looks like a 50 ms tick, but the
select!is biased to peer frames and the sleep only fires when idle. During download that means every block/header event re-ran:assign_work_orderedFull —has_blockover inflight, then up toFAR_SCAN_BUDGET(64 k)need_hash_at/claim_ready/ body-queue lookupssample_peer_rates+ stall + relative-slow (stall is 30 s; relative-slow hysteresis 2 s / kick gap 5 s)hygieneHashMap retain (every 32 turns at event rate)request_headers→locator_hashes()header-table walkThat CPU/IO is not needed for confirm to progress and competed with the pipeline. Drain + confirm-offer stay event-driven. Full 2000-header continuation still fires from the Headers event.
Cadence (good enough, less responsive)
ordereddequeDropped the second assign-after-free; window=1024 refills on the 50 ms assign.
Left alone on purpose: confirm drain/offer, FAR_SCAN_BUDGET / densify_scan_lo, event-driven header continuation, 5 s status scan, hard path reset, Direct-IBD skip of SH/tweaks.
Tests
ibd::cadencepins first-turn / period / inflight-empty / empty-path / bloat bypassordered_bloated+ existing hygiene tests (hygiene always runs when called; caller cadences)ibd_smoke