The physical measurement
of a system is useful up to a point - it
can identify bottleneck devices and let
you know when your system is becoming congested,
but it can't tell you which users or applications
are responsible. The UNIX 'ps' command will
provide an accurate measure of the CPU usage
of a process provided the process is a long-running
one, and can be seen in several consecutive
'ps' snapshots. It will tell you nothing
about short-lived processes (which can number
in the hundreds of thousands in a day) falling
in between successive 'ps' views.
UNIX accounting writes a record for each
terminated process (about 40 bytes) and
thus provides an unbroken record of all
activity and resource consumption from the
user/process point of view. It allows accurate
measurement of not just the short-lived
processes' resource consumption, but is
the only means whereby the full story can
be told of a long-running job. See below:
09:00 09:15 09:30 09:45 10:00 10:15
|--------------------------------------|
^ ^ ^ ^ ^ ^
ps ps ps ps ps ps
no yes yes yes yes no
13 29 42 57
16 13 15 ^
acc
159
102
A job starts at 09:08 and finishes
at 10:06. It will not be present in a 'ps'
snapshot taken at 09:00 (it hasn't started
yet). It will be present in the 'ps' snapshots
taken at 09:15, 09:30, 09:45 and 10:00.
It will not be present in the 'ps' snapshot
taken at 10:15 (it finished nine minutes
earlier). The 'ps' command gives a running
total of the CPU seconds of a process. At
09:15 we see that it has accumulated 13
CPU seconds since it started; at 09:30 the
total has risen to 29, i.e. another 16 have
been added. Another 13 in the next 15 minutes
and another 15 in the final quarter of an
hour
that 'ps' can see it.
What we can't tell from that is that this
particular job does some very intensive
processing at the end. If accounting is
on, that will tell you that the job consumed
159 CPU seconds in total, and you'll be
able to work out that it used 102 of them
in its last six minutes.
Accounting also shows the split of CPU
time between system state and user state
('ps' doesn't), the average memory occupancy
of a process ('ps' doesn't) and the number
of logical block I/O requests that the process
made ('ps' has no I/O information of any
kind).
The Athene software automatically integrates
the 'ps' and UNIX accounting data into its
Performance Database to provide the fullest
possible picture of user/process activity.
Whether using Athene or other means, this
technique allows accurate analysis of machine
performance, and provides the best foundation
upon which to build planning models of your
business.
Next
UNIX Tip |