Thursday 6 February 2014

18 Top AIX Performance Commands

  1. fcstat - Displays statistics gathered by the specified Fibre Channel device driver
  2. filemon - Performance statistics for files, logical/physical volumes and virtual memory segments
  3. fileplace - Displays the placement of file blocks within logical or physical volumes.
  4. entstat - Displays the statistics gathered by the specified Ethernet device driver
  5. iostat - Statistics for ttys, disks and cpu
  6. ipcs - Status of interprocess communication facilities
  7. lsps - Statistics about paging space
  8. netstat - Shows network status
  9. netpmon - Performance statistics for CPU usage, network device-driver I/O, socket calls & NFS
  10. nfsstat - Displays information about NFS and RPC calls
  11. pagesize - Displays system page size
  12. ps - Display status of current processes
  13. pstat - Statistics about system attributes
  14. sar - System Activity Recorder
  15. svmon - Captures a snapshot of the current contents of both real and virtual memory
  16. traceroute -  intended for use in network testing, measurement, and management.
  17. tprof - Detailed profile of CPU usage by an application
  18. vmstat - Statistics about virtual memory and cpu/hard disk usage

1) fcstat:

To display the statistics for Fiber Channel device driver fcs0, enter:
fcstat fcs0
Output similar to the following is displayed.

Note:The output format of various AIX commands is not always static. Do not write programs with the expectation that the output for the fcstat command will remain as follows.
FIBRE CHANNEL STATISTICS REPORT: fcs0
    Device Type: FC Adapter (df1000f9)
    Serial Number: 1E313BB001
    Option ROM Version: 02C82115
    ZA: B1F2.10A5
    Node WWN: 20000000C9487B04
    Port WWN: 10000000C9416DA4

    FC4 Types 
      Supported: 0x0000010000000000000000000000000000000000000000000000000000000000
      Active:    0x0000010000000000000000000000000000000000000000000000000000000000
    Class of Service: 4
    Port FC ID: 011400
    Port Speed (supported): 2 GBIT
    Port Speed (running):   1 GBIT
    Port Type: Fabric

    Seconds Since Last Reset: 345422

    Transmit Statistics    Receive Statistics
    -------------------    ------------------
    Frames: 1              Frames: 1
    Words: 1               Words: 1

    LIP Count: 1
    NOS Count: 1
    Error Frames:  1
    Dumped Frames: 1
    Link Failure Count: 1
    Loss of Sync Count: 1
    Loss of Signal: 1
    Primitive Seq Protocol Err Count: 1
    Invalid Tx Word Count: 1
    Invalid CRC Count: 1

    IP over FC Adapter Driver Information
      No DMA Resource Count: 0               
      No Adapter Elements Count: 0               

    FC SCSI Adapter Driver Information
      No DMA Resource Count: 0               
      No Adapter Elements Count: 0               
      No Command Resource Count: 0               

    IP over FC Traffic Statistics
      Input Requests:   0               
      Output Requests:  0               
      Control Requests: 0               
      Input Bytes:  0               
      Output Bytes: 0               

    FC SCSI Traffic Statistics
      Input Requests:   16289           
      Output Requests:  48930           
      Control Requests: 11791           
      Input Bytes:  128349517       
      Output Bytes: 209883136

2) filemon:

Monitors the performance of the file system, and reports the I/O activity on behalf of logical files, virtual memory segments, logical volumes, and physical volumes.
Filemon Example
To monitor the activity at all file system levels and write a verbose report to the fmon.out file, enter:

filemon -v -o fmon.out -O all

The filemon command automatically starts the system trace and puts itself in the background. After this command, enter the application programs and system commands to be run at this time, then enter:

trcstop

3) fileplace:

Displays the placement of file blocks within logical or physical volumes
fileplace examples
To display the placement of a file in its logical volume, enter:

fileplace data1
This example displays the list of fragments and the logical volume that contains the file data1.

To display the indirect blocks for a file, enter:

fileplace -i data1

In addition to the default list of logical volume fragments, the indirect blocks (if any) used to store the file block addresses in the file system are enumerated.

To display more placement information for a file, enter:

fileplace -v data1

In addition to the default list of logical volume fragments, statistics about the placement efficiency are displayed.

To display all information about the placement of a file on its physical volumes, enter:

fileplace -piv data1

4) entstat:

The entstat command displays the statistics gathered by the specified Ethernet device driver.
Using the -d option will list any extended statistics for this adapter.
# entstat ent0
ETHERNET STATISTICS (ent0) :
Device Type: 10/100/1000 Base-TX PCI-X Adapter (14106902)
Hardware Address: 00:02:55:6a:a5:dc
Elapsed Time: 1 days 18 hours 47 minutes 34 seconds

Transmit Statistics:                          Receive Statistics:
--------------------                          -------------------
Packets: 1108055                              Packets: 750811
Bytes: 4909388501                             Bytes: 57705832
Interrupts: 0                                 Interrupts: 681137
Transmit Errors: 0                            Receive Errors: 0
Packets Dropped: 0                            Packets Dropped: 0
                                              Bad Packets: 0
Max Packets on S/W Transmit Queue: 101
S/W Transmit Queue Overflow: 0
Current S/W+H/W Transmit Queue Length: 0

Broadcast Packets: 3                          Broadcast Packets: 3
Multicast Packets: 3                          Multicast Packets: 5
No Carrier Sense: 0                           CRC Errors: 0
DMA Underrun: 0                               DMA Overrun: 0
Lost CTS Errors: 0                            Alignment Errors: 0
Max Collision Errors: 0                       No Resource Errors: 0
Late Collision Errors: 0                      Receive Collision Errors: 0
Deferred: 0                                   Packet Too Short Errors: 0
SQE Test: 0                                   Packet Too Long Errors: 0
Timeout Errors: 0                             Packets Discarded by Adapter: 0
Single Collision Count: 0                     Receiver Start Count: 0
Multiple Collision Count: 0
Current HW Transmit Queue Length: 0

General Statistics:
-------------------
No mbuf Errors: 0
Adapter Reset Count: 0
Adapter Data Rate: 2000
Driver Flags: Up Broadcast Running
Simplex 64BitSupport ChecksumOffload
PrivateSegment LargeSend DataRateSet

5) iostat:

displays io statics of disks
iostat examples
To display a single history since boot report for all TTY, CPU, and Disks, enter the following command:

iostat

To display a continuous disk report at two second intervals for the disk with the logical name disk1, enter the following command:

iostat -d disk1 2

To display extended drive report for all disks, enter the following command:

iostat -D

6) ipcs:

Reports interprocess communication facility status.
Example o/p from entering ipcs without flags:
 IPC status from /dev/mem as of Mon Aug 14 15:03:46 1989
T    ID         KEY        MODE       OWNER     GROUP
Message Queues:
q       0    0x00010381 -Rrw-rw-rw-   root      system
q   65537    0x00010307 -Rrw-rw-rw-   root      system
q   65538    0x00010311 -Rrw-rw-rw-   root      system
q   65539    0x0001032f -Rrw-rw-rw-   root      system
q   65540    0x0001031b -Rrw-rw-rw-   root      system
q   65541    0x00010339--rw-rw-rw-    root      system
q       6    0x0002fe03 -Rrw-rw-rw-   root      system
Shared Memory:
m   65537    0x00000000 DCrw-------   root      system
m  720898    0x00010300 -Crw-rw-rw-   root      system
m   65539    0x00000000 DCrw-------   root      system
Semaphores:
s  131072    0x4d02086a --ra-ra----   root      system
s   65537    0x00000000 --ra-------   root      system
s 1310722    0x000133d0 --ra-------   7003      30720

7) lsps:

Displays the characteristics of a paging space
lsps examples
a)To list the characteristics of all paging spaces, enter:
lsps  -a

This displays the characteristics for all paging spaces and provides a listing similar to the following listing:

