Showing posts with label IBM AIX - Performance. Show all posts
Showing posts with label IBM AIX - Performance. Show all posts

Thursday, September 6, 2012

IBM AIX - Memory Consumption

IBM AIX - Memory Consumption

The command svmon -G can be used to determine the actual memory consumption of a server. To determine if the memory is overcommitted, you need to divide the memory-virtual value by the memory-size value, e.g.:
# svmon -G size inuse free pin virtual memory 5079040 5076409 2631 706856 2983249 pg space 7864320 12885 work pers clnt other pin 540803 0 2758 163295 in use 2983249 0 2093160 PageSize PoolSize inuse pgsp pin virtual s 4 KB - 4918761 12885 621096 2825601 m 64 KB - 9853 0 5360 9853
In this example, the memory-virtual value is 2983249, and the memory-size value is 5079040. Note that the actual memory-inuse is nearly the same as the memory-size value. This is simply AIX caching as much as possible in its memory. Hence, the memory-free value is typically very low.
Now, to determine the actual memory consumption, devide memory-virtual by memory-size:
# bc scale=2 2982321/5079040 .58
Thus, the actual memory consumption is 58% of the memory (5079040 blocks of 4 KB = 19840 MB). The free memory is thus: (100% - 58%) * 19840 MB = 8332 MB.
Try to keep the value of memory consumption less than 90%. Above that, you will generally start seeing paging activity using the vmstat command. By that time, it is a good idea to lower the load on the system or to get more memory in your system.

Friday, August 10, 2012

IBM AIX - filemon - Performance Monitoring

Performance Monitoring in IBM AIX 
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.

The filemon command monitors a trace of file system and I/O system events, and reports on the file and I/O access performance during that period.

In its normal mode, the filemon command runs in the background while one or more application programs or system commands are being executed and monitored. The filemon command automatically starts and monitors a trace of the program's file system and I/O events in real time. By default, the trace is started immediately; optionally, tracing may be deferred until the user issues a trcon command. The user can issue trcoff and trcon commands while the filemon command is running in order to turn off and on monitoring, as desired. When tracing is stopped by a trcstop command, the filemon command generates an I/O activity report and exits.

The filemon command can also process a trace file that has been previously recorded by the trace facility. The file and I/O activity report will be based on the events recorded in that file.

 
Detailed I/O analysis with the filemon command 

The filemon command uses the trace facility to obtain a detailed picture of I/O activity during a time interval on the various layers of file system utilization, including the logical file system, virtual memory segments, LVM, and physical disk layers.
The filemon command can be used to collect data on all layers, or layers can be specified with the -O layer option. The default is to collect data on the VM, LVM, and physical layers. Both summary and detailed reports are generated. Since it uses the trace facility, the filemon command can be run only by the root user or by a member of the system group.
To determine whether the filemon command is installed and available, run the following command:

# lslpp -lI perfagent.tools

Tracing is started by the filemon command, optionally suspended with the trcoff subcommand and resumed with the trcon subcomand. As soon as tracing is terminated, the filemon command writes its report to stdout.
Note: Only data for those files opened after the filemon command was started will be collected, unless you specify the -u flag.
The filemon command can read the I/O trace data from a specified file, instead of from the real-time trace process. In this case, the filemon report summarizes the I/O activity for the system and period represented by the trace file. This offline processing method is useful when it is necessary to postprocess a trace file from a remote machine or perform the trace data collection at one time and postprocess it at another time.
The trcrpt -r command must be executed on the trace logfile and redirected to another file, as follows:

# gennames > gennames.out
# trcrpt -r   trace.out > trace.rpt
At this point an adjusted trace logfile is fed into the filemon command to report on I/O activity captured by a previously recorded trace session as follows: 
# filemon -i trace.rpt -n gennames.out | pg

In this example, the filemon command reads file system trace events from the input file trace.rpt. Because the trace data is already captured on a file, the filemon command does not put itself in the background to allow application programs to be run. After the entire file is read, an I/O activity report for the virtual memory, logical volume, and physical volume levels is displayed on standard output (which, in this example, is piped to the pg command).
If the trace command was run with the -C all flag, then run the trcrpt command also with the -C all flag (see Formatting a report from trace -C output).

The following sequence of commands gives an example of the filemon command usage:
# filemon -o fm.out -O all; cp /smit.log /dev/null ; trcstop

