Interactive engineering lab

Scheduled job jitter: peaks, offsets and a shared dependency

Scheduled job jitter: peaks, offsets and a shared dependency. Place each instance start in a window and count requests per second at a shared dependency.

By Sandeep Belgavi · Published 2026-11-19

Synthetic fixtures computed locally. No model, scheduler, monitor or production service is contacted.

Experiment workspace

Decision trace

    The question this experiment answers

    Every shop server at Belgavi's Book Store runs the same hourly job: refresh its stock snapshot from one central inventory service, sending one request per second for a few seconds. This lab places each instance's start second inside a window after the scheduled time using one of four strategies, then counts requests per second at the shared dependency for every simulated hour. It shows the worst second, how long the dependency was over capacity, whether the peak repeats from hour to hour, and the even-spread lower bound that no placement can beat.

    Change one assumption at a time

    Start from no_jitter: 400 instances, a 300 second window, up to 500 ms of clock skew, 5 requests per run, a capacity of 50 requests per second, 6 hours and seed 19. Raise the clock skew to 5,000 ms and see that the peak does not move. Switch the strategy to random_each_run, then hash_offset, then slotted, and compare the worst second with the even-spread bound. Then shorten the window to 30 seconds, and separately raise the requests per run to 60, to see where spreading stops helping.

    Expected outcomes

    With seed 19: no_jitter sends 400 requests in one second every hour and is over capacity for 30 seconds in 6 hours; with 5 s of skew the peak stays 400 and the over-capacity time rises to 54 seconds. random_each_run peaks at 16 in its worst hour and 13 in its best, mean 14.8, never over capacity. hash_offset peaks at 12 in every hour. slotted peaks at 7, equal to the even-spread bound. hash_offset with a 30 second window peaks at 78 against a bound of 59 and spends 162 seconds over capacity. hash_offset with 60 requests per run peaks at 91 against a bound of 67 and spends 1,710 seconds over capacity.

    Reading the decision trace

    The trace lists the first hour for the first 24 instances: the offset chosen by the strategy, the clock skew drawn for that instance, the resulting start second, and the seconds in which it sends requests, followed by one summary line per hour. With hash_offset and slotted the offsets are the same in every hour, so the first hour describes them all; with random_each_run they are drawn again every hour, which is why the per-hour table shows a different peak each time. The result table has one row per hour with its busiest second.

    What this teaches

    Identical schedules synchronise a fleet, and realistic clock skew does not undo it. Random and hash offsets give similar peaks, but only stable offsets make the peak reproducible, testable before deployment and traceable to the instances that cause it. Slotting is optimal when instances know their index and the fleet size. Neither helps when the window is too short for the total work or when the work exceeds capacity: then the job must do less or the dependency must change.

    Limits of this model

    Synthetic fleet. Each run sends exactly one request per second and requests never fail, queue or retry, so the peak is an upper bound on demand, not a latency model. Clock skew is a fixed uniform draw per instance. The hash is FNV-1a of the instance name; systemd FixedRandomDelay, Jenkins H and EventBridge Scheduler flexible windows use their own inputs and algorithms.

    Views are my own and do not represent any employer, past or present.