Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
by
Peter Lee
IT Specialist
Performance Tuning Process
Indentify Workloads
Memory Network
CPUs I/O Subsystem
Subsystem Subsystem
Actions NO
Actions NO Actions
YES Is System NO
Network-Bound?
Actions Additonal
Actions
vmstat Command
vmstat Command Reports:
Summary of paging and system events since initialization (-s)
Number of forks since initilization (-f)
Device interrupts since initilization or per interval (-i)
Periodic reports of processes, paging, real memory, and CPU
Usage : vmstat [ -ifs ] [drives] [interval] [count]
vmstat 1 10
kthr memory page faults cpu
----- ----------- ------------------------ ------------ -----------
r b avm fre re pi po fr sr cy in sy cs us sy id wa
0 0 2514 24166 0 0 0 0 0 0 121 1 18 0 0 99 0
0 0 2514 24165 0 0 0 0 0 0 126 178 19 1 0 99 0
0 0 2514 24165 0 0 0 0 0 0 118 60 24 0 0 99 0
0 0 2514 24165 0 0 0 0 0 0 114 54 20 0 0 99 0
0 0 2514 24165 0 0 0 0 0 0 121 117 21 0 0 99 0
0 0 2514 24165 0 0 0 0 0 0 119 54 20 0 1 99 0
0 0 2514 24165 0 0 0 0 0 0 126 54 22 1 0 99 0
0 0 2514 24165 0 0 0 0 0 0 127 54 19 0 1 99 0
0 0 2514 24165 0 0 0 0 0 0 125 54 21 0 0 99 0
0 0 2514 24165 0 0 0 0 0 0 127 54 18 0 0 99 0
vmstat Command
root@bmserver[/tmp]>vmstat -i
re : the number of page reclaims per second observed in the sample interval. If a page fault occurs
and this page is currently on the freelist and has not yet been reused, this is considered a reclaim
since no new I/O request has to be initiated. This is not to be confused with the term repage which
refers to a page which has already incurred a page-fault (the page could be currently on the freelist,
filesystem, or in paging space).
pi or po : the number of page ins or page outs per second from/to paging space during the sample
interval
fr/sr : the number of pages per second that were freed/examined by the page replacement algorithm
during the interval
in/sy/cs : the number of device interrupts/system calls/thread context switches per second observed
in the interval
CPU : CPU utilization observed in the interval, divided into us-user, sy-system, id-idle, wa-wait
disk xfer the number of disk requests per second observed to the PV
topas Command
iostat Command
Hardware Dependent
root@bmserver[/tmp]>iostat
sar Command
Data Types
All data types collected; only specified data types reported on
sadc: back end for sar, responsible for the data collection
timex -s: displays sar statistics for the duration of the command
executed by timex
sar Command
e.g
Collection: sar -o filename 60 300 > /dev/null &
Extraction: sar -A -f filename
Extraction: sar -u -f filename -s 10:20 -e 14:50
Monitoring: sar -c 60 300
sar Command
Data Types:
-a file access system routines
-b buffer activity
-c system calls
-k kernel process statistics
-m message and semaphore activity
-q statistics on run queue and wait queue
-r paging statistics
-u CPU utilization
-v kernel tables: i-node, process and file
-w process switching activity
-y reports on tty statistics
-A Show all of the above
-P [processor_id[,...] | ALL] Show individual processor
utilization on SMP systems
sar Command
# sar -u 5 3
19:28:02 %usr %sys %wio %idle
19:28:07 0 6 0 94
19:28:12 1 4 0 95
19:28:07 7 4 0 90
Average 3 4 0 93
# sar -c 1 3
19:28:25 scall/s sread/s swrit/s fork/s exec/s rchar/s wchar/s
19:28:26 134 36 1 0.00 0.00 2691306 1517
19:28:27 46 34 1 0.00 0.00 2716922 1531
19:28:28 46 34 1 0.00 0.00 2716922 1531
Average 75 35 1 0.00 0.00 2708329 1527
# sar -q 5 3
19:31:42 runq-sz %runocc swpq-sz %swpocc
19:31:47 1.0 100 1.0 100
19:31:52 2.0 100 1.0 100
19:31:57 1.0 100 1.0 100
Average 1.3 95 1.0 95
ps Command
ps Command
The ps command writes the current status of active processes
and (if the -m flag is given) associated kernel threads to
standard output.
A new option to ps in AIX Version 4 shows if a process is
bound to a particular CPU. This option is -o THREAD. If you
see the -m option as well (-mo THREAD), then you can see the
thread or threads that belongs to each process.
Usage : ps [-Aaedfklm] [-n namelist] [-F Format] [-o
specifier[=header],...] [-p proclist][-G|-g grouplist] [-t termlist]
[-U|-u userlist]
Usage: ps [aceglnsuvwxU] [t tty] [processnumber]
ps Command
root@bmserver[/tmp]>ps -el
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
200003 A 0 1 0 0 60 20 2805 252 - 0:00 init
240001 A 0 2548 1 0 60 20 8831 68 5a6cf58 - 2:32 syncd
40401 A 0 2814 1 0 60 20 1923 276 95378 - 0:00 errdemon
240001 A 0 2902 1 0 60 20 921 244 - 0:00 srcmstr
240001 A 0 3528 1 0 60 20 d21a 168 54aeccc - 0:13 cron
240001 A 0 3694 2902 0 60 20 59eb 608 - 0:00 sendmail
240001 A 0 3968 2902 0 60 20 c9f9 984 - 0:42 snmpd
240001 A 0 4218 2902 0 60 20 a1f4 172 - 0:00 inetd
240001 A 0 4468 2902 0 60 20 79ef 292 - 0:00 portmap
240001 A 0 4712 2902 0 60 20 9e1 128 - 0:02 syslogd
240001 A 0 4998 2902 0 60 20 2204 468 - 0:00 dpid2
240001 A 0 5866 8424 0 60 20 5acb 348 pts/0 0:00 ksh
240001 A 0 6054 2902 0 60 20 8a11 68 - 0:00 biod
240001 A 0 6326 2902 0 60 20 4208 144 - 0:00 rpc.statd
240001 A 0 6598 2902 0 60 20 f21e 68 * - 0:03 rpc.lockd
240001 A 0 6858 1 0 60 20 1a23 32 9ec0170 - 0:00 install_as
200001 A 0 6932 5866 11 65 20 7acf 188 pts/0 0:00 ps
200001 A 0 8424 4218 2 61 20 82d0 268 - 0:00 telnetd
ps Command
root@bmserver[/tmp]>ps -emo THREAD
USER PID PPID TID ST CP PRI SC WCHAN F TT BND COMMAND
root 1 0 - A 0 60 1 - 200003 - 0 /etc/init
- - - 463 S 0 60 1 - 400 - 0 -
root 2548 1 - A 0 60 1 5a6cf58 240001 - 0 /usr/sbin/syncd 60
- - - 3325 S 0 60 1 5a6cf58 400 - 0 -
root 2814 1 - A 0 60 1 95378 40401 - 0 /usr/lib/errdemon
- - - 3335 S 0 60 1 95378 400 - 0 -
root 2902 1 - A 0 60 1 - 240001 - 0 /usr/sbin/srcmstr
- - - 2399 S 0 60 1 - 8400 - 0 -
root 3528 1 - A 0 60 1 54aeccc 240001 - 0 /usr/sbin/cron
- - - 3795 S 0 60 1 54aeccc 400 - 0 -
root 3694 2902 - A 0 60 1 - 240001 - 0 sendmail: accepting
connections
- - - 4727 S 0 60 1 - 8400 - 0 -
root 3968 2902 - A 0 60 1 - 240001 - 0 /usr/sbin/snmpd
- - - 4233 S 0 60 1 - 8400 - 0 -
root 4218 2902 - A 0 60 1 - 240001 - 0 /usr/sbin/inetd
- - - 4483 S 0 60 1 - 8400 - 0 -
root 4468 2902 - A 0 60 1 - 240001 - 0 /usr/sbin/portmap
- - - 4989 S 0 60 1 - 8400 - 0 -
root 4712 2902 - A 0 60 1 - 240001 - 0 /usr/sbin/syslogd
- - - 5233 S 0 60 1 - 8400 - 0 -
root 4998 2902 - A 0 60 1 - 240001 - 0 /usr/sbin/dpid2
- - - 5519 S 0 60 1 - 8400 - 0 -
root 5866 8424 - A 0 60 1 - 240001 pts/0 0 -ksh
- - - 8185 S 0 60 1 - 400 - 0 -
root 6054 2902 - A 0 60 1 - 240001 - 0 /usr/sbin/biod 6
- - - 6833 S 0 60 1 - 400 - 0 -
root 6326 2902 - A 0 60 1 - 240001 - 0 /usr/sbin/rpc.statd
- - - 7105 S 0 60 1 - 8400 - 0 -
root 6598 2902 - A 0 60 3 * 240001 - 0 /usr/sbin/rpc.lockd
- - - 7377 S 0 60 1 9f64c98 400 - 0 -
- - - 7639 S 0 60 1 54aa988 1400 - 0 -
- - - 7897 S 0 60 1 2735dc 1400 - 0 -
root 7008 5866 - A 12 66 1 - 200001 pts/0 0 ps -emo THREAD
- - - 9071 R 12 66 1 - 0 - 0 -
ps Command
root@bmserver[/tmp]>ps aux
USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
root 5522 0.0 0.0 8 16 - A Aug 20 0:00 kproc
root 5866 0.0 1.0 348 408 pts/0 A 06:01:57 0:00 -ksh
root 6054 0.0 0.0 68 96 - A Aug 20 0:00 /usr/sbin/biod 6
root 5264 0.0 0.0 8 12 - A Aug 20 0:01 kproc
root 4468 0.0 1.0 292 360 - A Aug 20 0:00 /usr/sbin/portmap
root 4712 0.0 0.0 128 172 - A Aug 20 0:02 /usr/sbin/syslogd
root 4998 0.0 2.0 468 548 - A Aug 20 0:00 /usr/sbin/dpid2
root 7308 0.0 0.0 8 12 - A Aug 30 0:00 kproc
root 6598 0.0 0.0 68 108 - A Aug 20 0:03 /usr/sbin/rpc.lock
root 8424 0.0 1.0 268 324 - A 06:01:57 0:01 telnetd
root 7534 0.0 1.0 188 232 pts/0 A 07:27:18 0:00 ps aux
root 6326 0.0 1.0 144 196 - A Aug 20 0:00 /usr/sbin/rpc.stat
root 6858 0.0 0.0 32 44 - A Aug 20 0:00 /usr/sbin/install_
root 7024 0.0 1.0 208 252 pts/0 A 07:27:18 0:00 more
root 1032 0.0 0.0 40 48 - A Aug 20 2:25 kproc
root 1896 0.0 0.0 8 12 - A Aug 20 0:00 kproc
root 2228 0.0 0.0 8 12 - A Aug 20 0:00 kproc
root 774 0.0 0.0 8 12 - A Aug 20 0:25 kproc
root 0 0.0 0.0 4 8 - A Aug 20 2:51 swapper
root 1 0.0 1.0 252 304 - A Aug 20 0:00 /etc/init
root 516 99.9 0.0 0 4 - A Aug 20 19067:57 kproc
emstat Command
# /usr/samples/kernel/emstat 1 7
emstat total count emstat interval count
21951937 21951937
21967488 15551
21974877 7389
21994354 19477
22007329 12975
22018171 10842
22018171 0
Scheduling Policies
SCHED_FIFO
Non-preemptive scheduling
Fixed piority
SCHED_RR
Round-Robin scheduling
Fixed piority
Run until interrupted or end of time slice
SCHED_OTHER
Default scheduling policy
Same as SCHED_RR but applies to threads with
non-fixed piorities
Piority degrades with CPU Usage
Process and Thread Piority
Process Piorities
High = 0
setpri( )
Real-Time Process Piorities
40 User Process Piorities
renice
nice
Process Inherited /Threads
Process
Piority
Low = 127
Initial PRI = NICE + 40
pe -el (to view values)
ps -emo THREAD (to view threads)
nice/renice Commands
Nice value can be set at thread creation time by using the nice
command. Syntax of nice:
usage: nice [-n increment] command
usage: nice [-increment] command
Nice value can be changed after thread has already been created
using the renice command. Syntax of renice:
usage: renice [-n increment] [ -g| -p| -u] ID...
Nice values are reduced by using negative increment values
and increased by using positive increment values. Reducing
nice value makespriority more favored. Increasing nice value
makes priority less favored.
schedtune Command
Restores defaults
Purpose
Purpose:
Captures a snapshot of the current state of
memory.
The display of information can be analyzed using
four different reports:
global [ -G]
process [-P]
segment [-S]
detailed segment [-D]
# svmon -G -i 5 3
m e m o r y i n u s e p i n p g s p a c e
size inuse free pin work pers clnt work pers clnt size inuse
49152 48134 1018 2613 10674 37460 0 2613 0 0 98304 8104
49152 48139 1013 2613 10678 37461 0 2613 0 0 98304 8105
49152 48139 1013 2613 10678 37461 0 2613 0 0 98304 8105
svmon Command
1. To print out global statistics:
$ svmon -G
2. To print out the memory usage statistics for all processes (limit statistics to
non-system segments):
$ svmon -Pn
3. To print out the memory usage statistics for processes 6746 and 10078 (include
statistics on all segments):
$ svmon -Pa 6746 10078
4. To sort system segments by the number of pages in real memory, and print out
the top 10 segments of the resulting list:
$ svmon -Ssu 10
filemon will only collect data for those files opened after
filemon was started unless you specify the -u flag.
Usage: filemon [-i file] [-o file] [-d] [-v] [-u] [-O opt]
-i file: open input file (default is real-time trace)
-o file: open output file (default is stdout)
-d: deferred trace (until ‘ trcon’ )
-T num: set trace kernel buf sz (default 32000 bytes)
-P: pin monitor process in memory
-v: verbose mode (print extra details)
-u: print unnamed file activity via pid
-O opt: other monitor-specific options
root@bmserver[/tmp]>netstat -I tr0 1
input (tr0) output input (Total) output
packets errs packets errs colls packets errs packets errs colls
10832898 0 22267 0 0 10833371 0 22740 0 0
3 0 1 0 0 3 0 1 0 0
7 0 1 0 0 7 0 1 0 0
4 0 1 0 0 4 0 1 0 0
5 0 1 0 0 5 0 1 0 0
10 0 1 0 0 10 0 1 0 0
7 0 1 0 0 7 0 1 0 0
6 0 1 0 0 6 0 1 0 0
11 0 1 0 0 11 0 1 0 0
10 0 1 0 0 10 0 1 0 0
9 0 1 0 0 9 0 1 0 0
4 0 1 0 0 4 0 1 0 0
9 0 1 0 0 9 0 1 0 0
7 0 1 0 0 7 0 1 0 0
7 0 1 0 0 7 0 1 0 0
netstat Command
root@bmserver[/tmp]>netstat -m
34 mbufs in use:
16 mbuf cluster pages in use
72 Kbytes allocated to mbufs
0 requests for mbufs denied
0 calls to protocol drain routines
Syntax - /usr/sbin/nfsstat:
-c client information
-s server information
-n NFS information only
-r RPC information only
-z reset statistics (root only)
-m mount statistics
default: -csnr
nfsstat Command
root@bmserver[/tmp]>nfsstat -rc
Client rpc:
Connection oriented:
calls badcalls badxids timeouts newcreds badverfs timers
1 0 0 0 0 0 0
nomem cantconn interrupts
0 0 0
Connectionless:
calls badcalls retrans badxids timeouts newcreds badverfs
1448 0 12 0 12 0 0
timers nomem cantsend
22 0 0
nfsstat Command
# nfsstat -m
/nfs/retain/pmrs from /nfs/retain/pmrs:cia
Flags:
vers=2,proto=udp,auth=unix,soft,intr,dynamic,rsize=8192,wsize=8192,ret
rans=5
Lookups: srtt=2 (5ms), dev=2 (10ms), cur=1 (20ms)
All: srtt=2 (5ms), dev=2400 (12000ms), cur=600 (12000ms)
udp:
27136572 datagrams received
0 incomplete headers
0 bad data length fields
0 bad checksums
20 dropped due to no socket
8 broadcast/multicast datagrams dropped due to no socket
39476 socket buffer overflows
27097068 delivered
177636 datagrams output