4 ms·
I guess it would be nice to have a "fuzzy" cron job setting, so you could specify "run it at a random time during the day/hour/minute"
by qw 7y ago
I guess it would be nice to have a "fuzzy" cron job setting, so you could specify "run it at a random time during the day/hour/minute"
- jacques_chester 7y agoElsewhere this is referred to as "jitter". Most systems with regular schedules are built without it and eventually, many will grow into facemelting hordes.
- jedberg 7y agoGeneral best practice is to add fuzzing to your scheduled task. So for example wrap it in a shell script that starts with `RANDSLEEP=$((RANDOM + 100)); sleep ${RANDSLEEP:1:2}`. Then it will sleep between 0 and 99 seconds. Or do 1:1 if you run the task every minute so fuzz the start by 0 to 9 seconds.
- certifiable 7y agoSomeone pointed out in comments on the blog post (https://about.gitlab.com/2019/08/27/tyranny-of-the-clock/#comment-4593761983 https://about.gitlab.com/2019/08/27/tyranny-of-the-clock/#co...) that systemd actually has some good functionality for that.
- mcintyre1994 7y agoThis seems to be the behaviour of AWS 'rate' Cloudwatch events. Eg. rate(1 hour) or rate(10 minutes) don't necessarily run on the hour. Not sure if they're relative to when you set them up or random though.