LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Linux CPU load average (https://www.linuxquestions.org/questions/linux-newbie-8/linux-cpu-load-average-865885/)

kdelover 03-02-2011 01:09 AM

Linux CPU load average
 
Hey,

I have a small query regarding the load averages on a multi-core machines.

If a single core machine has load avg of 1,does it mean that CPU utilization is 100 %?

For a dual core,does a load of 2.0 mean ,the cpu utilization is 100 % or 50 %?

my machine specs are:
Code:

grep -i siblings /proc/cpuinfo
siblings        : 2

So,what would the loadavg of 1,2,4 in percentages should be ?

my calculation is
Code:

cores  loadavg  cpu %
  1      1        100
  2      1        50
  4      1        25

Is the calculation right?

Thanks !

macemoneta 03-02-2011 01:33 AM

Almost. Linux includes processes in I/O wait, so CPU utilization doesn't map directly to load. A system can have a low CPU utilization and still have a high load in this case. See the Wikipedia description.

kdelover 03-02-2011 02:26 AM

From wikipedia
Quote:

For example, one can interpret a load average of "1.73 0.50 7.98" on a single-CPU system as:

* during the last minute, the CPU was overloaded by 73% (1 CPU with 1.73 runnable processes, so that 0.73 processes had to wait for a turn)
* during the last 5 minutes, the CPU was underloaded 50% (no processes had to wait for a turn)
* during the last 15 minutes, the CPU was overloaded 698% (1 CPU with 7.98 runnable processes, so that 6.98 processes had to wait for a turn)
If i apply "1.73 0.50 7.98" on dual core machine does it mean:

-for last minute the cpu was overloaded by 73% i.e 73/2 = 36% per proc ?
-for last 5 minute the cpu was under loaded by 50% i.e 50/2 = 25% per proc ?

devUnix 03-02-2011 09:31 AM

Quote:

Originally Posted by kdelover (Post 4275975)

my calculation is
Code:

cores  loadavg  cpu %
  1      1        100
  2      1        50
  4      1        25

Is the calculation right?

Thanks !

Your calculation seems correct.

1 core and 1 loadavg means 100% CPU utilization.
For 2 cores the loadavg has to be 2 to mean 100% CPU utilization.

A loadavg of .75 should signal the System Admin to look into it before the system/server gets worse- a proactive action.

A loadavg of .9 and above means critical state and requires immediate action to be taken to prevent a system crash! Well, the system may not crash at all but a lot of jobs can fail to run. I have seen it practially. Once I was working for a client and the server's loadavg reached so much hight that even "clear" would fail to run.

macemoneta 03-02-2011 11:46 AM

Quote:

Originally Posted by kdelover (Post 4276035)
If i apply "1.73 0.50 7.98" on dual core machine does it mean:

-for last minute the cpu was overloaded by 73% i.e 73/2 = 36% per proc ?
-for last 5 minute the cpu was under loaded by 50% i.e 50/2 = 25% per proc ?

Assuming no I/O wait, that would be correct. However, if you have many processes in wait, the CPU will likely be low while the load is high. Examples from Wikipedia include a slow I/O device or NFS mount.

The better way to think of load on Linux is as a measure of system response time. The higher the number, the less responsive. If you want a measure of CPU load exclusively, use top or sar.

syg00 03-02-2011 12:18 PM

Dodgy software can place threads (incorrectly) in uninterrupable sleep, and drive the load way past 100 - with no (response) effect on anything. Apache for example.

loadavg, like %wa, is a barely useful metric. Especially when it's not properly understood, and interpreted in relation to the specific computing environment involved.

macemoneta 03-02-2011 12:40 PM

To clarify, the response time I was referring to is process response time (how quickly processes are being serviced), not interactive response. You're correct that interactive response may not be impacted at all, even with a high load.


All times are GMT -5. The time now is 12:31 PM.