4
What is the command to see CPU load of a RedHat Linux server?
4
What is the command to see CPU load of a RedHat Linux server?
12
top
- The classic approachhtop
- The colorful approachmpstat
- The plain and simpleIf you're wondering how to read the CPU load from the output of top
or mpstat
, please look at the idle values they print. The CPU load is the difference between 100% and the displayed value.
If you think that that's weird, please see our question: How is the percentage of CPU usage calculated?
4
Personally I think looking at the average load of a period is best. Otherwise you might get quite different values depending on the timing. (e.g. enter a command and press [Enter] might yield a different result than if you pressed [Enter] a fraction of a second later.)
Some ways of checking the load average are:
cat /proc/loadavg
beetle:/proc>cat loadavg 0.45 0.19 0.13 1/263 17588
uptime
also shows the load.
toad:/home/hennes>uptime 4:03PM up 155 days, 19:12, 38 users, load averages: 0.16, 0.17, 0.12
Via top
. Look at he line load averages:
in the upper right corner.
htop
mpstat
systat (e.g. systat -vmstat)
Most of these programs give you three numbers:
If you have one core then a load of 1 more or less indicates that core is busy 100% of the time. This number can exceed 1 (or 100%). If that happens there is on average more then one process in the run queue.
If you have multiple CPU's then 100% (or 1.00) means that one average one core is busy all the time. E.g. with 4 core this could mean 1 core running flat out and 3 cores being idle. Or 4 cores running ¼ of the time.
just for sake of explicity: if i have a 24 cpu machine and uptime
says load average: 65.12, 64.98, 64.16
then this machine is heavily overloaded? – helt – 2017-05-18T08:15:33.093
No. It might mean that. But there are reasons why processses could be iin the run queue without actually using CPU time. (e.g. when waiting for an action). – Hennes – 2017-05-18T11:27:00.253
Thanks, load average 0.45 means: 45% of CPU power is used? – alwbtc – 2012-07-30T09:57:22.820
0.45 means that 45 of a single CPU core is used. 45% used, 55% idle. ---- If you have two core and get a load of 0.45 then 45% of a core is used and 155% is idle ; or both core are used 22.5% of the time and both core are idle 77.5% of the time. – Hennes – 2012-07-30T12:19:52.550
Thanks, but it gives cpu load per process. I want to see total CPU load, for example 85% – alwbtc – 2012-07-29T13:55:22.530
If you look at the top line in the first image (program top). It has the line
load average
. The three values after that are the load average over time. – Hennes – 2012-07-29T14:06:14.0471
@alwbtc: They all give you that in various forms. If you look at the output of
– Der Hochstapler – 2012-07-29T14:17:44.547mpstat
you see anidle
value of99.24
. This means I have a CPU load of0.76%
. As @Hennes notes, there is also the load average displayed, which is another indicator of CPU load. If you really only want a command that returns a single percent value, you'll probably want to post-process the output ofmpstat
.