CPU on AIX/POWER

 

We will run the same tests on AIX as in previous post on Linux.

My AIX lpar has 8 virtual CPUs on POWER7
 type=Shared mode=Uncapped smt=4 lcpu=32 psize=5 ent=0.80 
 Online Virtual CPUs                        : 8

I will use time, nmon, mpstat, and pprof to check on the CPU.
The pprof command on AIX can report both time and core-based CPU usage, it is a good tool to see how these 2 methods compare.

# bc on AIX, loop is calibrated for around 10 seconds, we will run the process on logical CPU 31
# based on time output I calculated 52% for CPU utilization
bindprocessor $$ 31
time echo "scale=12;for(x=0;x<700000;++x){1+1.243;}" | bc >/dev/null

real    0m11.41s	<- 0.52=(4.44+1.52)/11.41
user    0m4.44s
sys     0m1.52s

nmon also shows my script used 52% for %CPU (bc runs as dc, desk calculator).
How come it is not closer to 100%?
The script is designed to max out the CPU & on Linux it did push utilization to 100%.

nmon1thread


According to mpstat, processor 31 is 100% utilized (us+sy).
At the same time physical processor consumed (pc) is 0.52
We are not using the whole core when our CPU hog process maxes out one of the logical CPUs on that core.

mpstat -w 5 10000 | egrep 'cpu|^ 31'
cpu    min    maj    mpc    int     cs    ics     rq    mig   lpa   sysc    us    sy    wa    id    pc   %ec   lcs
 31      0      0      0      1      0      0      0      0 100.0    105   4.7  11.5   0.0  83.8  0.00   0.0     0
 31     42      0      0     36     28     28      1      1 100.0 105810  75.5  24.3   0.0   0.2  0.17  21.3    29
 31      0      0      0     89     67     67      1      0 100.0 247019  73.7  26.3   0.0   0.0  0.52  33.8    68
 31      6      0      0     91     81     81      0      1 100.0 299217  74.5  25.5   0.0   0.0  0.52  26.7    81
 31      0      0      0      0      0      0      0      0     -    264   0.0   0.8   0.0  99.2  0.00   0.0     0


I also collected CPU utilization data with pprof.

# save pid-s of spawned processes
pid2save=`ps -ef | grep "dc -$" | awk '{print $2}'`
# time based CPU util
pprof 3 -p
mv pprof.cpu pprof.cpu.time
# PURR based CPU util
pprof 3 -p -r PURR
mv pprof.cpu pprof.cpu.purr

# calculate time based CPU utilization 
# my CPU hog process accumulated 3.006 seconds (ACC_time) within 3.010 seconds
# each second we used 0.99 (logical) CPU, process utilization is 99%
egrep -i "PURR|Pname|$pid2save" pprof.cpu.time
egrep -i "$pid2save" pprof.cpu.time | awk '{print "cpu consumed per second " $7/$10}'

       Pname      PID     PPID  BE      TID     PTID  ACC_time  STT_time  STP_time   STP-STT       
   dc 59117318 38339310  AA 67110553        0     3.006     0.009     3.019     3.010
 cpu consumed per second 0.998671

# calculate PURR based CPU utilization
# my CPU hog process used 1.574 cores within 3 seconds
# each second we used 0.52 core, process utilization is 52%
egrep -i "PURR|Pname|$pid2save" pprof.cpu.purr
egrep -i "$pid2save" pprof.cpu.purr | awk '{print "cpu consumed per second " $7/$10}'

        * = Purr based values
       Pname      PID     PPID  BE      TID     PTID ACC_time*  STT_time  STP_time   STP-STT       
   dc 59117318 38339310  AA 67110553        0     1.574     0.001     3.011     3.010
 cpu consumed per second 0.522924

Data from pprof is matching mpstat output: logical CPU 31 is maxed out at 100% while it is using 52% of the physical core.
Advertisements