🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#141
From: Miroslav Lachman
Date: Mon, 02 Nov 2026 11:56
51 lines
5766 bytes
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


Best regards
Miroslav Lachman



--
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: <058c85fc-05ab-4178-a7c1-c5dd0a391eb0@quip.cz>
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: <6ae8733d.196.16f0653@critter.freebsd.dk>

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: Miroslav Lachman <000.fbsd@quip.cz>
Newsgroups: muc.lists.freebsd.current
Subject: Re: Should we add jitter to cron(8) ?
Date: Mon, 2 Nov 2026 12:56:12 +0100
Organization: Newsgate at muc.de e.V.
Sender: owner-freebsd-current@FreeBSD.org
Approved: news-admin@muc.de
Distribution: world
Message-ID: <058c85fc-05ab-4178-a7c1-c5dd0a391eb0@quip.cz>
References: <6ae8733d.196.16f0653@critter.freebsd.dk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
	logging-data="79447"; mail-complaints-to="news-admin@muc.de"
User-Agent: Mozilla Thunderbird
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1793620608; h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:mime-version:mime-version:
	 content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references:list-id:list-help:
	 list-owner:list-unsubscribe:list-subscribe:list-post;
	bh=x0AWnI3H37ZXIGzx1cX+Jj0+xtgfxaCRsum23NtjpOs=;
	b=tRb/m3pYx+oE9m9BePixanX2YlYRiaXTvFyNPnaX0TRd3YEwNHAPaIlE4lTEBHzo2kuIhX
	EgPdY7xsNHR+QJZgz7vhhl1Gdo07OghJKBjbKk3/YLi8n/nc5apshw85aKTlpg5/HnCtUx
	q698GtU16E+DT7/JZep330VzyJUdt30yHwPsvhflCrHG6kPBvcKikrTS7P5UnHQCvT1OzA
	wl31H8gjC/pAMlrT1/iumxnkDcxGhlw9qejyogYU4dNgNc4NaLxvlrh9bmQ3/s++hnYUmY
	pu95+hi2GcZ2Izc0HJ5VSqJTerSUdqNjKZAYGmFx07rTZzncuY9sC0srYTc8Ng==
X-Original-To: current@mlmmj.nyi.freebsd.org
Authentication-Results: mx1.freebsd.org;
	dkim=pass header.d=quip.cz header.s=private header.b=thQuFF9K;
	dkim=pass header.d=quip.cz header.s=private header.b="Btrle/Dr";
	spf=none (mx1.freebsd.org: domain of "SRS0=YHqh=IX=quip.cz=000.fbsd@elsa.codelab.cz" has no SPF policy when checking 94.124.105.4) smtp.mailfrom="SRS0=YHqh=IX=quip.cz=000.fbsd@elsa.codelab.cz";
	dmarc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quip.cz; s=private;
	t=1793620573; bh=x0AWnI3H37ZXIGzx1cX+Jj0+xtgfxaCRsum23NtjpOs=;
	h=Date:Subject:To:References:From:In-Reply-To;
	b=thQuFF9KA1AT+ia3BLnPkZ6MQS2XKdp0Xqgz3kArMwqnKb+UNOIaxW8Ui9PA176JD
	 hWbJxOYXIdas3o0afCPx9bH3fT27skL/NQTT6hjUJQTljgRv55cmKG0E1NVRKIcH38
	 M5sa4yOJH/k5REI6zdwqWbpwtNb4R0One7uPXtqk=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quip.cz; s=private;
	t=1793620572; bh=x0AWnI3H37ZXIGzx1cX+Jj0+xtgfxaCRsum23NtjpOs=;
	h=Date:Subject:To:References:From:In-Reply-To;
	b=Btrle/DrvVVr3QGsWCK/Xf9Mb7iXrLduLTdks95a4GpIzhdePv4A86Rr1V+r6Qp6/
	 V2Ain6dLK4BYDgIURqISag+vQaBixAmKaIKTjF+TymsiuI3fFsfI+U8p2sWxu8rJ4x
	 e5EZruayWSCJG4D83RdXUNtT4d5D4IeE7TrSKluA=
Precedence: list
Content-Language: cs-Cestina
In-Reply-To: <6ae8733d.196.16f0653@critter.freebsd.dk>
X-Rspamd-Queue-Id: 4jJ9CT6Y29z4pTk
X-Spamd-Bar: +
X-Spamd-Result: default: False [1.00 / 15.00];
	SUBJECT_ENDS_QUESTION(1.00)[];
	FORGED_SENDER(0.30)[000.fbsd@quip.cz,SRS0=YHqh=IX=quip.cz=000.fbsd@elsa.codelab.cz];
	R_DKIM_ALLOW(-0.20)[quip.cz:s=private];
	MIME_GOOD(-0.10)[text/plain];
	RCPT_COUNT_TWO(0.00)[2];
	R_SPF_NA(0.00)[no SPF record];
	RCVD_VIA_SMTP_AUTH(0.00)[];
	ASN(0.00)[asn:42000, ipnet:94.124.104.0/21, country:CZ];
	ARC_NA(0.00)[];
	TO_DN_SOME(0.00)[];
	MIME_TRACE(0.00)[0:+];
	MID_RHS_MATCH_FROM(0.00)[];
	MLMMJ_DEST(0.00)[current@freebsd.org];
	RCVD_TLS_LAST(0.00)[];
	FROM_HAS_DN(0.00)[];
	DMARC_NA(0.00)[quip.cz];
	FROM_NEQ_ENVFROM(0.00)[000.fbsd@quip.cz,SRS0=YHqh=IX=quip.cz=000.fbsd@elsa.codelab.cz];
	TO_MATCH_ENVRCPT_SOME(0.00)[];
	RCVD_COUNT_TWO(0.00)[2];
	DKIM_TRACE(0.00)[quip.cz:+]
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes