[Sysadmins] Timing automated batch jobs ...

David Malone dwmalone at maths.tcd.ie
Thu Sep 17 20:46:32 IST 2009


On Tue, Sep 15, 2009 at 12:27:25PM +0100, Colm MacC?rthaigh wrote:
> For some reason, I keep coming across the pattern of cron jobs that
> have "sleep $RANDOM % 3600" in them - in a vain attempt to spread
> load. It's a really harmful dangerous pattern, it annoyed me so much,
> that I've written about it ;

There is a pattern like this that is useful, which is to use a
Poisson arrival process for a cron job. This is sometimes used when
people do measurements, because it has some nice statistical
properties (look for "PASTA" - Poisson Arrivals see Time Averages).
This would look something like:

	sleep -3600*log($RANDOM/MAX_RANDOM)

but would only be used in somewhat specialist circumstances. I think
that RIPE TT boxes use this for doing their measurements.

	David.



More information about the Sysadmins mailing list