The report produced by this sequence, in an otherwise-idle system, is as follows:
Thu Aug 19 11:30:49 1999
System: AIX texmex Node: 4 Machine: 000691854C00

0.369 secs in measured interval
Cpu utilization:  9.0%

Most Active Files
------------------------------------------------------------------------
  #MBs  #opns   #rds   #wrs  file                 volume:inode
------------------------------------------------------------------------
   0.1      1     14      0  smit.log             /dev/hd4:858
   0.0      1      0     13  null
   0.0      2      4      0  ksh.cat              /dev/hd2:16872
   0.0      1      2      0  cmdtrace.cat         /dev/hd2:16739

Most Active Segments
------------------------------------------------------------------------
  #MBs  #rpgs  #wpgs  segid  segtype              volume:inode
------------------------------------------------------------------------
   0.1     13      0   5e93  ???
   0.0      2      0   22ed  ???
   0.0      1      0   5c77  persistent

Most Active Logical Volumes
------------------------------------------------------------------------
  util  #rblk  #wblk   KB/s  volume               description
------------------------------------------------------------------------
  0.06    112      0  151.9  /dev/hd4             /
  0.04     16      0   21.7  /dev/hd2             /usr

Most Active Physical Volumes
------------------------------------------------------------------------
  util  #rblk  #wblk   KB/s  volume               description
------------------------------------------------------------------------
  0.10    128      0  173.6  /dev/hdisk0          N/A




------------------------------------------------------------------------
Detailed File Stats
------------------------------------------------------------------------

FILE: /smit.log  volume: /dev/hd4 (/)  inode: 858
opens:                  1
total bytes xfrd:       57344
reads:                  14      (0 errs)
  read sizes (bytes):   avg  4096.0 min    4096 max    4096 sdev     0.0
  read times (msec):    avg   1.709 min   0.002 max  19.996 sdev   5.092

FILE: /dev/null
opens:                  1
total bytes xfrd:       50600
writes:                 13      (0 errs)
  write sizes (bytes):  avg  3892.3 min    1448 max    4096 sdev   705.6
  write times (msec):   avg   0.007 min   0.003 max   0.022 sdev   0.006

FILE: /usr/lib/nls/msg/en_US/ksh.cat  volume: /dev/hd2 (/usr)  inode: 16872
opens:                  2
total bytes xfrd:       16384
reads:                  4       (0 errs)
  read sizes (bytes):   avg  4096.0 min    4096 max    4096 sdev     0.0
  read times (msec):    avg   0.042 min   0.015 max   0.070 sdev   0.025
lseeks:                 10

FILE: /usr/lib/nls/msg/en_US/cmdtrace.cat  volume: /dev/hd2 (/usr)  inode: 16739
opens:                  1
total bytes xfrd:       8192
reads:                  2       (0 errs)
  read sizes (bytes):   avg  4096.0 min    4096 max    4096 sdev     0.0
  read times (msec):    avg   0.062 min   0.049 max   0.075 sdev   0.013
lseeks:                 8

------------------------------------------------------------------------
Detailed VM Segment Stats   (4096 byte pages)
------------------------------------------------------------------------

SEGMENT: 5e93  segtype: ???
segment flags:
reads:                  13      (0 errs)
  read times (msec):    avg   1.979 min   0.957 max   5.970 sdev   1.310
  read sequences:       1
  read seq. lengths:    avg    13.0 min      13 max      13 sdev     0.0

SEGMENT: 22ed  segtype: ???
segment flags:          inode
reads:                  2       (0 errs)
  read times (msec):    avg   8.102 min   7.786 max   8.418 sdev   0.316
  read sequences:       2
  read seq. lengths:    avg     1.0 min       1 max       1 sdev     0.0

SEGMENT: 5c77  segtype: persistent
segment flags:          pers defer
reads:                  1       (0 errs)
  read times (msec):    avg  13.810 min  13.810 max  13.810 sdev   0.000
  read sequences:       1
  read seq. lengths:    avg     1.0 min       1 max       1 sdev     0.0

------------------------------------------------------------------------
Detailed Logical Volume Stats   (512 byte blocks)
------------------------------------------------------------------------

VOLUME: /dev/hd4  description: /
reads:                  5       (0 errs)
  read sizes (blks):    avg    22.4 min       8 max      40 sdev    12.8
  read times (msec):    avg   4.847 min   0.938 max  13.792 sdev   4.819
  read sequences:       3
  read seq. lengths:    avg    37.3 min       8 max      64 sdev    22.9
