November 12, 2026
1 pull request merged across 1 repo
bahdotsh/wrkflw
Two scheduling changes for small Docker VMs, found by rerunning the pallets/click benchmark on main after #167 and #168.
Results
pallets/click at 1077444, compared with GitHub run 42384079679 (11 jobs, 65 s on GitHub), Docker Desktop VM with 7.7 GB:
main (a9943e3) | this PR | |
|---|---|---|
| First compare in a fresh clone | 877 s | 91 s |
| Warm compare | 49, 48, 46 s | 33, 37, 42 s |
| Jobs agreeing with GitHub | 11/11 | 11/11 |
These numbers were measured before fe977d6, which put a margin of an eighth on the highest-peak floor. They have not been re-run since. Click's legs peak at 276–552 MiB, where the recent-runs estimate is above the floor anyway, so I don't expect a change, but that isn't measured.
A leg never measured takes its siblings' measurement
Measurements are keyed by the clone's path, so in a fresh clone every matrix leg was unmeasured and ran alone, one after another.
- Each leg's peak is now also kept under an id for the matrix as a whole. A leg with no measurement of its own is given what the matrix was measured at.
- Only the first leg of a new matrix runs alone. Legs waiting unmeasured look at the store again whenever a job of the run keeps its measurement, then share the VM. Each look puts the leg at the back of the pool's queue; that is deliberate and commented.
- A leg keeps its place in the pool until its measurement is written, so the next leg reads it before taking the place. Without this the second leg would take the whole VM unmeasured as well. A leg cancelled part way gives its place up at once.
- A kill for lack of memory while a leg runs, in that leg or in a job beside it, marks the matrix *uneven*: its peak sizes no leg again, and legs not measured yet run alone, each measuring itself. Forgetting the matrix instead would let a light first leg size the heavy legs again on every run. A leg that couldn't be measured leaves the matrix's measurement alone.
When the legs aren't alike
Sizing a leg by its siblings assumes the legs are alike. For a matrix like task: [lint, build, test], the light leg can size heavy legs that then start together and get killed. The uneven mark repairs the next run, but that first run fails where main would have passed. The run now says so:
- an info line when a leg starts on its siblings' measurement, naming the leg and the MiB it set aside;
- a warning when such a leg was running as something got killed for memory, saying that from the next run the matrix's unmeasured legs run alone.
The VM memory warning no longer says unmeasured jobs run "at most N at a time", since legs sized by their matrix don't.
The highest peak is a floor, with a smaller margin
#168 made a job's highest peak a floor under its estimate, and the 256 MiB headroom was added after the floor. For click that reserved 7,092 MiB for nine legs against the 6,813 MiB the VM shares, so they ran as six and then three.
The estimate is now max(recent peak × 1.5 + 256 MiB, highest peak × 1.125). The floor's eighth is only for a spike between samples taken a second apart. The full headroom on top of a cold peak was what kept light jobs from running together.
Notes
- After the store starts empty, the measuring run's higher peaks stay in the estimate for three runs, so two legs can wait for a second wave until then (38–46 s).
INDEX.mdis regenerated.
Testing
cargo test --workspace --all-features: all pass (executor lib: 931)cargo clippy --workspace --all-features -- -D warningsandcargo fmt --check: clean- The store side has unit tests, including whether a reservation came from the leg or its matrix, and the uneven mark.
- The wait-and-wake path in
job_slotis tested against a real pool and store: one leg and several legs waiting on a first leg that passes, fails or is cancelled, and a pool with room for two unmeasured legs. The tests wait on a signal instead of a fixed delay. Moving the place's release before the measurement is written fails the two wake tests within their 30 s bound instead of hanging. The scheduler and store tests passed 20 runs in a row. - The click benchmark above, run on the release build before
fe977d6(see Results).