Skip to main content

changes

Function changes 

Source
pub fn changes(
    config: &Config,
    history: &History,
    context: Context<'_>,
) -> Vec<SizingChange>
Expand description

The changes to make now, in order, one per profile at most. Empty unless [sizing] auto is on.

A change that lowers memory or cpus waits [sizing] interval after the profile’s last change; one that only raises waits raise_interval. A lowering moves memory toward the advice, and cpus move toward what their runs reach, by at most [sizing] max_step percent; a raise of memory goes straight to the advice, which only a run that met the cap gives. memory stays within the profile’s min_memory and max_memory, cpus within the slice’s CPUs. A lowering that went too far is taken back at once (ProfileSizing::revert). Under caps admission a profile whose jobs waited for a slot, or whose slots were busy, since its last change gets one more slot when every profile’s caps still fit MemoryMax, and a lowered memory adds the slots the advice gives. Under measured a profile whose jobs waited for a slot while memory and CPU had room for them (Ran::slot_waited) since its last change gets as many more as waited at once, at most max_step percent of its slots, at least 1, while every slot keeps SLOT_DISK of Docker’s disk (measured_slots), or a refusal says why it cannot; and one whose slots stayed IDLE_SLOTS above what ran at once for IDLE_FOR since they were last set loses one. Never past max_slots, never under what runs. Each change is sized as if the ones before it were written: they take budget the later ones cannot.

cpus go up max_step percent, at least 1, when one job’s runs at them since the profile’s last change and since the daemon got them (Context::cpus_set), 3 at least, averaged BOUND percent of them at the median, or under measured admission were held back by them (throttled, or without that figure met in a burst) while the raise before helped them (unhelped); up to the slice’s CPUs, and with a CPU budget only as far as it holds: every profile’s slots × cpus under caps; under measured, what that admission reserves at caps, every profile’s warm runners and one more runner at the largest cap (Budget::at_caps). Under caps admission they come down, interval after the last change and by max_step percent at most, toward HEADROOM times the heaviest job’s p95 average or the highest peak of those runs, whichever is larger, rounded up to whole CPUs, at least 1, once min_jobs such runs say so, every job among them has a measured average, and the cap held none of them back. Under measured they never come down: they bound no slot there. Only successful runs with a measured average count; see next_look for the raises it cannot make.