22/34
Part 4 of 5 · Big jobs and preemptionLearn and do

Checkpoint where the pauses cost as much as the redone work

Checkpoint every T minutes, and each checkpoint pauses training for C minutes. A failure lands at a random time, so on average T/2 of work is redone after the restart.

Checkpoint too often, and you pay for the pauses. Too rarely, and every failure throws away hours.

Let MM be the mean time between failures, counting preemptions, and CC the time one checkpoint pauses training. Young's 1974 approximation gives the interval TT that loses the least time:

T≈2MCT \approx \sqrt{2 M C}

In words: the interval is the square root of 2 times the mean time between failures times the checkpoint pause. A 2024 paper revisiting it explains that the derivation minimized lost time, assuming failures come at random times with an exponential distribution.

Assume a job fails or is preempted every 8 hours on average, and pauses 30 seconds per checkpoint. In minutes, T=2×480×0.5=480≈22T = \sqrt{2 \times 480 \times 0.5} = \sqrt{480} \approx 22 minutes.

At that interval, the two costs match. The pauses cost about 0.5 / 22 = 2.3% of the time. The work redone after an average failure, half an interval, costs about 22 / 960 = 2.3% more.

In the editor, write young(mtbf, cost) from the formula, and overhead(interval, mtbf, cost). Check both on the example: 480 minutes between failures and a half-minute pause give about 22 minutes and about 4.6%.