0

I am a Linux rookie, so I'm trying to figure out a discrepancy. The problem is that the 1-minute average load available in /proc/loadavg doesn't make sense when compared to the output of the "ps aux" command. For example, sometimes the 1-minute average load reaches 15+. That's an enormous load given that my VPS has 6 cores. Yet, "ps aux" is barely showing any load - the %CPU of all processes add up to a few percent.

What am I doing wrong? Is this discrepancy due to the fact that "ps" shows the running processes at the moment, while the high 1-minute average may have been caused by a process that is no longer running? If this is the case, how can I see a list of all processes that have run during the past minute?

Jeff
  • 27
  • 6

2 Answers2

1

The key point to understand is that CPU usage and load average measure two different things.

CPU usage is somewhat simpler to grasp, as it is the time the CPU is not idle, where "idle" identifies the kernel idle loop (which executes an HALT instruction or similar).

Load average measures, as stated in the man page,

the number of jobs in the run queue (state R) or waiting for disk I/O (state D) averaged over 1, 5, and 15 minutes In other words, load average is, well, an average of how many processes are in run queue waiting for execution (R) or for I/O completion (D).

Sometime, high CPU utilization can be related to high load average (and vice versa); other times the two values are completely unrelated: for example, many processes waiting for network I/O can increase your load average, while using basically no CPU time.

shodanshok
  • 47,711
  • 7
  • 111
  • 180
0

the load value in linux is not a value that is directly corresponding to cpu usage. cpu usage is calculated by how much time the cpu is in idle in a given time period. The load is an indication about processes waiting on IO to be processed e.g. disk reading, network activity. (Im not sure weather it's the amount of processes, time to answer an io request or just a calculated number for comparison)

So a high load, low cpu usage usualy means that some process is running that doesn't require much processing power but heavily relies on some IO heavy task

laubed
  • 66
  • 1
  • 4