Professional Documents
Culture Documents
QV4311Exercise SG Hints
QV4311Exercise SG Hints
cover
AIX Performance
Management I: Concepts and
Tools
Student Exercises
with Hints
ERC 1.1
The information contained in this document has not been submitted to any formal IBM test and is distributed on an “as is” basis without
any warranty either express or implied. The use of this information or the implementation of any of these techniques is a customer
responsibility and depends on the customer’s ability to evaluate and integrate them into the customer’s operational environment. While
each item may have been reviewed by IBM for accuracy in a specific situation, there is no guarantee that the same or similar results will
result elsewhere. Customers attempting to adapt these techniques to their own environments do so at their own risk.
TOC Contents
Exercise 1. Data Collection and Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
Introduction
This exercise covers the basic performance tools available for
monitoring and analysis.
Exercise Objectives
At the end of the lab, you should be able to:
• Be familiar with some basic performance analysis tools
• Use topas to monitor the system
• Install PerfPMR
• Collect performance data using PerfPMR
References
More information about the commands in this exercise are
available from the IBM Systems Information Center:
http://publib.boulder.ibm.com/infocenter/systems/index.jsp
© Copyright IBM Corp. 2009 Exercise 1. Data Collection and Analysis 1-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
EXempty Part 1 - Getting familiar with some basic performance analysis tools
In this section of the exercise, you will be introduced to some basic performance
analysis commands.
Steps
__ 1. Place a checkmark next to the commands below which are related to performance
monitoring.
© Copyright IBM Corp. 2009 Exercise 1. Data Collection and Analysis 1-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
__ 3. Which of the following commands display the percentage of processor time used?
The next few steps will lead you through running these commands and determining
the answers.
__ a. The vmstat command reports virtual memory statistics. Use the following
command to display three reports at 5-second intervals:
# vmstat 5 3
EXempty __ b. The iostat command reports CPU statistics, I/O statistics for the entire system,
adapters, TTY devices, disks CD-ROMs, tapes and file systems. Use the
following command to print the system throughput report since boot:
# iostat -s
tty: tin tout avg-cpu: % user % sys % idle % iowait physc % entc
0.0 0.9 0.0 0.0 99.7 0.3 0.0 0.0
System: rand212.beaverton.ibm.com
Kbps tps Kb_read Kb_wrtn
Physical 16.2 1.9 114431 67540
__ c. The ps command shows the current status of processes, including CPU time.
Use the following command to print information about the processes associated
with this terminal.
# ps u
__ d. The sar command collects, reports, or saves system activity information. Use
the following command to display three reports at 5-second intervals:
# sar 5 3
» The output should be similar to the following:
AIX rand212 1 6 00066C32D900 03/04/09
© Copyright IBM Corp. 2009 Exercise 1. Data Collection and Analysis 1-5
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
__ 4. Which of the following commands report memory statistics? The next few steps will
lead you through running these commands and determining the answers.
__ a. The vmstat command reports virtual memory statistics. Use the following
command to display various memory statistics:
# vmstat -s
EXempty
__ c. The sar command collects, reports, or saves system activity information. Use
the following command to display three paging statistic reports at 5-second
intervals.
# sar -r 5 3
» The output should be similar to the following:
AIX rand212 1 6 00066C32D900 03/04/09
Average 129309 0 2 0
__ 5. Run the following commands and note which ones display input/output statistics for
the entire system. The next two steps will lead you through running these
commands and determining the answers.
© Copyright IBM Corp. 2009 Exercise 1. Data Collection and Analysis 1-7
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
» Commands iostat and sar report I/O statistics. These commands and
others are normally used in conjunction to better reflect the complete
situation of the system performance.
__ a. The iostat command reports CPU statistics, input/output statistics for the entire
system, adapters, TTY devices, disks CD-ROMs, tapes and file systems. Use
the following command to display an extended drive report for all disks:
# iostat -D 1 1
__ b. The sar command collects, reports, or saves system activity information. Use
the following command to report activity for each block device with the exception
of tape drives:
# sar -d 1
» The output should be similar to the following:
AIX rand212 1 6 00066C32D900 03/04/09
EXempty
__ 6. Run the following commands and note which ones display network statistics. The
next two steps will lead you through running these commands and determining the
answers.
__ a. The netstat command reports network status. Use the following command to
display the number of packets received, transmitted, and dropped in the
communications subsystem:
# netstat -D
© Copyright IBM Corp. 2009 Exercise 1. Data Collection and Analysis 1-9
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
__ b. The entstat command reports ethernet device driver and device statistics. Use
the following command to display the device generic statistics for ent0:
# entstat ent0
» The output should be similar to the following:
-------------------------------------------------------------
ETHERNET STATISTICS (ent0) :
Device Type: Host Ethernet Adapter (l-hea)
Hardware Address: 00:21:5e:1d:09:80
Elapsed Time: 0 days 3 hours 24 minutes 48 seconds
General Statistics:
-------------------
No mbuf Errors: 0
Adapter Reset Count: 0
Adapter Data Rate: 200
Driver Flags: Broadcast Running Simplex
64BitSupport ChecksumOffload LargeSend
DataRateSet
Steps
__ 7. If you are not already logged in, login to your assigned system as the root user.
© Copyright IBM Corp. 2009 Exercise 1. Data Collection and Analysis 1-11
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
__ 10. Use the following command to directly display the running processes:
# topas -P
» The display should be similar to the following:
Topas Monitor for host: rand212 Interval: 2 Wed Mar 4 18:10:26 2009
EXempty __ 12. Use the following command to directly display the file system display statistics:
# topas -F
» The display should be similar to the following:
Topas Monitor for host: rand212 Interval: 2 Wed Mar 4 18:14:27 2009
================================================================================
FileSystem KBPS TPS KB-R KB-W Open Create Lock
/usr 0.0 0.0 0.0 0.0 0 0 0
/var 0.0 0.0 0.0 0.0 0 0 0
/tmp 0.0 0.0 0.0 0.0 0 0 0
/ 0.0 0.0 0.0 0.0 0 0 0
/home 0.0 0.0 0.0 0.0 0 0 0
/opt 0.0 0.0 0.0 0.0 0 0 0
/admin 0.0 0.0 0.0 0.0 0 0 0
/proc 0.0 0.0 0.0 0.0 0 0 0
__ 14. Use the following command to directly the disk metric statistics:
# topas -D
» The display should be similar to the following:
Topas Monitor for host: rand212 Interval: 2 Wed Mar 4 18:17:22 2009
===============================================================================
Disk Busy% KBPS TPS KB-R ART MRT KB-W AWT MWT AQW AQD
hdisk0 0.0 2.4 0.6 0.0 0.0 0.0 2.4 6.9 9.6 0.0 0.0
hdisk1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
hdisk2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
» Note: Instead of starting/stopping topas, you can just type the letter D to
replace the current display with the disk metric statistics. If the D key is
pressed again, the display toggles back to the default main screen.
© Copyright IBM Corp. 2009 Exercise 1. Data Collection and Analysis 1-13
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
Steps
__ 16. If you are not already logged in, login to your assigned system as the root user.
__ 19. Uncompress the PerfPMR package into /u/QV431/perf61 using the following
command:
# zcat /u/QV431/PerfPMR_Package/perf61.tar.Z | tar -xvf -
» The output should be similar to the following:
x Install, 2237 bytes, 5 media blocks.
x PROBLEM.INFO, 2616 bytes, 6 media blocks.
x README, 9818 bytes, 20 media blocks.
x config.sh, 24808 bytes, 49 media blocks.
x emstat.sh, 1867 bytes, 4 media blocks.
x filemon.sh, 2281 bytes, 5 media blocks.
x getdate, 4667 bytes, 10 media blocks.
x getevars, 6594 bytes, 13 media blocks.
x getj2mem.sh, 1722 bytes, 4 media blocks.
x getmempool.sh, 1919 bytes, 4 media blocks.
x getvmpool.sh, 507 bytes, 1 media blocks.
x hpmcount.sh, 802 bytes, 2 media blocks.
x hpmstat.sh, 1890 bytes, 4 media blocks.
x iomon, 10092 bytes, 20 media blocks.
x iostat.sh, 4291 bytes, 9 media blocks.
x iptrace.sh, 1954 bytes, 4 media blocks.
x lparstat.sh, 3011 bytes, 6 media blocks.
x lsc, 28343 bytes, 56 media blocks.
x memdetails.sh, 19752 bytes, 39 media blocks.
x memfill, 7342 bytes, 15 media blocks.
__ 21. Examine the shell scripts and configuration files which make up PerfPMR. Use the
ls command to see the content of the /u/QV431/perf61 directory.
» # ls /u/QV431/perf61
» The output should be similar to the following:
Install getj2mem.sh lparstat.sh perfpmr.cfg setsched
PROBLEM.INFO getmempool.sh lsc perfpmr.sh svmon.sh
README getvmpool.sh memdetails.sh perfxtra.sh tcpdump.sh
config.sh hpmcount.sh memfill pprof.sh tprof.sh
emstat.sh hpmstat.sh monitor.sh ps.sh trace.sh
filemon.sh iomon mpstat.sh quicksnap.sh vmstat.sh
getdate iostat.sh netstat.sh sar.sh
getevars iptrace.sh nfsstat.sh setpri
© Copyright IBM Corp. 2009 Exercise 1. Data Collection and Analysis 1-15
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
Steps
__ 22. If you are not already logged in, login to your assigned system as the root user.
__ 25. Run the following command to obtain the PerfPMR command line usage.
# /u/QV431/perf61/perfpmr.sh -?
» The output should be similar to the following:
Version: 610 2008/12/19
perfpmr.sh: Usage:
__ 26. Run the following command to run PerfPMR to collect performance data for 60
seconds (1 minute).
# /u/QV431/perf61/perfpmr.sh 60
Note: By default, PerfPMR (perfpmr.sh without any parameters) runs for 600
seconds (10 minutes).
» The output should be similar to the following:
(C) COPYRIGHT International Business Machines Corp., 2000,2001,2002,2003,2004-2008
© Copyright IBM Corp. 2009 Exercise 1. Data Collection and Analysis 1-17
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
19:32:31-03/04/09 : df
EXempty 19:32:31-03/04/09 : netstat -in -rn -D -an -c
19:32:32-03/04/09 : getmempool.sh
/u/QV431/perf61/getmempool.sh[5]: fr_per_pool=nf/np: divide by zero
19:32:33-03/04/09 : getvmpool.sh
19:32:33-03/04/09 : getj2mem.sh
19:32:34-03/04/09 : genkld
19:32:34-03/04/09 : genkex
19:32:34-03/04/09 : getevars
19:32:34-03/04/09 : errpt
19:32:34-03/04/09 : emgr -l
© Copyright IBM Corp. 2009 Exercise 1. Data Collection and Analysis 1-19
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
EXempty __ 28. Examine the contents of the files generated by PerfPMR and answer the following
questions.
__ a. Which file contains the system configuration summary? ___________________
» config.sum
__ b. Which file contains the summaries of the ps, sar, iostat, and vmstat
commands? ______________________________
» monitor.sum
© Copyright IBM Corp. 2009 Exercise 1. Data Collection and Analysis 1-21
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
END OF LAB
Introduction
This exercise covers the basic tools available for performance tuning.
Exercise Objectives
At the end of the lab, you should be able to:
• Be familiar with the usage of the basic performance tuning
commands
• View and change the attributes of tunables
• Validate the tunable parameters
• Examine the tunables files
• Reset tunables to their default values
References
More information about the commands in this exercise are
available from the IBM Systems Information Center:
http://publib.boulder.ibm.com/infocenter/systems/index.jsp
EXempty Part 1 - Getting familiar with some basic tools for performance tuning
In this section of the exercise, you will be introduced to some performance tuning
commands.
Steps
__ 1. Place a checkmark next to the commands below which are related to performance
tuning.
__ 2. AIX offers a set of tuning commands (schedo, vmo, ioo, raso, no, and nfso) which
provides a standard interface for displaying, resetting, and changing tuning
parameters (also known as tunables). Fill in the table by matching the commands to
the functions.
Tuning Command /
schedo vmo ioo raso no nfso
Description
Manages Input/Output
X
tunable parameters
Manages Network File
System (NFS) tuning X
parameters
Manages network tuning
X
parameters
Manages Virtual Memory
Manager tunable X
parameters
Manages processor
scheduler tunable X
parameters
Manages Reliability,
Availability, Serviceability X
parameters
__ 3. Run one of the following commands to obtain the command line usage for the tuning
commands.
# schedo -h
# vmo -h
# ioo -h
» The output should be similar to the following:
Usage: schedo -h [tunable] | {[-F] -L [tunable]} | {[-F] -x [tunable]}
schedo [-p|-r] (-a [-F] | {-o tunable})
schedo [-p|-r] (-D | ({-d tunable} {-o tunable=value}))
-h Display help about the command and its arguments
-h tunable Display help about a tunable
-L [tunable] List information about one or all tunables in a
table format
-x [tunable] List information about one or all tunables in a
comma-separated format
EXempty -a Display value for all tunables, one per line
-F Force display of restricted tunables when options
(-a/-L/-x) are specified alone on the command line,
else ignored
-o tunable Display current value of a tunable
-D Reset all tunables to their default values
-d tunable Reset tunable to its default value
-o tunable=value Set tunable to value
-r Make change(s) (-D/-d/-o) or display (-a/-o) apply to
nextboot value
-p Make change(s) (-D/-d/-o) or display (-a/-o) apply to
permanent (current and nextboot) value
__ 4. Use the vmo command to list the current and reboot value, range, unit, type and
dependencies of all non-restricted VMM tunable parameters.
» # vmo -L
» The output should be similar to the following:
NAME CUR DEF BOOT MIN MAX UNIT TYPE
DEPENDENCIES
--------------------------------------------------------------------------------
ams_loan_policy n/a 1 1 0 2 numeric D
--------------------------------------------------------------------------------
force_relalias_lite 0 0 0 0 1 boolean D
--------------------------------------------------------------------------------
kernel_heap_psize 64K 0 0 0 16M bytes B
--------------------------------------------------------------------------------
lgpg_regions 0 0 0 0 8E-1 D
lgpg_size
--------------------------------------------------------------------------------
lgpg_size 0 0 0 0 16M bytes D
lgpg_regions
--------------------------------------------------------------------------------
low_ps_handling 1 1 1 1 2 D
--------------------------------------------------------------------------------
maxfree 1088 1088 1088 16 209715 4KB pages D
minfree
memory_frames
--------------------------------------------------------------------------------
maxperm 214295 214295 S
--------------------------------------------------------------------------------
maxpin 211816 211816 S
--------------------------------------------------------------------------------
maxpin% 80 80 80 1 100 % memory D
pinnable_frames
memory_frames
--------------------------------------------------------------------------------
memory_frames 256K 256K 4KB pages S
--------------------------------------------------------------------------------
memplace_data 2 2 2 1 2 D
--------------------------------------------------------------------------------
memplace_mapped_file 2 2 2 1 2 D
--------------------------------------------------------------------------------
memplace_shm_anonymous 2 2 2 1 2 D
--------------------------------------------------------------------------------
memplace_shm_named 2 2 2 1 2 D
--------------------------------------------------------------------------------
memplace_stack 2 2 2 1 2 D
--------------------------------------------------------------------------------
memplace_text 2 2 2 1 2 D
--------------------------------------------------------------------------------
memplace_unmapped_file 2 2 2 1 2 D
--------------------------------------------------------------------------------
minfree 960 960 960 8 209715 4KB pages D
maxfree
memory_frames
--------------------------------------------------------------------------------
minperm 7143 7143 S
--------------------------------------------------------------------------------
minperm% 3 3 3 1 100 % memory D
--------------------------------------------------------------------------------
nokilluid 0 0 0 0 4G-1 uid D
--------------------------------------------------------------------------------
npskill 1K 1K 1K 1 128K-1 4KB pages D
--------------------------------------------------------------------------------
npswarn 4K 4K 4K 1 128K-1 4KB pages D
--------------------------------------------------------------------------------
numpsblks 128K 128K 4KB blocks S
--------------------------------------------------------------------------------
pinnable_frames 168586 168586 4KB pages S
--------------------------------------------------------------------------------
relalias_percentage 0 0 0 0 32K-1 D
--------------------------------------------------------------------------------
scrub 0 0 0 0 1 boolean D
--------------------------------------------------------------------------------
v_pinshm 0 0 0 0 1 boolean D
--------------------------------------------------------------------------------
vmm_default_pspa 0 0 0 -1 100 numeric D
--------------------------------------------------------------------------------
wlm_memlimit_nonpg 1 1 1 0 1 boolean D
--------------------------------------------------------------------------------
Parameter types:
S = Static: cannot be changed
D = Dynamic: can be freely changed
B = Bosboot: can only be changed using bosboot and reboot
R = Reboot: can only be changed during reboot
C = Connect: changes are only effective for future socket connections
M = Mount: changes are only effective for future mountings
I = Incremental: can only be incremented
d = deprecated: deprecated and cannot be changed
Value conventions:
K = Kilo: 2^10 G = Giga: 2^30 P = Peta: 2^50
M = Mega: 2^20 T = Tera: 2^40 E = Exa: 2^60
EXempty __ 5. Use the schedo command to display the current values of all non-restricted CPU
tunable parameters.
» # schedo -a
» The output should be similar to the following:
affinity_lim = 7
big_tick_size = 1
ded_cpu_donate_thresh = 80
fixed_pri_global = 0
force_grq = 0
maxspin = 16384
pacefork = 10
proc_disk_stats = 1
sched_D = 16
sched_R = 16
tb_balance_S0 = 2
tb_balance_S1 = 2
tb_threshold = 100
timeslice = 1
vpm_fold_policy = 1
vpm_xvcpus = 0
__ 6. Use the ioo command to display the current values of all restricted and
non-restricted I/O tunable parameters.
» # ioo -aF
» The output should be similar to the following:
aio_active = 0
aio_maxreqs = 65536
aio_maxservers = 30
aio_minservers = 3
aio_server_inactivity = 300
j2_atimeUpdateSymlink = 0
j2_dynamicBufferPreallocation = 16
j2_inodeCacheSize = 400
j2_maxPageReadAhead = 128
j2_maxRandomWrite = 0
j2_metadataCacheSize = 400
j2_minPageReadAhead = 2
j2_nPagesPerWriteBehindCluster = 32
j2_nRandomCluster = 0
j2_syncPageCount = 0
j2_syncPageLimit = 16
lvm_bufcnt = 9
pd_npages = 65536
posix_aio_active = 0
posix_aio_maxreqs = 65536
posix_aio_maxservers = 30
posix_aio_minservers = 3
posix_aio_server_inactivity = 300
##Restricted tunables
aio_fastpath = 1
aio_fsfastpath = 1
aio_kprocprio = 39
aio_multitidsusp = 1
aio_sample_rate = 5
aio_samples_per_cycle = 6
j2_maxUsableMaxTransfer = 512
j2_nBufferPerPagerDevice = 512
j2_nonFatalCrashesSystem = 0
j2_syncModifiedMapped = 1
j2_syncdLogSyncInterval = 1
j2_unmarkComp = 0
jfs_clread_enabled = 0
jfs_use_read_lock = 1
maxpgahead = 8
maxrandwrt = 0
memory_frames = 262144
minpgahead = 2
numclust = 1
numfsbufs = 196
pgahd_scale_thresh = 0
posix_aio_fastpath = 1
posix_aio_fsfastpath = 1
posix_aio_kprocprio = 39
posix_aio_sample_rate = 5
posix_aio_samples_per_cycle = 6
pv_min_pbuf = 512
sync_release_ilock = 0
__ 7. Use the vmo command to display help about the maxfree tunable.
» # vmo -h maxfree
» The output should be similar to the following:
Help for tunable maxfree:
Purpose:
Specifies the number of frames on the free list at which page-stealing is to stop.
Values:
Default: 1088
Range: 16 - 209715
Type: Dynamic
Unit: 4KB pages
Tuning:
Observe free-list-size changes with vmstat n. If vmstat n shows free-list size
frequently driven below minfree by application demands, increase maxfree to reduce
calls to replenish the free list. Setting the value too high causes page replacement
to run for a longer period of time. The difference between maxfree and minfree should
be of the order of maxpgahead, and no less than 8.
Steps
__ 8. If you are not already logged in, login to your assigned system as the root user.
__ 9. Fill in the table with the attributes for the given tunable parameters. What commands
did you use to get the information?
Value at
Current Default Minimum Maximum
Tunable Parameter Next
Value Value Value Value
Reboot
maxfree 1088 1088 1088 16 209715
minfree 960 960 960 8 209715
minperm% 3 3 3 1 100
sched_D 16 16 16 0 32
sched_R 16 16 16 0 32
timeslice 1 1 1 0 2G-1
j2_maxPageReadAhead 128 128 128 0 64K
j2_maxRandomWrite 0 0 0 0 64K
» The table above has been filled in with examples from a sample system.
» Use the following commands to get the information. The output shown should
be similar to what you will see on your system.
» # vmo -L maxfree
NAME CUR DEF BOOT MIN MAX UNIT TYPE
DEPENDENCIES
--------------------------------------------------------------------------------
maxfree 1088 1088 1088 16 209715 4KB pages D
minfree
memory_frames
--------------------------------------------------------------------------------
» # vmo -L minfree
NAME CUR DEF BOOT MIN MAX UNIT TYPE
DEPENDENCIES
--------------------------------------------------------------------------------
minfree 960 960 960 8 209715 4KB pages D
maxfree
memory_frames
--------------------------------------------------------------------------------
» # vmo -L minperm%
NAME CUR DEF BOOT MIN MAX UNIT TYPE
DEPENDENCIES
--------------------------------------------------------------------------------
minperm% 3 3 3 1 100 % memory D
--------------------------------------------------------------------------------
» # schedo -L sched_D
NAME CUR DEF BOOT MIN MAX UNIT TYPE
DEPENDENCIES
--------------------------------------------------------------------------------
sched_D 16 16 16 0 32 D
--------------------------------------------------------------------------------
» # schedo -L sched_R
NAME CUR DEF BOOT MIN MAX UNIT TYPE
DEPENDENCIES
--------------------------------------------------------------------------------
sched_R 16 16 16 0 32 D
--------------------------------------------------------------------------------
» # ioo -L j2_maxPageReadAhead
NAME CUR DEF BOOT MIN MAX UNIT TYPE
DEPENDENCIES
--------------------------------------------------------------------------------
j2_maxPageReadAhead 128 128 128 0 64K 4KB pages D
--------------------------------------------------------------------------------
» # ioo -L j2_maxRandomWrite
NAME CUR DEF BOOT MIN MAX UNIT TYPE
DEPENDENCIES
--------------------------------------------------------------------------------
j2_maxRandomWrite 0 0 0 0 64K 4KB pages D
--------------------------------------------------------------------------------
EXempty __ 10. Change the following parameters to the given values and for the timeframe listed.
Note, the message for parameters that will take effect at the next reboot.
»
# ioo -r -o j2_maxPageReadAhead=32
Setting j2_maxPageReadAhead to 32 in nextboot file
Warning: changes will take effect only at next reboot
__ 11. Verify that the changes that were to take effect immediately for maxfree and
minfree have been changed. What commands did you use?
» Use the following commands to get the information.
»
# vmo -o maxfree
maxfree = 256
»
# vmo -o minfree
minfree = 240
__ 12. Look at the /etc/tunables/nextboot file to see the changes that have been made.
Are all the changes you made in Step 10 in the file? ___________
» The answer is No. Only the changes that are to be made at the next reboot
are in the /etc/tunables/nextboot file.
» Here is the contents of the nextboot file (without the comment information at
the top of the file):
» # cat /etc/tunables/nextboot
» The output should be similar to the following:
info:
AIX_level = "6.1.1.1"
Kernel_type = "MP64"
Last_validation = "2009-01-18 14:24:43 CST (current, reboot)"
vmo:
minperm% = "40"
schedo:
timeslice = "2"
sched_R = "4"
sched_D = "4"
ioo:
j2_maxPageReadAhead = "32"
j2_minPageReadAhead = "4"
EXempty
__ 14. When the system is back up, login to your assigned system as the root user.
info:
Logfile_checksum = "1791190022"
Description = "Full set of tunable parameters after last boot"
AIX_level = "6.1.2.1"
Kernel_type = "MP64"
Last_validation = "2009-03-04 20:17:29 CST (current, reboot)"
schedo:
affinity_lim = "7" # DEFAULT VALUE
big_tick_size = "1" # DEFAULT VALUE
ded_cpu_donate_thresh = "80" # DEFAULT VALUE
fixed_pri_global = "0" # DEFAULT VALUE
force_grq = "0" # DEFAULT VALUE
maxspin = "16384" # DEFAULT VALUE
pacefork = "10" # DEFAULT VALUE
proc_disk_stats = "1" # DEFAULT VALUE
sched_D = "4"
sched_R = "4"
tb_balance_S0 = "2" # DEFAULT VALUE
tb_balance_S1 = "2" # DEFAULT VALUE
tb_threshold = "100" # DEFAULT VALUE
timeslice = "2"
. . . < some output deleted >. . .
vmo:
force_relalias_lite = "0" # DEFAULT VALUE
kernel_heap_psize = "65536"
lgpg_regions = "0" # DEFAULT VALUE
lgpg_size = "0" # DEFAULT VALUE
low_ps_handling = "1" # DEFAULT VALUE
maxfree = "1088" # DEFAULT VALUE
maxperm = "214295" # STATIC (never restored)
maxpin = "211826" # STATIC (never restored)
maxpin% = "80" # DEFAULT VALUE
memory_frames = "262144" # STATIC (never restored)
memplace_data = "2" # DEFAULT VALUE
memplace_mapped_file = "2" # DEFAULT VALUE
memplace_shm_anonymous = "2" # DEFAULT VALUE
memplace_shm_named = "2" # DEFAULT VALUE
memplace_stack = "2" # DEFAULT VALUE
memplace_text = "2" # DEFAULT VALUE
memplace_unmapped_file = "2" # DEFAULT VALUE
minfree = "960" # DEFAULT VALUE
minperm = "95242" # STATIC (never restored)
minperm% = "40"
. . . < some output deleted >. . .
ioo:
aio_active = "0" # STATIC (never restored)
aio_maxreqs = "65536" # DEFAULT VALUE
aio_maxservers = "30" # DEFAULT VALUE
aio_minservers = "3" # DEFAULT VALUE
aio_server_inactivity = "300" # DEFAULT VALUE
j2_atimeUpdateSymlink = "0" # DEFAULT VALUE
j2_dynamicBufferPreallocation = "16" # DEFAULT VALUE
j2_inodeCacheSize = "400" # DEFAULT VALUE
j2_maxPageReadAhead = "32"
j2_maxRandomWrite = "0" # DEFAULT VALUE
j2_metadataCacheSize = "400" # DEFAULT VALUE
j2_minPageReadAhead = "4"
j2_nPagesPerWriteBehindCluster = "32" # DEFAULT VALUE
. . . < some output deleted >. . .
raso:
kern_heap_noexec = "0" # DEFAULT VALUE
kernel_noexec = "1" # DEFAULT VALUE
mbuf_heap_noexec = "0" # DEFAULT VALUE
. . . < some output deleted >. . .
no:
arpqsize = "12" # DEFAULT VALUE
arpt_killc = "20" # DEFAULT VALUE
arptab_bsiz = "7" # DEFAULT VALUE
. . . < some output deleted >. . .
nfso:
client_delegation = "1" # DEFAULT VALUE
nfs_max_read_size = "65536" # DEFAULT VALUE
nfs_max_write_size = "65536" # DEFAULT VALUE
EXempty
Restoring no values
===================
Warning: a restricted tunable has been modified
Setting net_malloc_police to 65536
__ 17. Change all the tunable parameters so they are back to their default values at the
next boot.
What command did you use? ______________________________________
» # tundefault -r
» The output should be similar to the following:
Modification to restricted tunable v_repage_hi, confirmation required yes/no yes
Setting v_repage_hi to 0 in nextboot file
Modification to restricted tunable v_repage_proc, confirmation required yes/no yes
Setting v_repage_proc to 4 in nextboot file
Modification to restricted tunable v_sec_wait, confirmation required yes/no yes
Setting v_sec_wait to 1 in nextboot file
Modification to restricted tunable v_min_process, confirmation required yes/no yes
Setting v_min_process to 2 in nextboot file
Modification to restricted tunable v_exempt_secs, confirmation required yes/no yes
Setting v_exempt_secs to 2 in nextboot file
Setting pacefork to 10 in nextboot file
Setting sched_D to 16 in nextboot file
Setting sched_R to 16 in nextboot file
Setting timeslice to 1 in nextboot file
Setting maxspin to 16384 in nextboot file
. . . < some output deleted >. . .
Setting vpm_fold_policy to 1 in nextboot file
Setting ded_cpu_donate_thresh to 80 in nextboot file
Setting tb_threshold to 100 in nextboot file
Setting tb_balance_S0 to 2 in nextboot file
Setting tb_balance_S1 to 2 in nextboot file
Warning: some changes will take effect only after a bosboot and a reboot
. . . < some output deleted >. . .
Run bosboot now? yes/no yes
vmo:
schedo:
EXempty
ioo:
raso:
» Note: Nothing is in the file (other than the header info) because the previous
step set everything back to their default values.
__ 20. When the system is back up, login to your assigned system as the root user.
__ 21. Look at the /etc/tunables/lastboot file. What changes have been made?
» All parameters should be back to their default values.
» # more /etc/tunables/lastboot
» The output should be similar to the following:
info:
Logfile_checksum = "2899193260"
Description = "Full set of tunable parameters after last boot"
AIX_level = "6.1.2.1"
Kernel_type = "MP64"
Last_validation = "2009-03-04 20:41:38 CST (current, reboot)"
schedo:
affinity_lim = "7" # DEFAULT VALUE
big_tick_size = "1" # DEFAULT VALUE
ded_cpu_donate_thresh = "80" # DEFAULT VALUE
. . . < some output deleted >. . .
vmo:
force_relalias_lite = "0" # DEFAULT VALUE
kernel_heap_psize = "65536"
lgpg_regions = "0" # DEFAULT VALUE
. . . < some output deleted >. . .
ioo:
aio_active = "0" # STATIC (never restored)
aio_maxreqs = "65536" # DEFAULT VALUE
. . . < some output deleted >. . .
raso:
END OF LAB
Introduction
This lab exercise covers administrative tools and their effect on CPU
performance. You will work with priorities, CPU utilization statistics,
and simultaneous multi-threading (SMT).
Exercise Objectives
At the end of the lab, you should be able to:
• Modify process priorities
• Monitor CPU usage
• Observe the run queue
• Characterize CPU usage
• Enable and disable simultaneous multi-threading
• Analyze CPU related PerfPMR files
References
More information about the commands in this exercise are
available from the IBM Systems Information Center:
http://publib.boulder.ibm.com/infocenter/systems/index.jsp
Steps
__ 1. Login to your assigned system as the root user.
Note: The SMT capability is enabled by default in AIX 6.1 and it is beneficial for
most environments. However, for this section of the exercise we need to disable
SMT in order to simulate the expected results.
__ 4. Run the program called cpuprog in the background to generate CPU activity.
# ./cpuprog &
__ 5. Run the ps -el command and fill in the table with the current priority, CPU usage
value, and nice value of the cpuprog program.
» The table above has been filled in with examples from a sample system.
» Use the ps -el command and search for the cpuprog process. Look at the
PRI column for the priority, the C column for the CPU usage and the NI
column for the nice value.
» # ps -el | head -1
» # ps -el | grep cpuprog
» Additional notes:
• The priority of the process; higher numbers mean lower priority.
• CPU utilization of the process is incremented each time the system clock
ticks and the process is running. The value is decayed by the scheduler
by dividing it by 2 once per second.
• The nice value used in calculating priority (for the SCHED_OTHER
policy).
__ 6. Run the ps -el command multiple times and notice that the priority and CPU usage
values for the cpuprog program change. Write down the values in the following
table:
» The table above has been filled in with examples from a sample system.
» Use the ps -el command and search for the cpuprog process. Look at the
PRI column for the priority, the C column for the CPU usage and the NI
column for the nice value.
» # ps -el | head -1
» # ps -el | grep cpuprog
» The output should be similar to the following:
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
200001 A 0 311452 258284 120 135 24 2594d480 96 pts/0 13:26 cpuprog
200001 A 0 311452 258284 106 127 24 2594d480 96 pts/0 13:27 cpuprog
200001 A 0 311452 258284 120 135 24 2594d480 96 pts/0 13:29 cpuprog
200001 A 0 311452 258284 120 135 24 2594d480 96 pts/0 13:33 cpuprog
200001 A 0 311452 258284 80 113 24 2594d480 96 pts/0 13:34 cpuprog
200001 A 0 311452 258284 120 135 24 2594d480 96 pts/0 13:36 cpuprog
EXempty __ 7. Open another telnet window and run the cpuprog program again (it is in
/u/QV431/ex3), but this time in the foreground. The other cpuprog process should
still be running in the background.
# /u/QV431/ex3/cpuprog
__ 8. Go back to the first window and run the ps -el command. Find out the priority and
nice value of the foreground cpuprog program. You can use the TIME column to
determine the newer process.
Is the nice value different from the one that was started in the background? _____
» # ps -el |grep cpuprog
» The output should be similar to the following:
200001 A 0 188588 196636 64 92 20 45955480 96 pts/1 0:03 cpuprog
200001 A 0 311452 258284 43 92 24 2594d480 96 pts/0 44:16 cpuprog
» Note: You should notice that the background process has a nice value of 24
and the foreground process has a nice value of 20. Some shells will
automatically add a value of 4 to the initial nice value for processes that are
started in the background.
__ 9. Change the nice value of the program running in the background to a nice value of
30.
The syntax of the renice command is:
renice [[-n Increment] | Increment]] -p <PID>
Which number (Increment) are you going to use to set the nice value to 30? ___
» # renice -n 6 -p <PID>
or
# renice 6 -p <PID>
» Use whatever PID you discovered in the ps command.
» # ps -el | grep cpuprog
» The output should be similar to the following:
200001 A 0 188588 196636 120 92 20 45955480 96 pts/1 0:03 cpuprog
200001 A 0 311452 258284 64 120 30 2594d480 96 pts/0 44:16 cpuprog
__ 11. Start the cpuprog program again but start it with a nice value of 25. Remember, all
files for this exercise are in the /u/QV431/ex3 directory.
The syntax of the nice command is: nice -n <increment> <command>
» # cd /u/QV431/ex3
» # nice -n 5 ./cpuprog
__ 12. In another window, verify the nice value by running the ps -el command. Is the
nice value 25? If not, check the syntax of the nice command. Remember the -n flag
indicates the increment to the default nice value (20 for foreground processes).
» # ps -el | grep cpuprog
» The output should be similar to the following:
200001 A 0 315580 339998 120 139 25 9b6c480 92 pts/0 0:15 cpuprog
__ 14. Start the cpuprog process again, in the background, with an initial nice value of 30.
Then, verify the nice value by running the ps -el command. Remember the
default nice value for background processes is 24.
Is the nice value 30? ________________
__ 16. Run the program called countem with an argument of 1000000000 (nine zeros) and
record how long it takes to run. The countem program is a simple program that
counts from 1 to whatever number is passed as an argument.
Use the shell’s built-in time command to get the timing information.
__ 18. Run the countem program again and time how long it takes. Run the countem
program with an argument of 1000000000 (nine zeros) again. Record how long it
takes to run.
Why does it take longer than before?
» It takes longer because it has to share CPU resources with the CPU-intensive
background jobs (cpuprog).
__ 19. Start the countem program again with higher priority in a way to make it complete
sooner. You will need to start it with the time command to see the results. Record
how long it takes to run.
__ 20. Assume you have no control of how a program is started or the program has already
started and you cannot restart it. How can you make this program complete sooner
after it has already started?
What command should you use? ___________________________________
» The renice command can be used to alter the nice value of a running
process.
EXempty __ 21. Kill the cpuprog processes that are running in background.
» # kill <PID>
» # kill <PID>
» Use the PIDs you discovered in the ps command.
» Yes, It is possible to see both sides running concurrently and also see an
equivalent amount of output (... [left/right] using CPU...) on both sides.
__ 23. Open another window and change the nice value to 33 of one of the usingcpu
processes (left or right) started in the last step. Observe the behavior.
» # renice -n 9 <PID>
» Use the ps -el | grep usingcpu command to get the PID number.
» The other session, where the usingcpu programs are running, should be
similar to the following:
Are you able to see any difference in CPU utilization of both processes? _______
» Yes, It is possible to see one side using more CPU (more output lines).
__ 25. Run the psformultithread script and examine the output. The psformultithread
script first runs the multithread process that creates 8 threads, then issues the
ps -emo THREAD command to display a line for each thread of the multithread
process.
# ./psformultithread
Do the threads belonging to the same process have the same priority? _______
» The output should be similar to the following:
the multithread process has been started.
the primary process' thread creates 8 additional threads.
collecting threads information of the multithread process, please wait ...
- - - 323819 R 54 87 0 - 400000 - - -
EXempty - - - 536707 R 55 87 0 - 400000 - - -
- - - 733245 R 55 87 0 - 400000 - - -
- - - 1233083 R 54 87 0 - 400000 - - -
- - - 1286179 R 55 87 0 - 400000 - - -
- - - 1531915 R 52 86 0 - 400000 - - -
- - - 1568775 R 55 87 0 - 400000 - - -
- - - 1728603 R 53 86 0 - 400000 - - -
- - - 1269795 R 0 60 1 - 400000 - - -
» The threads do not necessarily have the same priority. Each thread could
potentially have a different priority, scheduling policy, and CPU consumption.
Part 2 - Monitoring use of CPU with ps, vmstat, sar, and topas
In this section of the exercise, you will use the vmstat and sar command to monitor
CPU usage.
Steps
__ 26. If you are not already logged in, login to your assigned system as the root user.
__ 29. Run the psforcpuprog script to display the priority and CPU utilization values. The
psforcpuprog script issues the ps -ef command in an infinite loop.
# ./psforcpuprog
» The output should be similar to the following:
» In the example output above, the priority (PRI) is staying in the 100-135 range
and the CPU utilization value (C) is staying in the 60-120 range.
__ 30. In the window where the psforcpuprog script is not running, change the nice
values of each of the cpuprog programs to 20.
» # renice -n -4 <PID>
» # renice -n -4 <PID>
» # renice -n -4 <PID>
» # renice -n -4 <PID>
» Use whatever PIDs you discovered in the ps command.
__ b. What difference in priorities do you see between the last step and this step?
» Once the nice value is at 20, you will notice that the priority (PRI) is now
staying in the 90-120 range, it does not get as numerically high as it did when
the nice value was 24. The reason for this is because AIX penalizes threads
more (decreases the effective priority) if they have a nice value greater than
20.
» The schedo command can be used to tune the penalty algorithm.
EXempty __ 33. Use the ps aux and topas commands to determine what process(es) are
consuming the most CPU time.
• The ps aux command uses the Berkeley standard and displays information
about all processes which includes USER, PID, %CPU, %MEM, SZ, RSS, TTY, STAT,
STIME, TIME, and COMMAND fields.
# ps aux | head -10
» The output should be similar to the following:
USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
root 319628 12.5 0.0 92 96 pts/0 A 19:27:51 3:23 ./cpuprog
root 106506 12.4 0.0 92 96 pts/0 A 19:27:56 3:20 ./cpuprog
root 139464 12.4 0.0 92 96 pts/0 A 19:27:54 3:20 ./cpuprog
root 393242 12.3 0.0 92 96 pts/0 A 19:27:52 3:20 ./cpuprog
pconsole 245928 0.0 7.0 54148 54152 - A 15:17:38 0:13 /usr/java5/bin/j
root 8196 0.0 0.0 384 384 - A 15:17:06 0:12 wait
root 49176 0.0 0.0 384 384 - A 15:17:06 0:07 wait
root 311450 0.0 5.0 41420 41424 - A 15:17:32 0:06 /usr/java5/bin/j
root 262316 0.0 0.0 600 628 - A 15:17:32 0:03 /usr/sbin/getty
• The topas command reports selected statistics about the activity on the local
system.
The topas command uses the curses library to display its output in a format
suitable for viewing on an 80x25 character-based display or in a window of at
least the same size on a graphical display. You may need to set the TERM
environment variable if topas formatting looks strange (for example: export
TERM=vt220).
# topas
__ a. Are the results from the two commands the same? _____________________
» Yes, they are similar, at least in terms of the most CPU usage.
__ b. Which processes are using the most CPU time at this moment?
» The four cpuprog processes are using the most CPU time.
Steps
__ 35. If you are not already logged in, login to your assigned system as the root user.
__ 37. Make sure four instances of the cpuprog program are still running in background. If
not, start them.
» # ./cpuprog &
» # ./cpuprog &
» # ./cpuprog &
» # ./cpuprog &
__ b. What is the percentage of the time the run queue is occupied? ___________
» # sar -q 2 4
» The output should be similar to the following:
AIX rand212 1 6 00066C32D900 02/28/09
__ 39. Now, use the vmstat command to obtain the number of threads on the run queue.
Notice that both the sar and vmstat commands can be used to obtain the same
type of information.
» # vmstat 2 4
» The output should be similar to the following:
System configuration: lcpu=1 mem=1024MB ent=0.40
Steps
__ 40. If you are not already logged in, login to your assigned system as the root user.
__ 42. Make sure four instances of the cpuprog program are still running in background. If
not, start them.
» # ./cpuprog &
» # ./cpuprog &
» # ./cpuprog &
» # ./cpuprog &
__ 43. Use the sar command to get the average CPU utilization.
» sar -u 2 4
» The output should be similar to the following:
AIX rand212 1 6 00066C32D900 02/28/09
__ 44. Explain the meaning of the following fields from the sar command:
__ a. %sys
» Reports the percentage of time the processor or processors spent in
execution at the system (or kernel) level.
__ b. %usr
» Reports the percentage of time the processor or processors spent in
execution at the user (or application) level.
__ c. %wio
» Reports the percentage of time the processor(s) were idle during which the
system had outstanding disk/NFS I/O request(s). See detailed description
above.
__ d. %idle
» Reports the percentage of time the processor or processors were idle with no
outstanding disk I/O requests.
__ 45. Now, use the vmstat and topas commands to obtain the CPU utilization.
» # vmstat 5 5
» The output should be similar to the following:
System configuration: lcpu=1 mem=1024MB ent=0.40
EXempty » # topas
» The output should be similar to the following:
Topas Monitor for host: rand212 EVENTS/QUEUES FILE/TTY
Sat Feb 28 20:09:29 2009 Interval: 2 Cswitch 261 Readch 33
Syscall 951.2K Writech 188
CPU User% Kern% Wait% Idle% Physc Entc Reads 951.1K Rawin 0
ALL 22.4 77.6 0.0 0.0 1.00 249.8 Writes 1 Ttyout 122
Forks 0 Igets 0
Network KBPS I-Pack O-Pack KB-In KB-Out Execs 0 Namei 16
Total 0.2 0.6 0.4 0.0 0.1 Runqueue 4.0 Dirblk 0
Waitqueue 0.0
Disk Busy% KBPS TPS KB-Read KB-Writ MEMORY
Total 0.8 6.0 1.2 0.0 6.0 PAGING Real,MB 1024
Faults 0 % Comp 65.5
FileSystem KBPS TPS KB-Read KB-Writ Steals 0 % Noncomp 13.3
Total 0.1 1.0 0.0 0.1 PgspIn 0 % Client 13.3
PgspOut 0
Name PID CPU% PgSp Owner PageIn 0 PAGING SPACE
cpuprog 139464 25.5 0.1 root PageOut 0 Size,MB 512
cpuprog 106506 24.8 0.1 root Sios 0 % Used 1.1
cpuprog 393242 24.6 0.1 root % Free 99.9
cpuprog 319628 24.6 0.1 root NFS (calls/sec)
getty 262316 0.1 0.5 root SerV2 0 WPAR Activ 0
topas 315484 0.0 1.3 root CliV2 0 WPAR Total 0
java 245928 0.0 52.8 pconsole SerV3 0 Press: "h"-help
errdemon 110662 0.0 0.6 root CliV3 0 "q"-quit
gil 57372 0.0 0.9 root
java 311450 0.0 40.4 root
rpc.lock 237716 0.0 1.2 root
rmcd 241806 0.0 2.6 root
tracelog 323674 0.0 0.7 root
xmgc 45078 0.0 0.4 root
sendmail 147544 0.0 1.1 root
syslogd 118956 0.0 0.3 root
aixmibd 143490 0.0 1.1 root
netm 53274 0.0 0.4 root
syncd 131204 0.0 0.5 root
pilegc 40980 0.0 0.6 root
Steps
__ 48. If you are not already logged in, login to your assigned system as the root user.
__ 49. Run the smtctl command to see whether SMT is enabled or disabled.
» # smtctl
» The output should be similar to the following:
This system is SMT capable.
SMT is currently disabled.
SMT boot mode is set to disabled.
SMT threads are bound to the same virtual processor.
__ 50. If the SMT is currently enabled, run the command smtctl -m off to disable the
SMT capability.
» # smtctl -m off
» The output should be similar to the following:
smtctl: SMT is now disabled. It will persist across reboots if
you run the bosboot command before the next reboot.
EXempty
CPU Consumption Times (SMT off)
real
user
sys
real 0m27.95s
user 0m27.84s
sys 0m0.00s
__ 52. Now, run the command smtctl -m on to enable the SMT capability.
» # smtctl -m on
» The output should be similar to the following:
smtctl: SMT is now enabled. It will persist across reboots if
you run the bosboot command before the next reboot.
__ 53. With SMT enabled, run the multithread program again and record its time.
created thread 2
created thread 3
created thread 4
created thread 5
created thread 6
created thread 7
waiting for threads to complete ...
real 0m18.29s
user 0m18.22s
sys 0m0.00s
__ 54. Compare the real time with SMT disabled and SMT enabled.
Was the multithread program faster with SMT enabled or disabled? __________
» With SMT enabled, two logical processors are running on the same physical
processor, so this explains why the multithread command run faster when
SMT is active.
» This step shows an example of where SMT is a benefit to performance. Tests
performed have shown various results with different types of workloads, from
slightly lower performance with some compute-intensive workloads to
significant performance gains with typical commercial workloads. You will
need to try your system’s workload with SMT to see if there is a benefit.
__ 55. Run the mpstat -s 3 command to display the SMT utilization. Leave it running
throughout this part of the exercise.
The mpstat command collects and displays performance statistics for all logical
processors in the system. If the -s flag is specified, mpstat displays SMT thread
utilization in an SMT enabled partition
While mpstat is running, continue to the next step.
» # mpstat -s 3
» The output should be similar to the following:
System configuration: lcpu=2 ent=0.4 mode=Uncapped
Proc0
0.36%
cpu0 cpu1
0.28% 0.08%
--------------------------------------------------------------------------------
Proc0
0.89%
cpu0 cpu1
0.80% 0.09%
--------------------------------------------------------------------------------
. . . < some output deleted >. . .
EXempty
__ 56. In another window, run the scripts 2Threads, 4Threads, and 8Threads sequentially
and record the utilization metrics. The 2Threads script starts a process that creates
two threads, the 4Threads script starts four threads, and the 8Threads script starts
eight threads.
Time of
Average cpu0 Average cpu1 Execution
Script
Percentage Percentage
(real time)
2Threads 50% 49% 0m14.19s
4Threads 50% 49% 0m27.34s
8Threads 50% 49% 0m54.64s
» The table above contains an example of the utilization metrics when SMT is
enabled.
» # ./2Threads
» The output of the 2Threads script should be similar to the following:
the multithread process has been started.
the primary process' thread creates 2 additional threads.
threads running...
real 0m14.19s
user 0m14.16s
sys 0m0.00s
» The output from mpstat while the 2Threads script was running should be
similar to the following;
-------------------------------------------------------------------------------
Proc0
99.97%
cpu0 cpu1
50.37% 49.60%
-------------------------------------------------------------------------------
» # ./4Threads
» The output of the 4Threads script should be similar to the following:
the multithread process has been started.
the primary process' thread creates 4 additional threads.
threads running...
real 0m27.34s
user 0m27.21s
sys 0m0.00s
» The output from mpstat while the 4Threads script was running should be
similar to the following;
-------------------------------------------------------------------------------
Proc0
99.97%
cpu0 cpu1
50.32% 49.65%
-------------------------------------------------------------------------------
» # ./8Threads
» The output of the 8Threads script should be similar to the following:
the multithread process has been started.
the primary process' thread creates 8 additional threads.
threads running...
real 0m54.64s
user 0m54.51s
sys 0m0.00s
» The output from mpstat while the 8Threads script was running should be
similar to the following;
-------------------------------------------------------------------------------
Proc0
99.97%
cpu0 cpu1
50.47% 49.50%
-------------------------------------------------------------------------------
__ 57. Make sure the mpstat command is still running in one window. Then in another
window, run the command smtctl -m off to disable the SMT capability. (If you try
to run mpstat with the -s flag when SMT is disabled, it will not work. mpstat must
already be running before you enable SMT.)
» # smtctl -m off
» The output should be similar to the following:
smtctl: SMT is now disabled. It will persist across reboots if
you run the bosboot command before the next reboot.
__ 58. With SMT disabled, run the 2Threads, 4Threads, and 8Threads scripts sequentially
and record the utilization metrics.
EXempty
Time of
Average cpu0 Average cpu1 Execution
Script
Percentage Percentage
(real time)
2Threads 99.96% 0% 0m20.75s
4Threads 99.96% 0% 0m41.44s
8Threads 99.96% 0% 1m23.21s
» The table above contains an example of the utilization metrics when SMT is
disabled.
» # ./2Threads
» The output of the 2Threads script should be similar to the following:
the multithread process has been started.
the primary process' thread creates 2 additional threads.
threads running...
real 0m20.75s
user 0m20.61s
sys 0m0.00s
» The output from mpstat while the 2Threads script was running should be
similar to the following;
-------------------------------------------------------------------------------
Proc0
99.96%
cpu0 cpu1
99.96% 0.00%
-------------------------------------------------------------------------------
» # ./4Threads
» The output of the 4Threads script should be similar to the following:
the multithread process has been started.
the primary process' thread creates 4 additional threads.
threads running...
real 0m41.44s
user 0m41.31s
sys 0m0.00s
» The output from mpstat while the 4Threads script was running should be
similar to the following:
-------------------------------------------------------------------------------
Proc0
99.96%
cpu0 cpu1
99.96% 0.00%
-------------------------------------------------------------------------------
» # ./8Threads
» The output of the 8Threads script should be similar to the following:
the multithread process has been started.
the primary process' thread creates 8 additional threads.
threads running...
real 1m23.21s
user 1m22.95s
sys 0m0.00s
» The output from mpstat while the 8Threads script was running should be
similar to the following;
-------------------------------------------------------------------------------
Proc0
99.96%
cpu0 cpu1
99.96% 0.00%
-------------------------------------------------------------------------------
__ 59. Compare the utilization metrics in both cases (SMT enabled and SMT disabled).
How does SMT affect the overall performance in multi-thread processes?
» This step shows other example of where SMT is a benefit to performance.
Also, it show how the threads are distributed among the logical processors.
Steps
__ 61. If you are not already logged in, login to your assigned system as the root user.
__ 63. Run the sar -P ALL -f sar.bin command to extract the CPU activity for all
processors. Answer the following questions:
Question Answer
Average percentage of time the
processor(s) spent in execution at the Around 70%
user level
Average percentage of time the
processor(s) spent in execution at the Around 30%
system level
Average percentage of time the
processor(s) were idle with no 0%
outstanding disk I/O requests
Average percentage of time the
processor(s) were idle during which
0%
the system had outstanding disk/NFS
I/O request(s)
__ 64. What conclusion can be drawn from the previous step? Is the machine CPU bound
or I/O bound?
» The machine is CPU bound since 100% of the CPU utilization is spent on
user level and system (kernel) levels.
__ 65. Run the sar -q -f sar.bin command to display queue statistics. Answer the
following questions:
Question Answer
Average number of kernel threads in
Around 100 threads
the run queue
Average percentage of the time the
Around 95%
run queue is occupied
__ 66. What conclusion can be drawn from the previous step? Is the machine overloaded?
» Yes, the machine seems overloaded, since almost 100% of the time the run
queue is occupied.
__ 67. Examine the contents of the monitor.sum file and identify the three processes with
the largest CPU consumption value shown in the AFTER TIME column.
» # more monitor.sum
» No, these three processes: gil, lrud, and dsmc are not responsible for the
massive CPU utilization.
• gil is a kernel process, which does TCP/IP activities, such as timing,
handles transmission errors, and ACKs. Normally, it should not consume
too much CPU. The total time represents the CPU time consumed since
TCP/IP has started.
• lrud is a kernel process responsible for scanning file pages in memory
and freeing those not recently accessed (LRU - Least Recently Used).
Normally, it should not consume too much CPU. The total time represents
the CPU time consumed since AIX has started.
• dsmc is used by Oracle to backup multiple files. Normally, it should not
consume too much CPU. The total time represents the CPU time
consumed since Oracle has started.
__ 69. Examine the contents of the monitor.sum file again and identify the processes that
used the most time during the sampling interval (see difference between AFTER
TIME and BEFORE TIME).
EXempty Note: In order to avoid too many lines in the table collect only the intervals bigger
than 9 seconds.
Interval Time
Processes BEFORE TIME AFTER TIME
(> :09)
oracle 0:09 0:19 :10
oracle 3:58 4:08 :10
emagent 13:14 13:42 :18
oracle 7:42 7:55 :13
oracle 1:12 1:24 :12
oracle 0:18 0:28 :10
oracle 3:43 4:06 :23
oracle 0:06 0:17 :11
oracle 0:55 1:05 :10
oracle 2:46 3:03 :17
oracle 3:16 3:29 :13
oracle 0:11 0:21 :10
oracle 0:28 0:40 :12
oracle 1:36 1:48 :12
oracle 0:09 0:19 :10
oracle 2:32 2:42 :10
oracle 0:07 0:17 :10
oracle 1:57 2:08 :11
oracle 0:17 0:29 :12
oracle 0:15 0:25 :10
nmon12a_aix61 0:08 0:18 :10
oracle 3:34 3:50 :16
» The table above has been filled in with the acquired interval times.
» # more monitor.sum
» The output shows the following:
DELTA DELTA DELTA DELTA DELTA DELTA BEFORE AFTER
PID PGIN SIZE RSS TRS DRS C TIME TIME CMD
0 0 0 0 0 0 0 17:00 17:02 swapper
1 0 0 0 0 0 0 0:24 0:24 init
8196 0 0 0 0 0 0 17:04 17:04 wait
12294 0 0 0 0 0 0 0:31 0:31 sched
16392 0 0 0 0 0 0 252:18 252:18 lrud
. . . < some output deleted >. . .
1446008 0 1656 1656 0 1656 -6 3:58 4:08 oracle
. . . < some output deleted >. . .
1888500 0 1360 74388 0 74388 1 13:14 13:42 emagent
. . . < some output deleted >. . .
7573680 0 128 128 0 128 -1 0:08 0:18 nmon12a_aix61
. . . < some output deleted >. . .
END OF LAB
Introduction
This exercise covers the monitoring of memory usage statistics. You
will use some monitoring tools such as vmstat and svmon. Also, you
will use the vmo command to manage VMM tunable parameters.
Exercise Objectives
At the end of the lab, you should be able to:
• Observe the memory utilization
• Monitor the VMM free list
• Use svmon to monitor the amount of memory in use
• Analyze memory related PerfPMR files
References
More information about the commands in this exercise are
available from the IBM Systems Information Center:
http://publib.boulder.ibm.com/infocenter/systems/index.jsp
© Copyright IBM Corp. 2009 Exercise 4. Virtual Memory Performance Monitoring 4-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
EXempty Part 1 - Observing memory utilization, file pages, and free list
In this section of the exercise, you will examine some statistics and tunables maintained
by the Virtual Memory Manager.
Steps
__ 1. Login to your assigned system as the root user.
__ 3. What are the current values for the following statistics maintained by VMM?
© Copyright IBM Corp. 2009 Exercise 4. Virtual Memory Performance Monitoring 4-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
__ 4. What are the current values for the following non-restricted tunables maintained by
VMM?
» If the -I flag is specified, an I/O oriented view is presented with the following
column changes:
kthr: The column p (number of threads waiting on I/O to raw devices per
second) will also be displayed beside columns r (average number of
runnable kernel threads) and b (average number of kernel threads placed in
wait queue).
EXempty page: The columns fi (file page-ins per second) and fo (file page-outs per
second) will be displayed instead of the re (pager input/output list) and cy
(clock cycles by page-replacement) columns.
__ 6. Open another telnet window and run the ./readfiles script. Make sure you are in
/u/QV431/ex4 directory.
» # ./readfiles
» The output should be similar to the following:
cat: 0652-050 Cannot open /usr/bin/perfpmr.sh.
__ 7. While readfiles is running, watch the vmstat -I 3 output from your other window.
» The vmstat output should be similar to the following:
kthr memory page faults cpu
-------- ----------- ------------------------ ------------ -----------------------
r b p avm fre fi fo pi po fr sr in sy cs us sy id wa pc ec
1 0 0 170520 53399 0 0 0 0 0 0 0 19 153 0 0 99 0 0.00 0.8
1 0 0 171230 52202 482 0 0 0 0 0 128 23709 917 10 23 62 5 0.14 33.8
2 0 0 171660 48232 2551 0 0 0 0 0 306 125544 14385 30 65 4 0 0.61 151.5
1 1 0 172073 39306 4411 0 0 0 0 0 342 135334 15292 30 66 4 0 0.67 166.3
1 0 0 172729 36093 2594 0 0 0 0 0 331 150969 18117 30 65 4 0 0.68 169.6
1 1 0 173216 34075 2010 0 0 0 0 0 293 147842 16638 31 65 4 0 0.68 171.1
2 1 0 173694 28202 3666 0 0 0 620 4391 298 131191 40066 27 65 7 0 0.68 169.2
1 1 0 173874 11971 7295 0 0 0 1027 5720 333 79772 34076 25 67 7 1 0.46 114.7
2 1 0 174429 11981 1861 0 0 0 446 929 308 188155 45979 29 63 7 0 0.80 200.4
1 1 0 175092 11308 2005 0 0 0 263 1222 318 189938 25141 31 64 5 0 0.81 202.4
1 0 0 175687 10707 2016 0 0 0 256 454 318 192673 21363 31 65 4 0 0.80 201.0
1 1 0 176203 8452 2533 0 0 0 616 15834 338 129689 24559 29 65 5 0 0.64 160.8
__ 9. When readfiles finishes, what are the values for the following?
What changed?
© Copyright IBM Corp. 2009 Exercise 4. Virtual Memory Performance Monitoring 4-5
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
__ 10. Use vmo to display help about the minfree and maxfree non-restricted tunables.
» # vmo -h minfree
» The output should be similar to the following:
Help for tunable minfree:
Purpose:
Specifies the number of frames on the free list at which the VMM starts to steal pages to
replenish the free list.
Values:
Default: 960
Range: 8 - 209715
Type: Dynamic
Unit: 4KB pages
Tuning:
Page replacement occurs when the number of free frames reaches minfree.
EXempty If processes are being delayed by page stealing, increase minfree to improve response
time. The difference between maxfree and minfree should be of the order of maxpgahead, and
no less than 8.
» # vmo -h maxfree
» The output should be similar to the following:
Help for tunable maxfree:
Purpose:
Specifies the number of frames on the free list at which page-stealing is to stop.
Values:
Default: 1088
Range: 16 - 209715
Type: Dynamic
Unit: 4KB pages
Tuning:
Observe free-list-size changes with vmstat n.
If vmstat n shows free-list size frequently driven below minfree by application demands,
increase maxfree to reduce calls to replenish the free list. Setting the value too high
causes page replacement to run for a longer period of time. The difference between
maxfree and minfree should be of the order of maxpgahead, and no less than 8.
__ 11. Use vmo to display the current value of the minfree and maxfree non-restricted
tunables.
» # vmo -o maxfree
» The output should be similar to the following:
maxfree = 1088
» # vmo -o minfree
» The output should be similar to the following:
minfree = 960
__ 12. Make sure the vmstat command is still running in one session.
» # vmstat -I 3
__ 13. In another telnet window, run the ulimit command to set the soft user resource limit
for the data area to be unlimited. Then, run the memory-eater program in the
background.
# ulimit -d unlimited
» If the command is successful, there will not be any messages or output.
© Copyright IBM Corp. 2009 Exercise 4. Virtual Memory Performance Monitoring 4-7
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
# ./memory-eater &
» The output should be similar to the following:
[1] 348402
Allocating memory
__ 14. While memory-eater and vmstat are running, set maxfree to 16 and minfree to 8.
» # vmo -o minfree=8
» The output should be similar to the following:
Setting minfree to 8
» # vmo -o maxfree=16
» The output should be similar to the following:
Setting maxfree to 16
__ 15. Kill the memory-eater process running in background and observe memory and
paging activities.
What happened?
» # kill %1
» The size of the free list (fre) increased because of the termination of the
processes. The paging activity should remain low because there is no need
for paging replacement activities.
EXempty __ 16. Use the vmo command to set maxfree and minfree back to their default values.
» # vmo -p -d maxfree
» The output should be similar to the following:
Setting maxfree to 1088 in nextboot file
Setting maxfree to 1088
» # vmo -p -d minfree
» The output should be similar to the following:
Setting minfree to 960 in nextboot file
Setting minfree to 960
__ 18. Use the vmo command to set the maximum percentage of RAM that can be used for
caching client pages (maxclient%) to 10.
Why did you get a warning message?
» # vmo -o maxclient%=10
» The output should be similar to the following:
Setting maxclient% to 10
Warning: a restricted tunable has been modified
» Many AIX 6.1 tunables are now classified as restricted. Restricted tunables
are parameters which should not be changed unless recommended by AIX
development or support teams.
__ 19. Use the vmo command to reset all VMM tunables to their default value.
» # vmo -D
© Copyright IBM Corp. 2009 Exercise 4. Virtual Memory Performance Monitoring 4-9
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
Steps
__ 20. If you are not already logged in, login to your assigned system as the root user.
__ 22. Run the svmon -G command to display a global report of virtual memory usage
statistics, and record the following values:
EXempty
__ 23. Run the memory-eater program in the background and record the PID of the
process.
PID of the memory-eater
process
» # ./memory-eater &
» The output should be similar to the following:
[1] 487496
# Allocating memory
__ 24. While the memory-eater program is running, open another telnet window and run
the svmon -G command again. Record the values from the current output and
compare and record them to the last values (before memory-eater).
© Copyright IBM Corp. 2009 Exercise 4. Virtual Memory Performance Monitoring 4-11
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
__ 25. Using the svmon -G output in the last step, is memory over committed?
» The svmon -G output should be similar to the following:
size inuse free pin virtual
memory 262144 179496 82648 114998 225955
pg space 131072 48647
Steps
__ 27. If you are not already logged in, login to your assigned system as the root user.
__ 29. Examine the content of the svmon_G.out file and record information about the
memory:
» # cat svmon_G.out
» The output is:
size inuse free pin virtual
memory 2031616 1807869 223747 1059822 2137826
pg space 3145728 621384
» Remember: the size metric displays the memory consumption (size) and of
free pages (free) in the default page size (4 KB).
© Copyright IBM Corp. 2009 Exercise 4. Virtual Memory Performance Monitoring 4-13
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
__ 30. The customer reported slow performance in this system. The run queue size and
disk I/O bandwidth are considered normal over time (the PerfPMR baseline data
was used to confirm this information). The initial baseline data has not reported any
irregular paging activity.
Run the sar -r -f sar.bin command to obtain paging activity during this period of
time and look at the output.
# sar -r -f sar.bin
Can you see any abnormal paging activity now? _______________________
» The output is:
System configuration: lcpu=8 mem=7936MB mode=Capped
» Yes, there is a consistent paging activity in the system which means that
configured memory for this partition is not adequate to the current workload.
__ 31. What application is using the most memory? Look at the SZ column in the psa.elfk
report. The SZ column display the size in 1 KB units of the core image of the
process.
» # more psa.elfk
or to more easily see the processes using the most memory, use the
following sort command:
# sort -n -r -k 10 psa.elfk | more
» Using the more psa.elfk command, part of the output is:
# more psa.elfk
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD
303 A root 0 0 120 16 -- 31004110 384 Oct 07 - 29:05
swapper
200003 A root 1 0 0 60 20 19001400 720 Oct 07 - 0:31
/etc/init
__ 32. Analyze the contents of the svmon_P.out file which reports the memory usage
statistics for all processes.
__ a. What processes are using the most memory?
The svmon_P.out output is sorted based on memory use. The processes using
most memory is listed first, the process using least memory is listed last in the
output.
© Copyright IBM Corp. 2009 Exercise 4. Virtual Memory Performance Monitoring 4-15
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises with Hints
» # more svmon_P.out
» The output is:
-------------------------------------------------------------------------------
Pid Command Inuse Pin Pgsp Virtual 64-bit Mthrd 16MB
1024138 oracle 353367 224 379268 565707 Y N N
» Yes, it is consistent. The Oracle processes are using most of the memory.
The one listed first in the svmon_P.out file was fifth at the time the psa.elfk
report was created. (Remember, the svmon reports are just snapshots, so top
process using memory at the time one report was created may not be at the
top when the next process was created.)
» The system was reconfigured by adding more memory and the performance
got back to normal.
END OF LAB
Introduction
This exercise covers the monitoring of I/O performance. You will use
iostat, vmstat, sar, lvmstat, and filemon commands to
determine what bottleneck(s) you have on the system.
Exercise Objectives
At the end of the lab, you should be able to:
• Use the filemon utility
• Understand I/O wait
• Locate and fix I/O bottlenecks
• Work with synchronous writes
• Display and correct fragmentation
References
More information about the commands in this exercise are
available from the IBM Systems Information Center:
http://publib.boulder.ibm.com/infocenter/systems/index.jsp
__ 2. Run the lsdev -Cc disk command to display information about the disk devices
configured in your class lab system.
» # lsdev -Cc disk
» The output should be similar to the following:
hdisk0 Available Virtual SCSI Disk Drive
hdisk1 Available Virtual SCSI Disk Drive
hdisk2 Available Virtual SCSI Disk Drive
» Your lab system is configured with virtual SCSI disks provided by a Virtual I/O
Server partition.
__ c. The number of writes to the wseq.out file should be 30000. If it is less than
30000, what could be the problem?
EXempty
2801712 events were lost. Reported data may have inconsistencies or errors.
» Some events were probably lost and the number of writes to wseq.out was
probably less than 30000. The reason is likely that the trace buffer was not
large enough to capture all the events and missed some write activity to the
wseq.out file.
__ 8. Run the filemon command again, but this time specify the trace buffer size. The -T
flag sets the kernel's trace buffer size. The default size is 64000 bytes per CPU. Try
setting it to 10240000.
# filemon -O detailed,lf,lv,pv -T 10240000 -o fmon1.out
Note: The I/O activity will be written into the fmon1.out file.
__ 10. Stop recording the trace events by issuing the trcstop command.
» # trcstop
» The output should be similar to the following:
# [filemon: Reporting started]
[filemon: Reporting completed]
__ 11. Look at the fmon1.out file that you have just generated.
__ a. Were any events lost? _____________
» Depending on the activity of your system between the time you started
filemon and stopped it with the trcstop command, the number of writes to
wseq.out should be 30000 (or at least more than it was the first time). Ideally,
there should not be any missing events.
__ 12. Now, examine the pre-generated PG-fmon.out file, and answer the following
questions.
__ a. Which is the most active file? ___________________________
» wseq.out
__ d. How sequential were the logical volume writes for the most active logical
volume?
» In the Detailed Logical Volume Stats report, look for the number of write
sequences compared to the number of writes.
In this example, there were 7 write sequences for 118 writes.
__ e. How sequential were the physical volume writes for the most active physical
volume?
» In the Detailed Physical Volume Stats report, look for the number of write
sequences compared to the number of writes.
In this example, there were 55 write sequences for 169 writes.
__ f. How many writes have taken place to the wseq.out file? _______________
» In the Detailed File Stats report, look for the number of writes.
In this example, there were 30000 writes.
__ g. What is the average time of the writes to the wseq.out file? _____________
» In the Detailed File Stats report, look for the write times (msec).
In this example, the average of each write is 0.006 milliseconds.
» # more PG-fmon.out
» The output should be the following:
Mon Mar 2 15:31:44 2009
System: AIX 6.1 Node: woolf221 Machine: 00066BD2D900
------------------------------------------------------------------------
Detailed File Stats
------------------------------------------------------------------------
FILE: /var/adm/SRC/active_list.tmp
opens: 1
total bytes xfrd: 3597
writes: 1 (0 errs)
write sizes (bytes): avg 3597.0 min 3597 max 3597 sdev 0.0
write times (msec): avg 0.024 min 0.024 max 0.024 sdev 0.000
------------------------------------------------------------------------
Detailed Logical Volume Stats (512 byte blocks)
------------------------------------------------------------------------
writes: 33 (0 errs)
write sizes (blks): avg 8.0 min 8 max 8 sdev 0.0
write times (msec): avg 4.318 min 1.849 max 8.239 sdev 1.566
write sequences: 26
write seq. lengths: avg 10.2 min 8 max 16 sdev 3.5
seeks: 26 (78.8%)
seek dist (blks): init 146272,
avg 8.0 min 8 max 8 sdev 0.0
time to next req(msec): avg 2018.539 min 2.628 max 19667.146 sdev 4882.094
throughput: 2.0 KB/sec
utilization: 0.00
------------------------------------------------------------------------
Detailed Physical Volume Stats (512 byte blocks)
------------------------------------------------------------------------
Steps
__ 13. Open two telnet windows, login as root, and change your directory to /u/QV431/ex5.
__ 14. Run the vmstat -I 3 command to display the I/O oriented view and leave it running
throughout this part of the exercise (Part 2 - Understanding I/O Wait).
There should not be any programs running from previous exercises, so there should
not be any CPU activity. Take a look at the percentage of CPU idle (id column must
be near 100%).
» # vmstat -I 3
» The output should be similar to the following:
System configuration: lcpu=1 mem=1024MB ent=0.40
Note: Your class lab system is a logical partition which uses a subset of a
computer's hardware resource. In a LPAR environment, the vmstat command
reports the number of physical processors consumed (pc), and the percentage of
entitlement consumed (ec).
While vmstat is running, continue to the next step.
__ 15. In the second telnet window, run the I/O intensive script named iowait in
background, as follows:
# ./iowait &
» The output should be similar to the following:
[1] 626712
EXempty
__ 16. While iowait is running, watch the vmstat -I 3 output and record the following
information from the vmstat output. Try to pick a number that is the average over the
reported intervals.
Note: You may need to wait few minutes until you see some I/O wait (wa) activity.
What is your interpretation of the results? Is the system CPU or I/O bound?
» The CPUs were busy 68% of the time (us + sy), so this indicates the system
is not CPU bound. We see that 14% is in I/O wait and 18% is idle. Does this
mean the system is overloaded? The answer is no, but if the I/O completed
faster that would provide a better overall performance.
__ 17. Make sure the vmstat -I 3 command and the iowait script are still running.
__ 18. Run the CPU intensive program named cpuprog in background, as follows:
# ./cpuprog &
__ 19. Record the following information from the vmstat output. Try to pick a number that is
the average over the reported intervals:
Statistics % Average
User (us) 17
System (sy) 83
Idle (id) 0
I/O wait (wa) 0
» The table above has been filled in with examples from a sample system.
What is your interpretation of the results? Is the system CPU or I/O bound?
1 1 0 214659 5362 8142 7949 0 0 10937 22045 448 899409 11361 17 83 0 0 1.00 249.8
1 1 0 214659 4337 7758 7597 0 0 12597 27727 443 897097 13043 17 83 0 0 1.00 249.9
1 1 0 214659 4323 8014 7795 0 0 13509 27083 465 893665 14024 17 83 0 0 1.00 249.9
1 1 0 214659 4397 8100 7974 0 0 14048 24688 417 893099 14412 17 83 0 0 1.00 249.9
1 1 0 214659 4271 7938 7846 0 0 13966 24598 442 891612 14460 17 83 0 0 1.00 249.9
1 1 0 214659 4210 7811 7636 0 0 13818 28161 428 896258 14242 17 83 0 0 1.00 250.2
» When the iowait script is the only job running, the I/O wait value is around
14% and idle is around 18%. As soon as the cpuprog program starts, the I/O
wait and idle time drops to 0%. Why? Because the system has something to
do (running the CPU intensive cpuprog program) while the I/Os are waiting to
complete.
EXempty » The user time has gone up from 2% to 17% and the system time has gone up
from 66% to 83%. Why has the system time increased too? Because the
number of system calls has increased.
» Is the system overloaded? The answer is probably yes - the system is now
CPU bound.
__ 20. Kill the iowait script and the cpuprog program that are running in background.
» # kill %1 ; kill %2
» The output should be similar to the following:
[2] + Terminated ./cpuprog &
[1] + Terminated ./iowait &
__ 22. If you are not already logged in, login to your assigned system as the root user and
change your directory to /u/QV431/ex5.
__ 23. A customer reports that the average application server response time has not
improved after a processor upgrade. Based on this description, we suspect some
kind of I/O problem.
The following table shows the current application I/O environment:
__ 24. Examine the pre-generated iostat and sar reports (PG-iostat.before and
PG-sar.before files, respectively) and answer the following questions.
__ a. What does the iostat report indicate?
EXempty » The iostat report indicates an I/O bottleneck on hdisk0 (% tm_act column =
100%)
» # more PG-iostat.before
System configuration: lcpu=2 drives=7 paths=6 vdisks=0
» # more PG-sar.before
AIX woolf221 1 6 00066BD2D900 02/20/09
__ 25. Examine the pre-generated lvmstat and filemon reports (PG-lvmstat.before and
PG-filemon.before files, respectively) and answer the following questions.
» # more PG-lvmstat.before
Logical Volume iocnt Kb_read Kb_wrtn Kbps
lv2 19663 0 314596 2.83
lv1 4326 0 69204 0.62
loglv00 1007 0 4028 0.04
hd8 12 0 48 0.00
hd9var 2 0 8 0.00
hd11admin 0 0 0 0.00
hd10opt 0 0 0 0.00
hd1 0 0 0 0.00
hd3 0 0 0 0.00
hd2 0 0 0 0.00
hd4 0 0 0 0.00
paging00 0 0 0 0.00
hd6 0 0 0 0.00
hd5 0 0 0 0.00
» # more PG-filemon.before
Fri Feb 20 16:06:09 2009
System: AIX 6.1 Node: woolf221 Machine: 00066BD2D900
__ a. What did you find on the lvmstat report regarding the I/O operations on logical
volumes?
» The majority of the I/O operation are on the lv1 and lv2 logical volumes
(iocnt column).
__ b. What did you find on the filemon report regarding the I/O operations on logical
volumes?
» The majority of the I/O operation are on the lv1 and lv2 logical volumes
(#wblk column).
__ 26. Following the suggestion presented by the support team, the customer moved one
of the busiest logical volumes to another physical volume as described in the
following table:
Examine the new iostat, sar, and lvmstat reports. The PG-iostat.after,
PG-sar.after, and PG-lvmstat.after files contain these new reports.
Answer the following questions.
__ a. Did the situation improve?
EXempty
» Yes
» As seen in the iostat, sar, and lvmstat reports, the I/O transactions are
now split across two physical volumes, hdisk0 and hdisk1
» The throughput of both logical volumes is greater now than before (Kbps
column in the lvmstat report)
» # more PG-iostat.after
System configuration: lcpu=2 drives=7 paths=6 vdisks=0
» # more PG-sar.after
AIX woolf221 1 6 00066BD2D900 02/20/09
__ 27. If you are not already logged in, login to your assigned system as the root user and
change your directory to /u/QV431/ex5.
__ 28. A customer reports that the disk I/O throughput of the syncwrite program is not
satisfactory. The syncwrite program creates a sequential file using synchronous
writes.
This is the time of the execution of the syncwrite program:
Time
real 0m46.74s
user 0m0.01s
sys 0m0.16s
__ 29. Following the suggestion presented by the support team, the customer moved the
JFS2 log device to another physical disk, as described in the following table:
The situation has improved. Now, the syncwrite program runs much faster than
before, as you can see below:
Time
real 0m23.80s
user 0m0.01s
sys 0m0.15s
Examine the new filemon report stored in the PG-sync-filemon.after file and
answer the following questions.
» # more PG-sync-filemon.after
Sat Feb 21 12:17:36 2009
System: AIX 6.1 Node: woolf221 Machine: 00066BD2D900
» The I/O transactions are now split across two physical volumes, hdisk0
(syncfile) and hdisk1 (JFS2 log)
__ 30. If you are not already logged in, login to your assigned system as the root user and
change your directory to /u/QV431/ex5.
__ 31. Create a JFS file system named /fragfs on rootvg, then mount it. Use the following
commands:
# crfs -v jfs -g rootvg -a size=5M -a frag=512 -a nbpi=512 -m /fragfs
» The output should be similar to the following:
Based on the parameters chosen, the new /fragfs JFS file system
is limited to a maximum size of 16777216 (512 byte blocks)
# mount /fragfs
» If the command is successful, there will not be any messages or output.
__ 32. We have provided the mkfrag script which creates two types of fragmentation in the
/fragfs file system:
• File system fragmentation due to unused fragments smaller than a 4 KB block
• File fragmentation with poor sequentiality
The mkfrag script achieves this by creating files and then removing some of them. It
repeatedly issues a sync command to avoid the consolidation of written blocks that
often occurs with normal asynchronous I/O processing. You may (optionally) wish to
examine the script to see exactly what it does.
Run the script.
# ./mkfrag
__ 33. Check the fragmentation of your new file system using defragfs (query only) to see
the statistics before running defragfs.
# defragfs -q /fragfs
Question Answer
What is the number of free spaces shorter than a
100
block?
What is the number of free fragments in short free
318
spaces?
» The table above has been filled in with examples from a sample system.
__ 34. Use the fileplace command to examine /fragfs/file1 to determine the extent of
logical fragmentation.
# fileplace -v /fragfs/file1
» The output should be similar to the following:
File: /fragfs/file1 Size: 286720 bytes Vol: /dev/fraglv
Blk Size: 4096 Frag Size: 512 Nfrags: 560 Compress: no
Inode: 18 Mode: -rw-r--r-- Owner: root Group: sys
Logical Fragment
----------------
0004568-0004631 64 frags 32768 Bytes, 11.4%
0004640-0004655 16 frags 8192 Bytes, 2.9%
0006189-0006204 16 frags 8192 Bytes, 2.9%
0006208-0006271 64 frags 32768 Bytes, 11.4%
0007744-0007823 80 frags 40960 Bytes, 14.3%
0009253-0009268 16 frags 8192 Bytes, 2.9%
0009280-0009343 64 frags 32768 Bytes, 11.4%
0010784-0010863 80 frags 40960 Bytes, 14.3%
0012299-0012346 48 frags 24576 Bytes, 8.6%
0012352-0012383 32 frags 16384 Bytes, 5.7%
0013765-0013796 32 frags 16384 Bytes, 5.7%
0013824-0013871 48 frags 24576 Bytes, 8.6%
Question Answer
What is the space efficiency%? 6%
What is the sequentiality%? 98%
» The table above has been filled in with examples from a sample system.
__ 35. Defragment the file system to recover any small blocks using the following
command:
# defragfs /fragfs
» The output should be similar to the following:
Statistics before running defragfs:
Number of free fragments : 191649
Number of allocated fragments : 70495
Number of free spaces shorter than a block : 100
Number of free fragments in short free spaces : 318
Other statistics:
Number of fragments moved : 724
Number of logical blocks moved : 134
Number of allocation attempts : 125
Number of exact matches : 6
Examine the fragmentation statistics after the defragmentation, and report the
following:
Before After
Question
Defragmentation Defragmentation
What is the number of free spaces
100 11
shorter than a block?
What is the number of free
318 36
fragments in short free spaces?
» The table above has been filled in with examples from a sample system.
EXempty
__ 36. Was the defragfs effective in reducing the file system fragmentation?
» Yes, the defragfs command reduced the number of free spaces shorter than
a block and the number of free fragments in short free spaces.
__ 37. If you are not already logged in, login to your assigned system as the root user and
change your directory to /u/QV431/ex5.
__ 38. Backup the /fragfs file system by name to /tmp/fragfs.bkp. Use the following
command:
# find /fragfs | backup -iqf /tmp/fragfs.bkp
» If the command is successful, there will not be any messages or output.
__ 39. Remove all the files from the /fragfs file system.
» # cd /fragfs
» If the command is successful, there will not be any messages or output.
» # rm -rf ./*
» If the command is successful, there will not be any messages or output.
__ 40. Use the following command to restore all the files from the /fragfs backup:
# restore -xvqf /tmp/fragfs.bkp
» The output should be similar to the following:
x 2560 /fragfs/small109
EXempty x 2560 /fragfs/small110
The total size is 2288640 bytes.
The number of restored files is 125.
Logical Fragment
----------------
unallocated 8 frags 4096 Bytes, 0.0%
0004552-0004607 56 frags 28672 Bytes, 11.1%
. . . < some output deleted >. . .
» The table above has been filled in with examples from a sample system.
__ 42. If you are not already logged in, login to your assigned system as the root user and
change your directory to /u/QV431/ex5.
__ 43. Run the lslv command to look at the physical partition allocation of the hd2 logical
volume on the hdisk0 physical volume.
# lslv -p hdisk0 hd2
» The output should be similar to the following:
hdisk0:hd2:/usr
USED FREE FREE FREE FREE FREE FREE FREE FREE FREE 1-10
FREE FREE FREE FREE FREE FREE FREE FREE FREE FREE 11-20
FREE FREE FREE FREE FREE FREE FREE FREE FREE FREE 21-30
FREE FREE FREE FREE FREE FREE FREE FREE FREE FREE 31-40
FREE FREE FREE FREE FREE FREE FREE FREE FREE FREE 41-50
FREE FREE FREE FREE FREE 51-55
USED USED USED FREE FREE FREE FREE FREE FREE FREE 56-65
FREE FREE FREE FREE FREE FREE FREE FREE FREE FREE 66-75
FREE FREE FREE FREE FREE FREE FREE FREE FREE FREE 76-85
FREE FREE FREE FREE FREE FREE FREE FREE FREE FREE 86-95
FREE FREE FREE FREE FREE FREE FREE FREE FREE FREE 96-105
FREE FREE FREE FREE 106-109
USED USED USED USED 0001 0002 0003 0004 0005 0006 110-119
0007 0008 0009 0010 0011 0012 0013 USED USED USED 120-129
USED USED FREE FREE FREE FREE FREE FREE FREE FREE 130-139
FREE FREE FREE FREE FREE FREE FREE FREE FREE FREE 140-149
FREE FREE FREE FREE FREE FREE FREE FREE FREE FREE 150-159
FREE FREE FREE FREE 160-163
Note: The FREE blocks indicate that the physical partitions that are currently not
being used. The USED blocks indicate that the physical partitions are being used for
another logical volume. The blocks with a number indicate the logical partition
number of the logical volume specified with the lslv -p command. A
non-fragmented logical volume would have all its partitions be contiguous rather
than having partitions from other logical volumes interspersed between them.
EXempty
__ 45. If you see a logical volume that is physically fragmented, you can try to group the
partitions together using the reorgvg command. Assuming you have changed the
characteristics of multiple logical volumes, you can use the reorgvg command to
reorganize the logical volumes according to the new intra-allocation policies.
# reorgvg [VGname] [LVname]
» The output should be similar to the following:
# reorgvg rootvg hd2
0516-962 reorgvg: Logical volume hd2 migrated.
END OF LAB
backpg
Back page
®