perf(sync-service): overlap WASM compilation with Aura proof downloads#3225
Closed
replghost wants to merge 2 commits into
Closed
perf(sync-service): overlap WASM compilation with Aura proof downloads#3225replghost wants to merge 2 commits into
replghost wants to merge 2 commits into
Conversation
This was referenced Apr 22, 2026
Fire all three P2P requests (storage proof, slot_duration call proof, authorities call proof) in parallel using future::join3. The storage proof branch includes decoding and WASM compilation, which now overlaps with the Aura proof network fetches. After all three complete, the Aura calls are executed sequentially against the compiled VM. On cold start this saves 1-2 seconds because WASM compilation (~200-300ms) no longer blocks the Aura proof downloads. The two Aura downloads also run in parallel with each other, saving an additional round-trip.
add8c3c to
624c10a
Compare
4 tasks
join3 waits for all three futures even when one has already failed. try_join3 cancels the remaining requests on first error, avoiding wasted peer bandwidth and up to 60s of unnecessary timeout delay.
Contributor
Do we have a way of testing with release builds as well? Similarly, is the downloading of |
Contributor
Author
|
Re-ran with release builds (not debug), 10 runs on Polkadot mainnet:
No improvement in release. WASM compilation is ~200-300ms in release vs ~1.5s in debug, so it's never on the critical path. The original debug-build benchmarks were misleading. Closing. |
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
During parachain bootstrap, the three P2P requests (
:code/:heappagesstorage proof,AuraApi_slot_durationcall proof,AuraApi_authoritiescall proof) were fetched sequentially. WASM compilation (~200-300ms) also blocked the Aura proof downloads even though the downloads don't depend on the compiled VM.This PR fires all three requests in parallel using
future::join3. The storage proof branch bundles download + decode + WASM compilation, so compilation overlaps with the Aura proof network fetches. After all three complete, the Aura runtime calls are executed sequentially against the compiled VM.Note:
join3does not cancel on first failure — if the storage proof fails, the two Aura requests still run to completion (up to 16s timeout). This is acceptable for a bootstrap path that retries in a 5s loop; the wasted requests are against a peer already known to be bad and the cost is negligible compared to the retry delay.Changes
bootstrap_parachain_consensusto usefuture::join3for concurrent P2P requestspeer_idandnetwork_serviceBenchmark (smolbench, 3 runs, cold start, debug build)
Polkadot (avg of 3 runs)
Paseo (avg of 3 runs)
Paseo results are network-variance dominated (testnet, fewer peers). Polkadot with its more stable peer population shows the improvement clearly.
Repro
Closes #3220
Closes #3219