[systemd-devel] Feature request: randomly delay scheduled jobs
Olav Vitters
olav at vitters.nl
Wed Feb 6 01:13:27 PST 2013
Feature request: allow to randomly delay a scheduled job
Why:
I have various cron jobs that run every 20min on various VMs + servers.
All servers are synched with NTP. What happens is that if they use some
shared resource (e.g. an LDAP server), the load spikes on that LDAP
server spikes every 20min. So every 20min the LDAP server is slowish and
afterwards it does nothing again. Not running the jobs at the same exact
time would spread the usage of that server, and likely result is that
the load never spikes anymore.
It would be nice if I could do the following in systemd:
Run this script every 20min, but randomly delay it by up to 5min.
Currently I introduce such delays either in the script itself, and
sometimes before calling the script. It would be much nicer to have
a syntax for this.
Note that the random delay could either be changed for each execution
or determined once per job/unit. I'm not sure which one is better.
Benefit if only determining the random delay once, is that you still get
the same 20min delay each time. On other hand, that is not really random
anymore.
Different possible random option:
a. Every 20min: 0:00 + 1min 24sec, 0:20 + 3min 21 sec, 0:40 + 0min 48sec
b. Every 20min: 0:00 + 1min 24sec, 0:20 + 1min 24 sec, 0:40 + 1min 24sec
a. = random every time
b. = delay is random, but then predictable delay
I'm fine with either btw.
--
Regards,
Olav
More information about the systemd-devel
mailing list