perf: Look up sandbox scheduler priorities per canister#10279
Open
alin-at-dfinity wants to merge 1 commit into
Open
perf: Look up sandbox scheduler priorities per canister#10279alin-at-dfinity wants to merge 1 commit into
alin-at-dfinity wants to merge 1 commit into
Conversation
`evict_sandbox_processes` only needs the accumulated priority of the canisters that have an active sandbox backend, but currently asks `ReplicatedState` for the priorities of *all* canisters on the subnet, materializing a fresh `BTreeMap<CanisterId, AccumulatedPriority>` on every eviction pass. Replace the bulk lookup with per-id `canister_state(id)` / `canister_priority(id)` calls inside the existing `backends.iter()` loop. Behaviour is unchanged: a missing canister still falls through to `AccumulatedPriority::MIN`. With the sandbox controller migrated, `canister_accumulated_priorities()` has no remaining callers, so drop it (and its now-unused `AccumulatedPriority` import) from `ReplicatedState`. Co-authored-by: Cursor <cursoragent@cursor.com>
schneiderstefan
approved these changes
May 22, 2026
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.
evict_sandbox_processesonly needs the accumulated priority of the canisters that have an active sandbox backend, but currently asksReplicatedStatefor the priorities of all canisters on the subnet, materializing a freshBTreeMap<CanisterId, AccumulatedPriority>on every eviction pass.Replace the bulk lookup with per-id
canister_state(id)/canister_priority(id)calls inside the existingbackends.iter()loop. Behaviour is unchanged: a missing canister still falls through toAccumulatedPriority::MIN.With the sandbox controller migrated,
canister_accumulated_priorities()has no remaining callers, so drop it (and its now-unusedAccumulatedPriorityimport) fromReplicatedState.