opyebCronPulse

Batch collisions: finding and spreading out jobs that share a minute

Operations · 6 min read

One-line answer: Why schedules that look independent pile onto the same minute, and how a heatmap finds the collisions worth fixing.

Batch jobs are usually written one at a time, and each one knows nothing about the others. When they land on the hour, on 02:00, or on every fifteenth minute, database connections, disk I/O and API quotas are consumed at the same instant. The result is batches that are mysteriously slow rather than broken.

Finding collisions

Expand every registered schedule into occurrence times in one time zone, then count how many jobs run in each minute. Out of 1,440 minutes a day, the ones with two or more jobs are collisions. A seven-day by twenty-four-hour heatmap makes the shape obvious; CronPulse's detector also lists the collision windows by name.

Common patterns

PatternCauseFix
Top of the hourEvery job uses 0 * * * *Scatter minutes: 5, 17, 29
02:00 pile-upEveryone picks “the quiet hour”Spread across 00:00–05:00, keep dependencies in order
Fifteen-minute gridSeveral */15 jobsOffset some to 7, 23 or 41
Month startSettlement, billing, reportsSpread across the 1st, 2nd and 3rd
0 * * * *           top of every hour - collision risk
7,22,37,52 * * * *  offset from the 15-minute grid
0 2 * * *           02:00 backup
17 3 * * *          moved to 03:17

What not to break

Spreading times can break assumptions such as “this job always runs first”. Express dependencies explicitly and trigger downstream work from the upstream completion event rather than from the clock. Give external APIs a minimum gap between calls, and put low-quota services behind their own queue.

Observe the effect

Record start, end and duration for every job on one clock (UTC recommended). If jobs that start in a crowded hour take longer on average than the same jobs in a quiet hour, collisions are the likely cause.

A small habit

Check the collision heatmap whenever a batch is added. Register the live schedules once in CronPulse and compare the collision count before and after each deployment.

Paste an expression and see its next run times right away.

Open CronPulse

Frequently asked questions

Do I have to reschedule every job to remove collisions?

No. Moving a few of the heaviest jobs usually fixes most of it. Start with the busiest hour and the jobs that share a database or an external API.

Are overlapping jobs always a problem?

Not always. Several light jobs can share a minute safely. Prioritise overlaps between jobs that compete for the same database, disk or rate-limited API.

Sources

Related reading