Page Space   PhysicalVolume  Volume Group    Size   %Used  Active  Auto  Type  Chksum
hd6           hdisk0          rootvg         512MB    1     yes     yes   lv     8

b)To display the characteristics of paging space myps using the helper program foo enter the following commad:

lsps -t foo myps

This displays the characteristics for all paging spaces and provides a listing similar to the following listing:

Page Space      Physical Volume   Volume Group    Size %Used Active  Auto  Type
myps             mydisk            myvg            512MB     1    yes   yes    lv

8) netstat:

List All Ports (both listening and non listening ports)

List all ports using netstat -a
# netstat -a | more
Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
tcp4       0      0  *.daytime              *.*                    LISTEN
tcp        0      0  *.ftp                  *.*                    LISTEN
tcp        0      0  *.netop                *.*                    LISTEN
tcp        0      0  *.netop64              *.*                    LISTEN
tcp4       0   1028  brown10.telnet         remote_client.mt.1254  ESTABLISHED
tcp4       0      0  *.wsmserve             *.*                    LISTEN

Active UNIX domain sockets
SADR/PCB  Type   Recv-Q Send-Q Inode    Conn     Refs     Nextref  Addr
71759200 dgram       0      0 13434d00        0        0        0 /dev/SRC
7051d580
71518a00 dgram       0      0 183c3b80        0        0        0 /dev/.SRC-unix/SRCCwfCEb

9) netpmon:

The netpmon command uses the trace facility to obtain a detailed picture of network activity during a time interval.
Because it uses the trace facility, the netpmon command can be run only by a root user or by a member of the system group.

Example netpmon:
netpmon -o /tmp/netpmon.log -O all;

trcstop

The trcstop command will terminate the trace initiated by the netpmon command.

10) nfsstat:

Displays statistical information about the Network File System (NFS) and Remote Procedure Call (RPC) calls.
nfsstat examples:
To display information about the number of RPC and NFS calls sent and rejected by the client, enter:

nfsstat -c

To display and print the client NFS call-related information, enter:

nfsstat -cn

To display statistics for each NFS mounted file system, enter:

nfsstat -m

To display and print RPC call-related information for the client and server, enter:

nfsstat -r

To display information about the number of RPC and NFS calls received and rejected by the server, enter:

nfsstat -s

To reset all call-related information to zero on the client and server, enter:

nfsstat -z

Note: You must have root user authority to use the -z flag.

To display information about the NFS client statistics for workload partition abc, enter:

nfsstat -@ abc -cn

11) pagesize:

Displays the system page size
pagesize eamples:
a) To obtain the size system page, enter:

pagesize

The system returns the number of bytes, such as 4096.

b) To print the formatted page size, enter:

pagesize -f

The system returns the formatted page size (for example, 4K).

c) To print all of the supported page size with an alphabetical suffix, enter:

pagesize -af

The system returns all of the supported page sizes. For example:

4K
64K
16M

12) ps:

Display status of current processes. This command is useful for determining if runaway processes are excessively utilizing the CPU or memory.
Examples What it does
ps avg ==> a displays information about all processes.

v displays fields: PGIN,SIZE,RSS,LIM,TSIZE,TRS,%CPU,%MEM

ps -ft tty2/0 ==>Lists all the processes running on port tty2/0

ps -furoger ==> Lists all the processes running under the user roger

ps -e ==>Display the environment as well as the command

ps -ef ==> Full listing of all processes in the system.

If the 'C' field (means processor utilization) has a large value, this means that that process is a CPU intensive task.

ps -X -e -f ==> To display all processes with expanded user name, type:

ps -t ==> Lists processes not associated with a terminal

13) pstat:

Interprets the contents of the various system tables and writes it to standard output
Examples What it does
pstat -s Displays paging space statistics
pstat -T Displays system variables
pstat -i dumpfile To display the i-nodes of the system dump saved in the dumpfile core file

14) sar:

Collects, reports, or saves system activity information.
sar examples
To report current tty activity for each 2 seconds for the next 40 seconds, enter the following command:

sar  -y  -r 2 20

