perf(scheduler): use index-based lookup for victim job dedup in preemption solver#1029
perf(scheduler): use index-based lookup for victim job dedup in preemption solver#1029
Conversation
…ption solver Replace O(V*J*P) triple-nested loop in extractJobsFromTasks with O(1) map-based dedup. Add taskToJobRepresentative index to BaseScenario for O(1) GetVictimJobRepresentativeById lookups, replacing the previous O(J*P) linear scan. Add large-cluster (200 nodes, 1000 jobs) benchmarks for preempt and reclaim actions.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📊 Performance Benchmark ResultsComparing PR ( Legend
Raw benchmark dataPR branch: Main branch: |
Merging this branch changes the coverage (1 decrease, 1 increase)
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
Description
Replace O(VJP) triple-nested loop in
extractJobsFromTasksand O(J*P) linear scan inGetVictimJobRepresentativeByIdwith O(1) map-based lookups, improving preemption/reclaim scalability for large clusters.Changes
by_pod_solver.go-extractJobsFromTasks: Replaced triple-nested loop (iterate tasks → iterate existing job representatives → iterate pods in each representative) with amap[*PodGroupInfo]boolset tracking seen job representatives. Reduces dedup from O(VJP) to O(V).base_scenario.go-GetVictimJobRepresentativeById: AddedtaskToJobRepresentativeindex (map[PodID]*PodGroupInfo) toBaseScenario, populated duringappendTasksAsVictimJob. Reduces per-call lookup from O(J*P) to O(1).benchmark_test.go: AddedBenchmarkPreemptAction_LargeClusterandBenchmarkReclaimAction_LargeCluster(200 nodes, 1000 jobs) to exercise preemption/reclaim at scale.base_scenario_test.go: UpdatedGetVictimJobRepresentativeByIdunit tests to use explicit pod UIDs, matching production invariants.Complexity improvement
extractJobsFromTasksGetVictimJobRepresentativeByIdWhere V = victim tasks, J = job representative fragments per PodGroupID, P = pods per job.
Related Issues
Part of hyper-scale improvements roadmap.
Checklist
Breaking Changes
None. Internal optimization only - no API or behavior changes.
Additional Notes
Benchmark results (Apple M3 Pro)
New large-cluster benchmarks: