ow can /proc/loadavg be used ?

参见: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 could run if the
scheduler let them run. A dual core CPU could 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 fifteen 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 the
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 a
job. A load average of 10 may be fine for one, and a disaster for
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.

你可能感兴趣的:(server,database,input,jobs,disk,Numbers)