Scheduler simulation and trace replay
Calibrate workload and cost models, compare policies consistently, and preserve the limits of counterfactual conclusions.
On this page
The question for today
What you’ll understand
- Specify arrivals, resource shapes, and runtime models in a replay.
- Separate exact trace accounting from uncertain counterfactual performance.
- Evaluate fairness, overhead, and external validity beyond a single average.
A new scheduler looks excellent when replaying last month’s job log. But the recorded durations came from the old placements, users may change behavior when waiting changes, and the trace may omit rejected work. Simulation is valuable precisely because it makes assumptions executable. The conclusion should state which counterfactual policy was evaluated, what the model preserves, and where measurements rather than replay are still needed.
Record what the trace actually observed
A useful trace includes job submission and eligibility times, requested resource vectors, constraints, priority or tenant identity, admission and placement decisions, start and finish boundaries, and interrupted or failed attempts. Distinguish useful runtime from elapsed allocation time. Missing rejected or cancelled jobs changes the workload population. An experiment that replays only jobs that successfully completed can systematically exclude the hardest demand. Protect sensitive identifiers through an appropriate anonymization process that preserves dependencies and resource shapes needed for the study.
Trace replay must define the arrival process. Keeping recorded submission times assumes arrivals stay fixed when policy changes. A closed user workflow may submit its next experiment only after the previous one finishes, so changed completion times can change later arrivals. Neither fixed-arrival nor feedback replay is universally right; each answers a stated question. Preserve dependency graphs where later jobs require earlier outputs. Starting a dependent training run before its data exists produces a flattering simulation of an impossible workflow.
Counterfactual runtime needs calibration
Reusing recorded duration assumes the new placement and sharing policy do not change the workload’s effective execution time. That assumption is often false for distributed training: topology, accelerator type, worker count, interference, and preemption can alter iteration speed. Calibrate service models with representative measurements and quantify residual error. Include checkpoint, restore, migration, scheduling-cycle, and data-loading costs when the candidate policy invokes them. A simulator that treats preemption as instantaneous and free can select a policy that performs poorly once those costs are paid.
Gandiva and Tiresias motivate workload-aware evaluation, but their measured results belong to their own systems, traces, and hardware assumptions. Use them to identify mechanisms and evaluation questions rather than copy a headline improvement into your cluster forecast. Validate the simulator against held-out runs under an existing policy before trusting new-policy predictions. Then vary uncertain parameters, such as runtime error and checkpoint bandwidth, to see whether the policy ranking survives plausible model changes. A narrow tuned point is weak evidence of robustness.
Compare the complete service policy
Keep admission, fairness weights, hardware capacity, and workload constraints aligned between policies unless one is an intentional experimental variable. Report tail and per-tenant wait, large-gang progress, useful throughput, preemption cost, infeasible jobs, and allocation efficiency alongside average JCT. Include multiple seeds where the policy is randomized and preserve configurations for reproduction. A perfect offline oracle with future runtimes is a useful bound only if clearly labeled; it is not a deployable online baseline with equal information.
The queue lab is a simple falsifiable prediction exercise, not a scheduler simulator. Reset, set arrival rate to 4 and service rate to 3, predict the backlog at one second, then Step twice. Compare a fresh Reset with both arrival rate at 2 and service rate at 3 before two Steps. The initial four jobs and fixed rates fully specify these fluid values. Explain which trace features it omits—job shapes, tenants, topology, failures, and overhead—before transferring any intuition about backlog to a real cluster.
Work it through
Audit a runtime model before comparing policies
For three held-out jobs, measured execution times are 10, 20, and 40 minutes, while a simulator predicts 12, 18, and 44. Assume matching workload boundaries and no censoring. Calculate signed relative errors and their mean.
The errors are (12 − 10)/10 = 0.20, (18 − 20)/20 = −0.10, and (44 − 40)/40 = 0.10: plus 20%, minus 10%, and plus 10%.
Their signed mean is (0.20 − 0.10 + 0.10)/3 = about 0.0667, or 6.67%. The mean absolute relative error is (0.20 + 0.10 + 0.10)/3, about 13.33%.
The smaller signed mean hides cancellation. Inspect errors by job shape and scheduling conditions, then test whether candidate-policy rankings change under plausible runtime uncertainty.
A low signed average error does not establish an accurate simulator. Calibration needs distributions, bias analysis, and relevant held-out conditions.
The living notebook
Explore the model
Interactive lab · queue
A specified model makes testable predictions
Reset, set arrival rate λ = 4 and service rate μ = 3, predict backlog at one second, then Step twice. Compare a fresh Reset with both λ = 2 and μ = 3, predicting before two Steps. This fixed-rate fluid model is not cluster trace replay or a scheduling benchmark.
- Fluid backlog
- 4
- Net rate · λ − μ
- −1 /s
- M/M/1 mean residence
- 1 s
Fluid backlog starts at 4 and follows max(0, 4 + (λ − μ)t). The separate M/M/1 residence-time formula assumes Poisson arrivals, exponential service and λ < μ. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forA prediction is meaningful within stated inputs and limits; real scheduler conclusions need a calibrated workload and cost model.
Pause & reason
Check your understanding
Your turn
Try it yourself
A measured job takes 30 minutes and is predicted at 24. Compute signed relative error. Then explain why a trace containing only completed jobs may overstate the fairness of a new policy.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Use measured time in the denominator, and consider whose work is absent.
Compare with the solution
Relative error is (24 − 30)/30 = −0.20, or a 20% underprediction. A completed-only trace can omit rejected, cancelled, or indefinitely waiting jobs, including large gangs and disadvantaged tenants. Replaying that selected population cannot establish fairness for the omitted demand. Record outcomes and censoring explicitly, and evaluate the complete intended workload population.
Keep the idea
Take it with you
- Replay conclusions depend on arrival, dependency, duration, and overhead assumptions.
- Calibrate counterfactual performance with held-out measurements and sensitivity analysis.
- Report fairness, failures, and unfinished work alongside average completion time.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.