seeks:                  3       (60.0%)
  seek dist (blks):     init   6344,
                        avg    40.0 min       8 max      72 sdev    32.0
time to next req(msec): avg  70.473 min   0.224 max 331.020 sdev 130.364
throughput:             151.9 KB/sec
utilization:            0.06

VOLUME: /dev/hd2  description: /usr
reads:                  2       (0 errs)
  read sizes (blks):    avg     8.0 min       8 max       8 sdev     0.0
  read times (msec):    avg   8.078 min   7.769 max   8.387 sdev   0.309
  read sequences:       2
  read seq. lengths:    avg     8.0 min       8 max       8 sdev     0.0
seeks:                  2       (100.0%)
  seek dist (blks):     init 608672,
                        avg    16.0 min      16 max      16 sdev     0.0
time to next req(msec): avg 162.160 min   8.497 max 315.823 sdev 153.663
throughput:             21.7 KB/sec
utilization:            0.04

------------------------------------------------------------------------
Detailed Physical Volume Stats   (512 byte blocks)
------------------------------------------------------------------------

VOLUME: /dev/hdisk0  description: N/A
reads:                  7       (0 errs)
  read sizes (blks):    avg    18.3 min       8 max      40 sdev    12.6
  read times (msec):    avg   5.723 min   0.905 max  20.448 sdev   6.567
  read sequences:       5
  read seq. lengths:    avg    25.6 min       8 max      64 sdev    22.9
seeks:                  5       (71.4%)
  seek dist (blks):     init 4233888,
                        avg 171086.0 min       8 max  684248 sdev 296274.2
  seek dist (%tot blks):init 48.03665,
                        avg 1.94110 min 0.00009 max 7.76331 sdev 3.36145
time to next req(msec): avg  50.340 min   0.226 max 315.865 sdev 108.483
throughput:             173.6 KB/sec
utilization:            0.10

Using the filemon command in systems with real workloads would result in much larger reports and might require more trace buffer space. Space and CPU time consumption for the filemon command can degrade system performance to some extent. Use a nonproduction system to experiment with the filemon command before starting it in a production environment. Also, use offline processing and on systems with many CPUs use the -C all flag with the trace command.
Note: Although the filemon command reports average, minimum, maximum, and standard deviation in its detailed-statistics sections, the results should not be used to develop confidence intervals or other formal statistical inferences. In general, the distribution of data points is neither random nor symmetrical.

IBM AIX - nmon - Performance monitoring

Performance Monitoring Tools commonly used in IBM AIX overview


nmon



Which is included with AIX from 5.3 TL09, AIX 6.1 TL02 and Virtual I/O Server (VIOS) 2.1 . It is installed by default.

1. nmon is short form of Nigel's Monitor.
2. This free tool gives you a huge amount of important performance information in one go.
3. It can output the data in a number of ways
4. On screen (console, telnet, VNC, putty or X Windows) using curses for low CPU impact which is updated once every two seconds. You hit single characters on you keyboard to enable/disable the various sorts of data.
5. Save the data to a comma separated file for analysis and longer term data capture.
a. Use this together with nmon Analyser Excel 2000 spreadsheet, which loads the nmon output file and automatically creates dozens of graphs ready for you to study or write performance reports.
b. Filter this data, add it to a rrd database (using an excellent freely available utility called rrdtool). This graphs the data to .gif or .png files plus generates the webpage .html file and you can then put the graphs directly on a website automatically on AIX with no need of a Windows based machine.
c. Directly put the data into a rrd database for your own analysis
6. nmon is a single binary for each operating system, so installing is as very easy as getting the file in your $PATH.

The nmon functionality is actually integrated within the topas command, which can be started in topas mode or nmon mode (just type "nmon"). 

You can flip between the two modes online by typing "~". 

You can also start nmon to capture to a file with the regular nmon options . This gives you the best of both worlds - one tool to watch the CEC/whole machine view of all your logical partitions (topas -C) and the same tool to drill down into the details of your AIX system in nmon style. 

The nmon tool is designed for AIX and Linux performance specialists to use for monitoring and analyzing performance data, including:


