[systemd-devel] [EXT] Re: Understanding the effect of AccuracySec=
Lennart Poettering
lennart at poettering.net
Mon Aug 19 08:39:43 UTC 2024
On Mo, 19.08.24 10:37, Andrei Borzenkov (arvidjaar at gmail.com) wrote:
> On Mon, Aug 19, 2024 at 10:11 AM Barry <barry at barrys-emacs.org> wrote:
> >
> >
> >
> > On 19 Aug 2024, at 06:55, Windl, Ulrich <u.windl at ukr.de> wrote:
> >
> >
> > Despite of the fact that my version of systemd does not know that setting, can you explain what the effect of AccuracySec= really is?
> >
> >
> > The docs https://www.man7.org/linux/man-pages/man5/systemd.timer.5.html say this
> >
> > Note that this setting is primarily a power saving option
> > that allows coalescing CPU wake-ups. It should not be
> > confused with RandomizedDelaySec= (see below) which adds a
> > random value to the time the timer shall elapse next and
> > whose purpose is the opposite: to stretch elapsing of timer
> > events over a longer period to reduce workload spikes. For
> > further details and explanations and how both settings play
> > together, see below.
> >
> > So if you have 5 timers that expire about the same time this allows them to all run at the sane time thus saving power.
>
> It does explain why timers are run at the same time. It does not
> explain why "daily" + accuracy 6h runs at midnight, not close to 6am
AccuracySec= gives systemd/the OS some freedom to delay the timer,
that's all. It just declares: "it's OK if the timer elapses this much
later", and not more. Which point in time systemd then picks to
actually trigger the timer is up to systemd, and it in fact currently
applies some boundaries to the time window, since delaying wakeups
indefinitely doesn't help much anymore.
AccuracySec= hence doesn't mean "delay this timer this much", but just
"allow systemd to delay this timer this much if it wants". Not more.
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list