Skip to content

perf: Look up sandbox scheduler priorities per canister#10279

Open
alin-at-dfinity wants to merge 2 commits into
masterfrom
alin/sandbox-use-canister-priority
Open

perf: Look up sandbox scheduler priorities per canister#10279
alin-at-dfinity wants to merge 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
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