Bug 82084

Summary: RFE: Allow for random startup delay (or even spread) in timer units
Product: systemd Reporter: freedesk.apriori
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: enhancement    
Priority: medium CC: alexandre, gerd, mh+freedesktop-bugzilla, pahan, radek, zdzichu
Version: unspecified   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description freedesk.apriori 2014-08-03 09:23:55 UTC
It would be useful if timer units could be delayed randomly within, or spread out evenly across, a given interval starting at the time specified in the OnCalendar/etc. setting. This would help to spread out I/O intensive jobs and avoid disk thrashing.

In some discussions, the AccuracySec setting has been suggested as the equivalent to cron’s random delay feature, but as the man page says, the AccuracySec delay is synchronized across all timers, so that jobs will still launch in parallel.
Comment 1 Alexandre Detiste 2014-11-13 15:45:31 UTC
systemd could compute a random factor using the host + job ID as a seed 
for AccuracySec or for something new ("AccuracySec2" ? I have no idea)
Comment 2 Pierre Ozoux 2015-04-30 11:25:17 UTC
Any news on that?

Does anybody has workaround?

Thanks
Comment 3 Marc Haber 2015-05-01 11:30:54 UTC
This would indeed be useful as it would eliminate the need for the usual sleep $RANDOM semantics that is used in load-generating cron jobs.

If a lot of VMs start running their cron jobs in parallel, this generates a painful load spike on the VM host that could be mitigated by adding some randomness. Please consider implementing this.

Greetings
Marc
Comment 4 Lennart Poettering 2016-02-01 18:02:26 UTC
This has been implemented a while back with RandomDelaySec=
Comment 5 James Robinson 2016-02-02 23:48:19 UTC
(In reply to Lennart Poettering from comment #4)
> This has been implemented a while back with RandomDelaySec=

I may have misunderstood something here but...

This was originally submitted as RandomDelaySec= (2015-11-19):
https://github.com/systemd/systemd/pull/1944

however, it was then renamed to RandomizedDelaySec= (2015-11-27):
https://github.com/systemd/systemd/pull/2040

The online man page for systemd.timer currently uses RandomSec= (2016-02-02):
http://www.freedesktop.org/software/systemd/man/systemd.timer.html

however, the 'random' feature narrowly missed the 228 release (2015-11-18) so it's not in the current versions man page.

Any help in clearing this up would be greatly appreciated, it would be great to get ahead of 229!
Comment 6 Lennart Poettering 2016-02-03 12:22:55 UTC
It got renamed in git:

6f5d79986a9c98b9cacc83f865fed957e4e6e4e6

The final name is RandomizedDelaySec=.

Sorry for the confusion.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.