Re: Should we add jitter to cron(8) ?

From: Tom Hukins <tom_at_freebsd.org>
Date: Sat, 07 Nov 2026 10:15:25 UTC
On Fri, Nov 06, 2026 at 09:10:19PM +0100, Miroslav Lachman wrote:
> Given the POLA concerns raised, I have an alternative idea:
> fixed per-host offset instead of per-run random jitter.

I run cron with -J within jails to reduce the thundering herd effect of
the periodic jobs in /etc/crontab starting at exactly the same time.
Setting -J by default would avoid me needing to do this and would help
other FreeBSD administrators who run lots of jails but haven't
configured this.

Setting a fixed per-host offset would cause all periodic jobs within
jails to run at the same time.

>  - cron derives a constant offset in the range 0-59 seconds from a hash of
> kern.hostuuid (plus hostname, to cope with cloned VMs and jails sharing the
> same hostuuid). Optionally, the user can override it with a fixed value via
> cron_flags in rc.conf

Here's what I see within a jail on 14-STABLE:
% sysctl kern.hostuuid
kern.hostuuid: 00000000-0000-0000-0000-000000000000

Tom