1. CPU utilization
2. Memory use
3. Kernel statistics and run queue information
4. Disks I/O rates, transfers, and read/write ratios
5. Free space on file systems
6. Disk adapters
7. Network I/O rates, transfers, and read/write ratios
8. Paging space and paging rates
9. CPU and AIX specification
10. Top processors
11. IBM HTTP Web cache
12. User-defined disk groups
13. Machine details and resources
14. Asynchronous I/O -- AIX only
15. Workload Manager (WLM) -- AIX only
16. IBM TotalStorage® Enterprise Storage Server® (ESS) disks -- AIX only
17. Network File System (NFS)
18. Dynamic LPAR (DLPAR) changes

Also included is a new tool to generate graphs from the nmon output and create .gif files that can be displayed on a Web site.

Benefits of the tool


The nmon tool is helpful in presenting all the important performance tuning information on one screen and dynamically updating it. This efficient tool works on any dumb screen, telnet session, or even a dial-up line. In addition, it does not consume many CPU cycles, usually below two percent. On newer machines, CPU usage is well below one percent.
Data is displayed on the screen and updated once every two seconds, using a dumb screen. However, you can easily change this interval to a longer or shorter time period. If you stretch the window and display the data on X Windows, VNC, PuTTY, or similar, the nmon tool can output a great deal of information in one place.
The nmon tool can also capture the same data to a text file for later analysis and graphing for reports. The output is in a spreadsheet format (.csv).

Installing the tool
The tool is a stand-alone binary file (a different file for each AIX or Linux version) that you can install in five seconds, probably less if you type fast. Installation is simple:

1. Copy the nmonXXX.tar.Z file to the machine. If using FTP, remember to use binary mode.
Note: Version XXX replaces this example.
2. To uncompress the file, run uncompress nmonXX.tar.Z.
3. To extract the files, run tar xvf nmonXX.tar.
4. To start the nmon tool, type nmon.

If you are the root user, you might need to type ./nmon.
Extra notes for using nmon 9 for AIX 4 only

You must be the root user or allow regular users to read the /dev/kmem file by typing the following command (as root):
chmod ugo+r /dev/kmem
If you want the disk statistics, then also run (as root):
chdev -l sys0 -a iostat=true

How to run the tool interactively



For running the tool interactively, read the front page of the file for a few hints. Then start the tool and use the one-key commands to see the data you want. For example, to get CPU, Memory, and Disk statistics, start nmon and type:
cmd
How to get help information while running interactively
Press the h key.
Additional help information
For additonal help information, try the following:
  • Type the nmon -? command for brief details.
  • Type the nmon -h command for full details.
  • Read the README file.
How to capture the data to a file for later analysis and graphing
Run nmon with the -f flag. See nmon -h for the details. But as an example, try to run nmon for an hour capturing data snapshots every 30 seconds by using,
nmon -f -s 30 -c 120 nmon -fT -s 30 -c 120
The second line also captures the top processes. Both of these create the output file in the current directory
<hostname>_date_time.nmon
This file is in a comma-separated values (CSV) format and can be imported into a spreadsheet directly. If you are using Lotus® 1-2-3, the file needs to be sorted. (This is not required for the Excel version of the nmon analyser.) 
On AIX, follow this example:
sort -A mymachine_311201_1030.nmon > xxx.csv

Notes to save you time:

  • To load the nmon data capture file into a spreadsheet, check the spreadsheet documentation for loading CSV data files (.csv). Many spreadsheets accept this data as just one of the possible files to load or provide an import function to do this. Many spreadsheets have a fixed number of columns and rows. I suggest you collect a maximum of 300 snapshots to avoid hitting these issues.
  • When you are capturing data to a file, nmon disconnects from the shell to ensure that it continues running, even if you log out. This means that nmon can appear to crash, even though it's still running in the background. To see if the process is still running, type:
    ps -ef | grep nmon

  • Read the README file for more information about which version of nmon to run on your particular operating system.
  • nmon Version 10 for AIX 5 no longer uses /dev/kmem, but only public APIs. So, you don't have to chage the permissions on /dev/kmem, and there is no need to have 32- and 64-bit versions of nmon.
  • For AIX 5.1, 5.2, and 5.3, use nmon 10.
  • On AIX, don't report lslpp -Lcq bos.-p core dumps on AIX 5.1, about ML03 onwards. Also, WLM stats go missing after upgrading to AIX 5.2 ML5 to Nigel Griffiths, as these are AIX bugs. These are avoided by using nmon Version 10.
  • Don't use Microsoft® Windows® Telnet and use a larger window than 80 x 25 characters. Many developers use VNC and PuTTY to display nmon from a Windows machine -- why not do the same!
