Skip to content

Commit

Permalink
feat: EXC-1787: Simplify scheduler implementation
Browse files Browse the repository at this point in the history
- fixes scheduler divergence
- simplifies the scheduler down to accumulated priority and long execution mode
- uses round-robin partitioning instead of complicated algorithm (RUN-320)
  • Loading branch information
berestovskyy committed Dec 2, 2024
1 parent 2a400f5 commit dd2aa41
Show file tree
Hide file tree
Showing 13 changed files with 257 additions and 263 deletions.
18 changes: 3 additions & 15 deletions rs/execution_environment/benches/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use std::collections::BTreeMap;

fn main() {
let mut canisters = BTreeMap::new();
let mut ordered_new_execution_canister_ids = Vec::new();
let mut ordered_long_execution_canister_ids = Vec::new();
let mut ordered_canister_ids = Vec::new();
for i in 0..50_000 {
let canister_id = canister_test_id(i);
let scheduler_state = SchedulerState::default();
Expand All @@ -25,22 +24,11 @@ fn main() {
CanisterState::new(system_state, None, scheduler_state),
);

if i % 10 == 0 {
ordered_long_execution_canister_ids.push(canister_id);
} else {
ordered_new_execution_canister_ids.push(canister_id);
}
ordered_canister_ids.push(canister_id);
}

let scheduler_cores = 4;
let long_execution_cores = 1;
let round_schedule = RoundSchedule::new(
scheduler_cores,
long_execution_cores,
0,
ordered_new_execution_canister_ids,
ordered_long_execution_canister_ids,
);
let round_schedule = RoundSchedule::new(scheduler_cores, 0, ordered_canister_ids);

let mut criterion = Criterion::default();
let mut group = criterion.benchmark_group("RoundSchedule");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1894,7 +1894,6 @@ fn canister_snapshot_change_guard_do_not_modify_without_reading_doc_comment() {
last_full_execution_round: _,
compute_allocation: _,
accumulated_priority: _,
priority_credit: _,
long_execution_mode: _,
heap_delta_debit: _,
install_code_debit: _,
Expand Down
2 changes: 1 addition & 1 deletion rs/execution_environment/src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1681,7 +1681,7 @@ impl FilteredCanisters {
rate_limited_ids: &[CanisterId],
) {
self.active_canister_ids
.extend(active_round_schedule.iter());
.extend(active_round_schedule.ordered_canister_ids.iter());
self.rate_limited_canister_ids
.extend(rate_limited_ids.iter());
}
Expand Down
Loading

0 comments on commit dd2aa41

Please sign in to comment.