[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Niced cron jobs



Craig Sanders <cas@taz.net.au> writes:

> it doesn't matter. if there is no CPU available for nice -10 tasks

[Ahem -- you mean nice 10 because nice -10 is decided "mean"]

> because the machine is too busy then there is no CPU available for nice
> -9 or -8 or -1 either. because they hardly ever get any cpu cycles the
> cron jobs stay around for ages, using memory, file handles, and other
> resources.

This doesn't jibe with what I know about the Linux (and SunOS 5)
process schedulers.  Even if a nice 0 (unnice) process is chewing up
all the processor, nice'd processes *will* get CPU time (i.e., taking
away CPU time from unnice processes).  The only level of niceness
which will *never* run without idle CPU is nice 20 (moby nice).

> at first glance, using nice seems like a good way of smoothing out the
> load caused by cron but it is nowhere near that simple in practice.
> on busy machines it creates a situation which gets progressively
> worse until the machine runs out of resources and dies....while on
> lightly loaded machines it makes hardly any difference at all because
> the thrashing is disk activity, not CPU load (certainly not enough
> difference to justify endangering server boxes).

I dunno -- my experience is different.  I have definately seen heavily
loaded machine stack up cron jobs this way, but generally the
starvation is IO-starvation rather than CPU starvation.  For instance,
in cases where the machine is swapping it's little brains out.

> theoretical benefits may be nice, but i'll take practical experience
> over untested theory any day.
[...]
> so far we have a few people who think it's a great idea no matter what
> (even thought they haven't actually tried it), one person (me) who HAS
> tried it and reported that it causes problems in some situations, and a
> bunch of other people who thought it was a good idea at first but are
> willing to learn from the experience of others.

I've tried it and it works fine for me.  I agree, this should be a globally configurable option if possible, i.e.,:

# cat /etc/cron.conf
NICENESS=10

> if you think it's such a great idea why dont you test it and report
> back with what benefits it gained you?

Personally, I find the benefits are not all that great since cron jobs
(i.e., from findutils) tend to be IO hogs and niceness doesn't
particulary matter in terms of user responsiveness.
> if you're going to advocate doing weird and unusual things then you
> should at least advocate doing it in a typically sensible debian fashion
> - don't force it on everyone, make it an easily tweaked configuration
> option.

I agree with this, not so much for your reasons just becuase I don't
think it matters all that much.  I guess I would tend to think that if
we focussed more on laptop situations (i.e., anacron being
configurable to not run cron jobs at all unless we're on wall power)
then we would really see some benefit from the users who really care
(battery-powered situations) without loss of benefit for servers.

--
.....Adam Di Carlo....adam@onShore.com.....<URL:http://www.onShore.com/>


Reply to: