See http://unix.derkeiler.com/Newsgroups/comp.unix.shell/2006-11/msg00577.html
Re: How can/proc/loadavg be used?
- From
: Bruce Barnett <spamhater113 + u061115075347 @ xxxxxxxxxxxx
>
- Date
: Wed, 15 Nov 2006 13:00:11 + 0000 (UTC)
Bo Yang <struggle @ xxxxxxxxxxxxxxxxxx> writes:
In Linux proc filesystem, there is a file
Loadavg, it contain three fields seperately
Describe the last 1, 5, 15 minutes load average.
Also avalable In the uptime (1) command for older systems.
The top (1) program shows this as well.
And my question is, how the kernel calculate
These three number,
The load average is the number of jobs that are ready to run at that time.
Let me give some more detail.
If a process is sleeping because it's waiting for input, it's not
Ready to run. So a process waiting for a disk or network input is not
Ready to run. A process that was using 100% CPU and 0% disk is always
Ready to run.
Rarely are jobs 100% CPU or 100% I/O. It's always a mixture.
Three important points
The load average is the number of processes that cocould run if
Scheduler let them run. A dual core CPU cocould handle 2 processes using
100% CPU. If that is all that is running, it's fine.
The second is-How quickly do these jobs complete?
If another process starts, and completes quickly-fine.
The third is-how do these numbers look at 1 minute, 5 minutes and 15
Minutes, and how do they change.
Load average: 10.00, 5.03, 1.00
-This is trouble. The load average is increasing.
Load average: 1.00, 5.03, 10.00
-The opposite. The load average was 10.0 paiteen minutes ago,
And the CPU is recovering.
Load average: 4.00, 4.03, 4.00
-A steady load
And how big the number is
For a normal running server?
There is no simple answer. If the computer is able to complete
Jobs in sufficient time, then it is fine. Sufficient is something you
Have to define. We can't do that.
Examples:
Web Server
Mail Server
Financial database
Simulation Server
All of these systems have different requirements for completion of
Job. A load average of 10 may be fine for one, and a disaster
Another.
You can look at other tools as well.
I like top (1) as it shows a lot of information, including percent idle.
P.s. Your English is better than my Chinese.