🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: muc.lists.freebsd.current
Article #145

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

#145
From: Alexander Leidinger
Date: Mon, 02 Nov 2026 13:28
105 lines
7945 bytes
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)

--=_af53b1f6d4b03681ad802acfdeee5427
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII;
 format=flowed

Am 2026-11-02 12:56, schrieb Miroslav Lachman:
> On 02/11/2026 12:25, Poul-Henning Kamp wrote:
>> Embedded systems using cron(8) are starting to cause macroscopic
>> effects at the top of the minute:
>> 
>> 	https://www.fz-juelich.de/en/news/archive/press-release/2026/mystery-of-60-second-fluctuations-in-power-grids-solved
>> 
>> That indicates that we should add jitter to cron(8).
>> 
>> I can see three ways to do it:
>> 
>> A) By default cron(8) waits [0...N] seconds before executing commands.
>>     This can be disabled with a command line option.
>>     For a number of reasons which we can hash later, I suggest N=30
>> 
>> B) Same as A), but the command line option enables jitter.
>> 
>> C) Same as A), but with additional crontab(5) syntax to say "dont
>>     jitter this particular entry".
>> 
>> I would argue that A is the proper choice.
>> 
>> Comments ?
> We already have that. Or do you mean something else?
> 
> -j jitter
>  Enable time jitter.  Prior to executing commands, cron will sleep
>  a random number of seconds in the range from 0 to jitter.  This
>  will not affect superuser jobs (see -J).  A value for jitter must
>  be between 0 and 60 inclusive.  Default is 0, which effectively
>  disables time jitter.
> 
>  This option can help to smooth down system load spikes during
>  moments when a lot of jobs are likely to start at once, e.g., at
>  the beginning of the first minute of each hour.
> 
> -J rootjitter
>  Enable time jitter for superuser jobs.  The same as -j except
>  that it will affect jobs run by the superuser only.
> 
> 
> cron_flags="-j 20 -J 20" in rc.conf should do the trick

Adding to that:
  - POLA (I can easily imagine how this breaks stuff, I paid attention on 
my system a time drift or load spike induced delay doesn't, but in 
general I would bet this can cause problems).
  - It always comes down to the choice of a human. I always try to 
schedule at random times and not at the usual suspects like "00" or 
multiples of 5 or 10.
  - Do we expect that those jobs use cron? Or asked differently: why do 
you think it will matter in the big picture?

By using A you enforce policy. In the past we didn't want to do that.

We already have B. There's also option D, having two new options: one to 
ensure jitter, and one to disable jitter. With B+D it's up to the admin 
to set the policy.

Bye,
Alexander.

-- 
http://www.Leidinger.net Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF
http://www.FreeBSD.org    netchild@FreeBSD.org  : PGP 0x8F31830F9F2772BF

--=_af53b1f6d4b03681ad802acfdeee5427
Content-Type: application/pgp-signature;
 name=signature.asc
Content-Disposition: attachment;
 filename=signature.asc;
 size=870
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQJPBAEBCAA5FiEER9UlYXp1PSd08nWXEg2wmwP42IYFAmrokBcbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwzAAoJEBINsJsD+NiGxjoP/RzMG+xy+X7f+GmiCfC/
POkyT2Zjgs9ptvSfQuTbTQFU+UlcCvwMw68zZ1/VrQExHQjsjuhnyaVmynh4ewuZ
ZoRlajx7JK9nN5GTGRyGuOl2dpyy1vyX9/+2At60dqvAnAfBcELkz4f5vzxESMM6
KewwU/6c0wybpxfyr+BgIVwSIAHDGElOvW48Zpp0uYSI7bVagJJ3y48HuyypILZu
1Y7G5smEuSYFnhmsZrrgep+QQuF4R/YholGjKHRkOsV72s9i4C7K0TdoC3MWk2yN
HsXHZ/klRemgPyTndPjysU4ta7vawHDXKO01s1+lYHREfS0p5pAefOfNTnFNvuCp
cGqBPX8B8p+MByUxfDifjvAnwEYKbKqf4atTW25vsS7IMM0n7Lx6AgaZ76tdi2mX
2Cup6PgmEQtcyZNAIXVL/64jlbMxYFunwSANsZIcrampM1uq5OObiYgUn5S5sHJh
oFgd4q0Kq+LQQe97Cwtu54JyLtcQJUZkx2hUljEwWiQ+cXU6isoNiZ8Nw0dzoykM
3LAvC/U2KASCkLWld2EE+LkBk4JIkRPbk1Y9cT7xPGd8j55Up60gbuQDSzjyrHFg
I/cpcPUi873fnos7ICp77gZgHleAt0W0SiyLEsNWMwJof+xrQF9RlZbfvmLwBLoN
MHkzEloztoA60lvtqyUfY1ST
=z1XJ
-----END PGP SIGNATURE-----

