Moving Live Work Without a Gap

Lesson 2 of 4

Pay the Cold Start Before the Burst

Estimated time: 10 minutes

Do the slow start before the rush

A worker spends time before it can take its first job. It has to come up, load what it needs and reach a ready state, and that time is paid again for every worker that starts. If workers are started only after the jobs arrive, every job in the rush waits for that same slow step.

Hold a small set that is already ready

Keep a few workers ready ahead of time, so an ordinary job starts at once instead of waiting. The size of that ready set should sit just above the usual quiet demand: enough that a small rush never waits, and not so much that idle workers are a standing cost.

def keep_ready(ready, floor, start):
    while len(ready) < floor:
        ready.add(start())

Replace before the set runs low

Start replacements before the ready set falls to the floor. A set that is topped up only after the rush has landed arrives with the same shortfall it was meant to avoid.

Measure the slow start first

If the slow start is brief, the ready set can be small or empty. Only measure decides the size, not habit.