perf(state_manager): [DSM-145] Compute the manifest concurrently with validation#10798
Open
alin-at-dfinity wants to merge 1 commit into
Open
perf(state_manager): [DSM-145] Compute the manifest concurrently with validation#10798alin-at-dfinity wants to merge 1 commit into
alin-at-dfinity wants to merge 1 commit into
Conversation
… validation Move manifest computation onto a dedicated thread so it overlaps `ValidateReplicatedStateAndFinalize` instead of running after it on the tip thread. The `ComputeManifest` request is enqueued on the tip channel ahead of validation and forwarded by the tip thread to the manifest thread only once`TipToCheckpointAndSwitch` has finished serializing the checkpoint's protos. The computed `BundledManifest` is handed back and published from a paired `WaitForManifest` request enqueued on the tip channel after validation, so the root hash is only visible to Consensus once the checkpoint is verified. At 200k idle canisters, the manifest (~28s to root hash) now runs entirely within the validation window (~31s), cutting batch->root-hash from ~44s to ~34s while also moving the post-publish rehash off the critical path. Supporting changes: - `files_with_sizes` skips checkpoint marker files during the directory walk. They are never part of a manifest, and skipping them by name avoids `stat`ing a marker that concurrent checkpoint finalization is removing, which would otherwise fail manifest computation. This makes the previous post-hoc marker exclusion in `compute_manifest` unnecessary. - `flush_tip_channel` forwards its `Wait` barrier to the manifest thread as well, so it still waits for all outstanding checkpoint work -- including the post-publish rehash -- to drain.
|
✅ No security or compliance issues detected. Reviewed everything up to 7c1a82d. 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.
Move manifest computation onto a dedicated thread so it overlaps
ValidateReplicatedStateAndFinalizeinstead of running after it on the tip thread.The
ComputeManifestrequest is enqueued on the tip channel ahead of validation and forwarded by the tip thread to the manifest thread only onceTipToCheckpointAndSwitchhas finished serializing the checkpoint's protos. The computedBundledManifestis handed back and published from a pairedWaitForManifestrequest enqueued on the tip channel after validation, so the root hash is only visible to Consensus once the checkpoint is verified.At 200k idle canisters, the manifest (~28s to root hash) now runs entirely within the validation window (~31s), cutting batch->root-hash from ~44s to ~34s while also moving the post-publish rehash off the critical path.
Supporting changes:
files_with_sizesskips checkpoint marker files during the directory walk. They are never part of a manifest, and skipping them by name avoidsstating a marker that concurrent checkpoint finalization is removing, which would otherwise fail manifest computation. This makes the previous post-hoc marker exclusion incompute_manifestunnecessary.flush_tip_channelforwards itsWaitbarrier to the manifest thread as well, so it still waits for all outstanding checkpoint work -- including the post-publish rehash -- to drain.