--=_af53b1f6d4b03681ad802acfdeee5427--


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID: <9d5310b8b555f42ca6d3b5bb94a76084@Leidinger.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail
References: <> <058c85fc-05ab-4178-a7c1-c5dd0a391eb0@quip.cz>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: Alexander Leidinger <Alexander@Leidinger.net>
Newsgroups: muc.lists.freebsd.current
Subject: Re: Should we add jitter to cron(8) ?
Date: Mon, 02 Nov 2026 14:28:44 +0100
Organization: No organization, this is a private message.
Sender: owner-freebsd-current@FreeBSD.org
Approved: news-admin@muc.de
Distribution: world
Message-ID: <9d5310b8b555f42ca6d3b5bb94a76084@Leidinger.net>
References: <> <058c85fc-05ab-4178-a7c1-c5dd0a391eb0@quip.cz>
MIME-Version: 1.0
Content-Type: multipart/signed;
 protocol="application/pgp-signature";
 boundary="=_af53b1f6d4b03681ad802acfdeee5427";
 micalg=pgp-sha256
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
	logging-data="47946"; mail-complaints-to="news-admin@muc.de"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1793626203; h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:cc:mime-version:mime-version:
	 content-type:content-type:in-reply-to:in-reply-to:
	 references:references:list-id:list-help:list-owner:list-unsubscribe:
	 list-subscribe:list-post; bh=T42fbGbiHcbrTize70O8/cHiSpeHgWBN41l6tQPrC+s=;
	b=B/r2+fPghBKGHClI6KN0x/MjcAPm0z+HwS1tncTxnvCOfMeOuId374Q2Quul9n4w+mrX0Z
	aTJyWJzGbNqatGis3WATVdfeEgcHllQJm5u6Q3U7V1Usx5+F7F08y4OW2yVdEeinHktc2C
	CDn/zJdGd0/Rh1Xt4PBLQQw9/I/SCCOPooiKxccgJkgROC251u8tu/ZU11ZFnf7u/pLdGq
	UE6z0OaHL5JUX7ZJ3P7IkjgMnPbLCiip9iquz3KtimRDcRHmBo3S+4Yyx+QKoUKJ4QUry7
	0+Lv7cLbCYp5Ty/46WPtJI5CVD0Qhmo7lv+Wjhg23x8xaVLcAMm7wUjWSJxJAw==
X-Original-To: current@mlmmj.nyi.freebsd.org
Authentication-Results: mx1.freebsd.org;
	dkim=pass header.d=leidinger.net header.s=outgoing-alex header.b="HEb/Ca2N";
	spf=pass (mx1.freebsd.org: domain of Alexander@Leidinger.net designates 2a00:1828:2000:313::1:5 as permitted sender) smtp.mailfrom=Alexander@Leidinger.net;
	dmarc=pass (policy=quarantine) header.from=leidinger.net
Precedence: list
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leidinger.net;
	s=outgoing-alex; t=1793626167;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 in-reply-to:in-reply-to:references:references;
	bh=T42fbGbiHcbrTize70O8/cHiSpeHgWBN41l6tQPrC+s=;
	b=HEb/Ca2N0u6YYE2u7DTsbXto6In2cRdZS6lZ+x/oA5nEFNPV5iHd0314Mmp4bGjJ3q7Xvl
	vm6EWzUCt9LKlRTUcp5pWJKWgwVG0qk8oXJtyWIwCtpi7r8o3oJJ3FttScaOo5sJV7q1a5
	SCHWlNzYIryYdHKIKbZcFC8LpFRmdauJnGt1UclfbfER3rbZvyPa6ucJ5qpkkkoOH6lwOm
	559W1LYJxBNyxyOdQRNLHpH4wC+63HSq2NxcHjZKtvJ8a4F/elQZWkzm/U+sIU0W8d7j3Y
	dHQKCmlb4jtVN5WQiZNjfONfIlMDlWaKDuohYR7j74XttK6zTlNYX0IgmHM5Ew==
In-Reply-To: <058c85fc-05ab-4178-a7c1-c5dd0a391eb0@quip.cz>
X-Rspamd-Queue-Id: 4jJCH03LLRz3RFL
X-Spamd-Bar: --
X-Spamd-Result: default: False [-2.10 / 15.00];
	SIGNED_PGP(-2.00)[];
	SUBJECT_ENDS_QUESTION(1.00)[];
	DMARC_POLICY_ALLOW(-0.50)[leidinger.net,quarantine];
	R_DKIM_ALLOW(-0.20)[leidinger.net:s=outgoing-alex];
	MIME_GOOD(-0.20)[multipart/signed,text/plain];
	R_SPF_ALLOW(-0.20)[+mx:c];
	ARC_NA(0.00)[];
	HAS_ORG_HEADER(0.00)[];
	MIME_TRACE(0.00)[0:+,1:+,2:~];
	ASN(0.00)[asn:34240, ipnet:2a00:1828::/32, country:DE];
	TO_DN_SOME(0.00)[];
	MISSING_XM_UA(0.00)[];
	HAS_ATTACHMENT(0.00)[];
	MID_RHS_MATCH_FROM(0.00)[];
	RCPT_COUNT_THREE(0.00)[3];
	FROM_HAS_DN(0.00)[];
	RCVD_COUNT_ZERO(0.00)[0];
	FROM_EQ_ENVFROM(0.00)[];
	MLMMJ_DEST(0.00)[current@freebsd.org];
	TO_MATCH_ENVRCPT_SOME(0.00)[];
	DKIM_TRACE(0.00)[leidinger.net:+]
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes