Bug 683504

Summary: [RFE] Add ability to splay global cron jobs
Product: Red Hat Enterprise Linux 5 Reporter: J.H.M. Dassen (Ray) <rdassen>
Component: crontabsAssignee: Marcela Mašláňová <mmaslano>
Status: CLOSED DUPLICATE QA Contact: qe-baseos-daemons
Severity: low Docs Contact:
Priority: low    
Version: 5.6CC: rbinkhor
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-02 13:16:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 554476    

Description J.H.M. Dassen (Ray) 2011-03-09 15:39:32 UTC
2. What is the nature and description of the request?

Customer has a large number of systems and they all kick off their nightly
cronjobs (such as mlocate, logrotate, etc) at the same time, resulting in very
high I/O wait.  They would like cron to offer the ability to randomize jobs
across a given time period.  

3. Why does the customer need this? (List the business requirements here)

To prevent hundreds of systems from kicking off the same job at the same time,
putting excessive load on storage, network, etc

4. How would the customer like to achieve this? (List the functional
requirements here)

They gave us a set of example patches, but they do not completely solve the
problem.  These patches would configure SPLAY for *every* job on the system,
but they want the ability to selectively enable it for certain jobs.  The
patches to demonstrate the feature:

--- /usr/bin/run-parts.orig   2006-07-14 23:05:38.000000000 -0500
+++ /usr/bin/run-parts       2010-10-28 13:18:38.000000000 -0500
@@ -1,6 +1,7 @@
 #!/bin/bash

 # run-parts - concept taken from Debian
+. /etc/sysconfig/crond

 # keep going when something fails
 set +e
@@ -15,6 +16,11 @@
        exit 1
 fi

+if [ -n $SPLAY ]
+then
+       sleep `expr $RANDOM % $SPLAY`
+fi
+
 # Ignore *~ and *, scripts
 for i in $1/*[^~,] ; do
        [ -d $i ] && continue

--- /etc/sysconfig/crond.orig       2009-12-11 03:31:19.000000000 -0600
+++ /etc/sysconfig/crond   2010-10-28 13:20:47.000000000 -0500
@@ -7,3 +7,4 @@
 #                           from this tr(1) set : [@!:%-_.,:alnum:]
 #                           otherwise mailing is not attempted.
 CRONDARGS=
+SPLAY=600

So, if you configured a job for "0 4 * * *" and set SPLAY=7200, jobs would be
randomly scattered across the 2 hour period from 4am-6am.  

Ideally, their example would be extended to allow you to set this per cronjob.  

5. For each functional requirement listed in question 4, specify how Red Hat
and the customer can test to confirm the requirement is successfully
implemented.

Set SPLAY for the relevant cronjob on multiple servers.  Observe that they were
randomized across the SPLAY period.

6. Is there already an existing RFE upstream or in Red Hat bugzilla?

No

7. How quickly does this need resolved? (desired target release)

5.8

8. Does this request meet the RHEL Inclusion criteria (please review)

Yes

9. List the affected packages

vixie-cron