To watch system unit for 10 minutes and sort data, enter the following command:

sar  -o temp 60 10

To report processor activity for the first two processors, enter the following command:

sar  -u  -P 0,1

This produces output similar to the following:

cpu  %usr  %sys  %wio  %idle
0      45    45     5      5
1      27    65     3      5

15) svmon:

Captures and analyzes a snapshot of virtual memory.
svmon examples
To display global statistics in a one line format every minute for 30 minutes, enter the following command:

# svmon -G -O summary=longreal -i 60 30

To display the memory consumption in megabytes (MB) of all processes in a compact report, enter the following command:

# svmon -P -O summary=basic,unit=MB

[root@sys /] svmon
size inuse free pin virtual
memory 262128 260139 288 66603 258643
pg space 196608 91566
work pers clnt lpage
pin 66609 0 0 0
in use 228672 7884 23583 0
[root@sys /]

Svmon uses frames, multiply every frame by 1024 to get the size in bytes. Also be sure to install the packages bos.perf.tools in order to get svmon work.

16) traceroute:

The traceroute command is intended for use in network testing, measurement, and management.
While the ping command confirms IP network reachability, you cannot pinpoint and improve some isolated problems
traceroute example
# traceroute aix1
trying to get source for aix1
source should be 10.53.155.187
traceroute to aix1.austin.ibm.com (10.53.153.120) from 10.53.155.187 (10.53.155.187), 30 hops max
outgoing MTU = 1500
 1  10.111.154.1 (10.111.154.1)  5 ms  3 ms  2 ms
 2  aix1 (10.53.153.120)  5 ms  5 ms  5 ms

17) tprof :

Reports processor usage
tprof example
Basic global program and thread-level summary

$ tprof -x sleep 10 
Mon May 20 00:39:26 2002 System: AIX 5.2 Node: dreaming Machine: 000671894C00 
Starting Command sleep 10 
stopping trace collection. 
Generating sleep.prof  

The resulting sleep.prof file only contains the summary report section.

Single process level profiling

$ tprof -u -p workload -x workload 
Mon May 20 00:39:26 2002 
System: AIX 5.2 Node: drea
ming Machine: 000671894C00 

Starting Command workload stopping trace collection.Generating workload.prof 

18) vmstat:

Reports virtual memory statistics
vmstat examples
Use the command vmstat 10 10
[root@sys /] vmstat 10 10
kthr     memory             page              faults        cpu
----- ----------- ------------------------ ------------ -----------
 r  b   avm   fre  re  pi  po  fr   sr  cy  in   sy  cs us sy id wa
 4  1 257816  2166   0   0   0 315  287   0 615 10202 1030  9 19 51 22
 8  1 257579  2412   0   0   0 147 1407   0 588 32601 1745 17 81  1  1
11  1 259625   171   0   0   0 494 10911   0 647 31634 1440 18 82  0  0
11  1 259720   270   0   0   0 281 2413   0 593 34101 1652 21 79  0  0
11  1 259282   555   0   0   0 246 2619   0 669 33614 1814 16 84  0  0
...
[root@sys /]

To display five summaries at 2-second intervals, enter the following command:
vmstat 2 5

To display a summary of the statistics since boot including statistics for logical disks scdisk13 and scdisk14, enter the following command:
vmstat scdisk13 scdisk14

To display fork statistics, enter the following command:
vmstat -f

To display the count of various events, enter the following command:
vmstat -s

To display time-stamp next to each column of output of vmstat, enter the following command:
vmstat -t

To display the I/O oriented view with an alternative set of columns, enter the following command:
vmstat -I

To display all the VMM statistics available, enter the following command:
vmstat -vs

3 comments:

  1. One other useful aix command when I was looking for in Google when stumbled your article is topas you should include it in the list :)

    Thanks and Best!

    ReplyDelete
  2. Hello,

    great post !

    I like other command very useful :

    "lvmstat"

    Thanks

    ReplyDelete
  3. Hello,

    I think you are missing probably one of the most important commands "nmon"

    ReplyDelete