perf(state_manager): [DSM-145] Flush large writes from background syncfs thread#10777
Open
alin-at-dfinity wants to merge 1 commit into
Open
perf(state_manager): [DSM-145] Flush large writes from background syncfs thread#10777alin-at-dfinity wants to merge 1 commit into
syncfs thread#10777alin-at-dfinity wants to merge 1 commit into
Conversation
…cfs thread The blocking `syncfs` in `finalize_and_remove_unverified_marker` flushes the dirty data produced earlier in the checkpoint (notably the freshly serialized per-canister protos). At high canister counts this is ~15s on the CUP-critical path. Previously it was cheap only because the overlay/Wasm validation (being removed in #10776) happened to give background writeback time to drain that data first. Spawn a dedicated `TipSyncfs` thread that the tip thread pings (non-blocking, `bounded(1)` + `try_send`, self-coalescing) after every large batch of file writes/hardlinks: after serializing Wasm binaries and protos, after flushing a round's page-map deltas, and after `reset_tip`'s hardlink tree and the merge. The kernel then flushes that data concurrently with the rest of the checkpoint, so the blocking `syncfs` in `finalize` finds little left to do (~15s -> ~0.1s at 200k canisters). `finalize`'s `syncfs` stays as the durability barrier, so the pings are purely an optimization and their errors are non-fatal.
|
✅ No security or compliance issues detected. Reviewed everything up to 0961b3b. Security Overview
Detected Code Changes
|
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.
The blocking
syncfsinfinalize_and_remove_unverified_markerflushes the dirty data produced earlier in the checkpoint (notably the freshly serialized per-canister protos). At high canister counts this is ~15s on the CUP-critical path. Previously it was cheap only because the overlay/Wasm validation (being removed in #10776) happened to give background writeback time to drain that data first.Spawn a dedicated
TipSyncfsthread that the tip thread pings (non-blocking,bounded(1)+try_send, self-coalescing) after every large batch of file writes/hardlinks: after serializing Wasm binaries and protos, after flushing a round's page-map deltas, and afterreset_tip's hardlink tree and the merge. The kernel then flushes that data concurrently with the rest of the checkpoint, so the blockingsyncfsinfinalizefinds little left to do (~15s -> ~0.1s at 200k canisters).finalize'ssyncfsstays as the durability barrier, so the backgroundsyncfscalls are purely an optimization and their errors are non-fatal.