New features for nmon on AIX Version 10
New FeaturesDescription
Starting upThere is also now a small shell script called "nmon" that starts the right nmon version. Place this script and nmon binaries in your $PATH and type: nmon. This version is now only compiled in 32-bit mode. So, it runs on 32- and 64-bit hardware. The idea is to make it easier to install and run.
N = NFSNFS is completely new for nmon 10.
p = PartitionsThis is for shared CPU partitions information -- the big p5/AIX5.3 feature.
C = CPUThis is for machines with 32 plus CPUs -- up to 128 logical CPUs by demand.
c = CPUDetails your physical CPU use -- if you are on a POWER5 with AIX 5.3 and in a shared CPU environment.
S = SubclassThis is for WLM subclasses -- by request.
a = Disk adaptersGives you details of the disk adapter -- like their full type.
r = ResourcesThis includes your CPU speed in MHz.
k = KernelGives some new fields.
L = Large pagesGives you large-page stats -- popular with high-performance guys.
D = DiskGives you more information about your disks, disk type sizes, free, volume groups, adapter, and so forth.
n = NetworkGives you information about your network adapters details, MTU, and errors.
m = MemoryGives you more details on where your memory is going, system (kernel) and processes, and active virtual memory.
-BThis is a start-up option to remove the boxes.
Some Screen Shots of nmon,




 

Determine the load of your system

 

By executing uptime, you get the load on your system. The load indicates the amount of programs that are being executed at the same time. 

[root@theunix] uptime
  04:19PM   up 62 days,   1:57,  3 users,  load average: 12.26, 11.86, 8.77
[root@theunix]

 

Determine the cpu usage (user/sys/idle/wait)

 

Use the command vmstat 10 10. 

[root@theunix] 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@theunix]

 

Determine the memory/swap usage of an AIX system

 

Use the commands svmon and lsps. 

[root@theunix] lsps -a
Page Space  Physical Volume   Volume Group    Size   %Used  Active  Auto  Type
hd6         hdisk0            rootvg         768MB      47     yes   yes    lv
[root@theunix] 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@theunix]

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.

 

Determine the IO load on your systems disks

 

Use the command iostat, do know thet the first entry is the entry since boot. 

[root@theunix] lslpp -w /usr/bin/svmon
  File                                        Fileset               Type
  ----------------------------------------------------------------------------
  /usr/bin/svmon                              bos.perf.tools        File 
 
[root@theunix] iostat 5 2

tty:      tin         tout   avg-cpu:  % user    % sys     % idle    % iowait
          0.1          4.8               8.7     18.5       51.2      21.6

Disks:        % tm_act     Kbps      tps    Kb_read   Kb_wrtn
hdisk1           1.6      16.4       3.5    6873724  81062953
hdisk0           1.8      16.9       3.7   10202425  80417825
cd0              0.0       0.0       0.0          0         0

tty:      tin         tout   avg-cpu:  % user    % sys     % idle    % iowait
          0.0        135.2              17.4     82.6        0.0       0.0

Disks:        % tm_act     Kbps      tps    Kb_read   Kb_wrtn
hdisk1           0.0       0.0       0.0          0         0
hdisk0           2.4      15.2       3.4         76         0
cd0              0.0       0.0       0.0          0         0
[root@theunix]

If you get as output: 

[root@theunix] iostat

tty:      tin         tout   avg-cpu:  % user    % sys     % idle    % iowait
          0.1          4.8               8.7     18.5       51.2      21.6
                " Disk history since boot not available. "

[root@theunix]

you have to activate iostat counters by typing the following command:

  • /usr/sbin/chdev -l sys0 -a "iostat=true"

 

AIX temperature sensors

 

By executing the command /usr/lpp/diagnostics/bin/uesensor, you can, on supported platform, get the fan speeds and temperature of your system:

[root@theunix] /usr/lpp/diagnostics/bin/uesensor -a
3 0 11 31 P1
9001 0 11 2100 F1
9001 1 11 2760 F2
9001 2 11 1890 F3
9001 3 11 1890 F4
9002 0 11 5129 P1
9002 1 11 3129 P1
9002 2 11 5129 P1
9002 3 11 12077 P1
9004 0 11 3 P3-V1
9004 1 11 3 P3-V2
9004 2 11 3 P3-V3

[root@theunix]

Pages