On Wed, Jun 21, 2006 at 11:50:14PM -0500, Andy Bakun wrote:
> On Thu, 2006-06-22 at 09:35 +0700, Alain Fauconnet wrote:
> > One point I wish to make in this discussion is that load average
> > includes more than pure CPU load (on most systems I've worked on
> > anyway). It also takes other factors into account e.g. disk I/O rate.
> > Using 'nice' is certainly the best way to make a process run only when
> > CPU load is low, but if that process is a disk I/O hog, it will still
> > impact the overall load average and compete with other processes
> > making disk I/Os. Same goes for memory hogs and swapping induced disk
> > I/O.
> 
> The script in question seemed to be only be looking at CPU load, not io
> or swap load.  "load", in general, could be measured against any
> resource there is contention for, but usually it's just against
> processor resources.

It reads /proc/loadavg:

sub loadavg {
    # Linux specific (but fast)
    open(IN,"/proc/loadavg") || die;
    my $upString = <IN>;
    my ($loadavg) = ($upString =~ m/^(\d+\.\d+)/);
    return $loadavg;
}

which yields (surprise!) the load average computed by the kernel.

> Load is merely a count of how many processes are in the "ready to
> run/waiting for CPU" state when the measurement is taken.  Processes
> that are waiting on disk I/O are not ready to run (they will have a D in
> the state field in top).  Processes that are doing a lot of I/O to a

I beg to differ: AFAIK load average includes processes in the 'D'
(disk I/O wait) state. I don't quite have the time to dive in the
kernel sources right now but I'm fairly positive it does. I've found
some references on the web conforting me in that opinion e.g.:

http://linux-ha.org/DRBD/FAQ:

``Load average is defined as average number of processes in the runqueue
during a given interval. A process is in the run queue, if it is

    *      not waiting for external events (e.g. select on some fd)
    *      not waiting on its own (not called "wait" explicitly)
    *      not stopped

Note that all processes waiting for disk io are counted as runnable!
Therefore, if a lot of processes wait for disk io, the "load average"
goes straight up, though the system actually may be almost idle
cpu-wise''

I have for sure seen Linux boxes heavily trashing due to swapping or
unreasonable disk I/O, with very little CPU load but load average in
the 100s.

[Rest deleted - no comments on these quite informative bits]

Greets,
_Alain_
_______________________________________________
tsl-discuss mailing list
[email protected]
http://lists.trustix.org/mailman/listinfo/tsl-discuss

Reply via email to