External Performance   «Prev  Next»
Lesson 2Overview of the iostat utility
ObjectiveExecute and interpret iostat.

Monitoring physical I/O

The iostat utility is still used in Oracle to execute and interpret iostat.disk. The iostat utility is a command-line tool that provides information about disk I/O activity. It can be used to identify I/O bottlenecks and to track I/O performance over time. The iostat utility is available on most Unix-like operating systems, including Oracle Linux. To use the iostat utility, you simply type the following command at the command prompt:
iostat

This command will display a table of information about all of the disks on your system. The table will include the following information:
  • Device name
  • Number of reads and writes per second
  • Average transfer rate in kilobytes per second
  • Average seek time in milliseconds
  • I/O wait time in milliseconds
  • Utilization percentage

You can also use the iostat utility to display information about a specific disk. To do this, you simply type the following command at the command prompt:
iostat <device name>

For example, to display information about the disk named /dev/sdb, you would type the following command at the command prompt:
iostat /dev/sdb

The iostat utility is a valuable tool for Oracle DBAs. It can be used to identify I/O bottlenecks and to track I/O performance over time. This information can be used to improve the performance of Oracle databases.
Here are some examples of how the iostat utility can be used in Oracle:
  • Identify I/O bottlenecks that are causing Oracle databases to slow down.
  • Track I/O performance over time to identify trends and patterns.
  • Measure the impact of changes to Oracle databases on I/O performance.
  • Troubleshoot I/O problems with Oracle databases.

The iostat utility is a valuable tool that can help you to improve the performance of your Oracle databases.

Grow Market Share with Competitive Intelligence

UNIX OS and the iostat utility

Almost every flavor of the UNIX operating system has a version of the iostat utility. The purpose of iostat is to provide an elapsed time measure of the amount of physical I/O addressed to the disk devices. This elapsed time measure is a log showing the number of times that the physical drive is accessed. To run the iostat utility, enter the following command:

%> c
The “iostat 5” says to display one line of output for every disk attached to our database server. In this case we get 37 lines of output every 5 seconds, each showing the amount of I/O for each disk.
View the code belwo to see the entire output.
Disks:        % tm_act     Kbps      tps    Kb_read   Kb_wrtn
hdisk6           1.0      73.8       4.2    8999945   3314136
hdisk7           0.7      86.4       3.1   13790876    629660

hdisk8           0.0       0.6       0.0      90469      2176

hdisk9           0.8      74.4       3.1    9875281   2532636

hdisk10          0.5      54.6       1.7    9108228      3616

hdisk11          0.1      13.7       0.4    2279793       244

hdisk12          0.9      65.4       2.9    8204633   2706804

hdisk13          0.7      67.7       2.0    5377408   5927972

hdisk14          0.0       0.2       0.0      14649     12416

hdisk0           0.5       4.0       0.7     195431    475732

hdisk5           0.0       0.0       0.0       4248        80

hdisk1           0.0       0.1       0.0       6632      2766

hdisk2           0.0       0.0       0.0       4260        80

hdisk3           0.5       3.1       0.6      24383    493134

hdisk4           0.0       0.0       0.0       4248        80
hdisk15          0.9      59.8       2.7    7682441   2294784
hdisk16          0.2      26.5       1.2    3863320    559192
hdisk17          0.1      12.1       0.4    2021689      2560
hdisk18          0.7      60.7       2.9    7729749   2403124
hdisk19          0.2      20.9       0.7    3479320      2828
hdisk20          0.3      24.0       0.8    3998641      1608
hdisk21          0.8      66.2       2.9    8507297   2546544
hdisk22          0.2      24.3       0.8    4059436      3708
hdisk23          0.0       0.0       0.0          0         0
hdisk24          1.2      71.3       3.3    9521345   2379436
hdisk25          0.0       0.2       0.0      24779       712
hdisk26          0.0       0.0       0.0          0         0
hdisk27          0.9      55.2       3.2    6545573   2662344
hdisk28          0.0       0.0       0.0       2198        52
hdisk29          0.0       0.0       0.0          0         0
hdisk30          0.8      65.0       3.1    7689577   3152476
hdisk31          0.0       0.0       0.0          0         0
hdisk32          0.0       0.0       0.0          0         0
hdisk33          1.0      92.4       5.3    7490593   7926752
hdisk34          0.0       0.0       0.0          0         0
hdisk35          0.0       0.0       0.0          0         0
hdisk36          0.8      58.9       2.8    7514473   2316688
hdisk37          0.0       0.0       0.0          0         0

Iostat output header

This diagram below gives a detailed overview of the output headers.
io stat header
  1. % tm_act, The percentage of time that the disk was physically active.
  2. Kbps, The number of kilobytes transferred per second.
  3. Tps, The number of I/O requests to the disk. Note that multiple logical I/O requests may be merged into a single physical request.
  4. Kb_read, The number of kilobytes read during the interval.
  5. Kb_wrtn, The number of kilobytes written during the time interval.

Capturing Data with Shell Script

You can write a shell script to capture this iostat data and place it into Oracle tables. Click the MouseOver button to see such a script. Once the data is stored inside an Oracle table, you can run queries against the table to get historical I/O information.

Iostat script
  1. Set the sample time to 300 (5 minutes = 300 seconds).
  2. Run iostat and pipe the output into the /tmp directory.
  3. Gather the current date from UNIX.
  4. Print the output from /tmp and for each line, insert a row into an Oracle table called iostat.

Disk Array Package

Note: If you are using a disk array package with a memory cache (such as EMC), the physical I/O statistics may be misleading. This is because some I/O may be fetched from the disk memory cache and did not result in a real disk I/O. The next lesson describes more about hot disks.