Chapter 3. Bandwidth and Processing Power
39
In order to get a more detailed view of CPU utilization, we must change tools. If we look at output
from
vmstat
, we obtain a slightly different view of our example system:
procs
memory
swap
io
system
cpu
r
b
w
swpd
free
buff
cache
si
so
bi
bo
in
cs
us
sy
id
1
0
0
0 233276 146636 469808
0
0
7
7
14
27
10
3
87
0
0
0
0 233276 146636 469808
0
0
0
0
523
138
3
0
96
0
0
0
0 233276 146636 469808
0
0
0
0
557
385
2
1
97
0
0
0
0 233276 146636 469808
0
0
0
0
544
343
2
0
97
0
0
0
0 233276 146636 469808
0
0
0
0
517
89
2
0
98
0
0
0
0 233276 146636 469808
0
0
0
32
518
102
2
0
98
0
0
0
0 233276 146636 469808
0
0
0
0
516
91
2
1
98
0
0
0
0 233276 146636 469808
0
0
0
0
516
72
2
0
98
0
0
0
0 233276 146636 469808
0
0
0
0
516
88
2
0
97
0
0
0
0 233276 146636 469808
0
0
0
0
516
81
2
0
97
Here we have used the command
vmstat 1 10
to sample the system every second for ten times. At
first, the CPU related statistics (the
us
,
sy
, and
id
fields) seem similar to what
top
displayed, and
maybe even a bit less detailed. However, unlike
top
, we can also gain a bit of insight into how the
CPU is being used.
If we look at the
system
fields, we see that the CPU is handling about 500 interrupts per second on
average, and is switching between processes anywhere from 80 to nearly 400 times a second. If you
think this seems like a lot of activity, think again, because the user level processing (the
us
field) is
only averaging 2%, while system level processing (the
sy
field) is usually under 1%. Again, this is an
idle system.
Looking at the tools that Sysstat offers, we find that
iostat
and
mpstat
provide little additional
information over what we have already seen with
top
and
vmstat
. However,
sar
produces a number
of reports that can come in handy when monitoring CPU utilization.
The first report is obtained by the command
sar q
, and displays the run queue length, total number
of processes, and the load averages for the past one and five minutes. Here is a sample:
Linux 2.4.18 14smp (falcon.example.com)
12/16/2002
12:00:01 AM
runq sz
plist sz
ldavg 1
ldavg 5
12:10:00 AM
3
122
0.07
0.28
12:20:01 AM
5
123
0.00
0.03
...
09:50:00 AM
5
124
0.67
0.65
Average:
4
123
0.26
0.26
In this example, the system is always busy (given that more than one process is runnable at any given
time), but is not overly loaded (due to the fact that this particular system has more than one processor).
The next CPU related
sar
report is produced by the command
sar u
:
Linux 2.4.18 14smp (falcon.example.com)
12/16/2002
12:00:01 AM
CPU
%user
%nice
%system
%idle
12:10:00 AM
all
3.69
20.10
1.06
75.15
12:20:01 AM
all
1.73
0.22
0.80
97.25
...
10:00:00 AM
all
35.17
0.83
1.06
62.93
Average:
all
7.47
4.85
3.87
83.81
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved