Skip to content

perf: Look up sandbox scheduler priorities per canister - #10279

Merged
alin-at-dfinity merged 2 commits into
masterfrom
alin/sandbox-use-canister-priority
May 25, 2026
Merged

perf: Look up sandbox scheduler priorities per canister#10279
alin-at-dfinity merged 2 commits into
masterfrom
alin/sandbox-use-canister-priority

Conversation

@alin-at-dfinity

Copy link
Copy Markdown
Contributor

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.

`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>
@alin-at-dfinity
alin-at-dfinity requested a review from a team as a code owner May 22, 2026 07:14
@github-actions github-actions Bot added the perf label May 22, 2026
@alin-at-dfinity
alin-at-dfinity enabled auto-merge May 22, 2026 17:03
@alin-at-dfinity
alin-at-dfinity added this pull request to the merge queue May 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks May 24, 2026
@alin-at-dfinity
alin-at-dfinity added this pull request to the merge queue May 25, 2026
Merged via the queue into master with commit b5efbab May 25, 2026
61 of 64 checks passed
@alin-at-dfinity
alin-at-dfinity deleted the alin/sandbox-use-canister-priority branch May 25, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants