Reports virtual memory statistics.
vmstat [ -f ] [ -i ] [ -s ] [ -I ] [ -t ] [ PhysicalVolume ... ] [ Interval [ Count ] ]
The vmstat command reports statistics about kernel threads, virtual memory, disks, traps and CPU activity. Reports generated by the vmstat command can be used to balance system load activity. These system-wide statistics (among all processors) are calculated as averages for values expressed as percentages, and as sums otherwise.
If the vmstat command is invoked without flags, the report contains a summary of the virtual memory activity since system startup. If the -f flag is specified, the vmstat command reports the number of forks since system startup. The PhysicalVolume parameter specifies the name of the physical volume.
The Interval parameter specifies the amount of time in seconds between each report. The first report contains statistics for the time since system startup. Subsequent reports contain statistics collected during the interval since the previous report. If the Interval parameter is not specified, the vmstat command generates a single report and then exits. The Count parameter can only be specified with the Interval parameter. If the Count parameter is specified, its value determines the number of reports generated and the number of seconds apart. If the Interval parameter is specified without the Count parameter, reports are continuously generated. A Count parameter of 0 is not allowed.
AIX 4.3.3 and later contain enhancements to the method used to compute the percentage of CPU time spent waiting on disk I/O (wio time).The method used in AIX 4.3.2 and earlier versions of the operating system can, under certain circumstances, give an inflated view of wio time on SMPs.
The method used in AIX 4.3.2 and earlier versions is as follows: At each clock interrupt on each processor (100 times a second per processor), a determination is made as to which of the four categories (usr/sys/wio/idle) to place the last 10 ms of time. If the CPU was busy in usr mode at the time of the clock interrupt, then usr gets the clock tick added into its category. If the CPU was busy in kernel mode at the time of the clock interrupt, then the sys category gets the tick. If the CPU was not busy, a check is made to see if any I/O to disk is in progress. If any disk I/O is in progress, the wio category is incremented. If no disk I/O is in progress and the CPU is not busy, the idle category gets the tick. The inflated view of wio time results from all idle CPUs being categorized as wio regardless of the number of threads waiting on I/O. For example, systems with just one thread doing I/O could report over 90 percent wio time regardless of the number of CPUs it has. The wio time is reported by the commands sar (%wio), vmstat (wa) and iostat (% iowait).
The method used in operating system AIX 4.3.3 and later is as follows: The change in operating system AIX 4.3.3 is to only mark an idle CPU as wio if an outstanding I/O was started on that CPU. This method can report much lower wio times when just a few threads are doing I/O and the system is otherwise idle. For example, a system with four CPUs and one thread doing I/O will report a maximum of 25 percent wio time. A system with 12 CPUs and one thread doing I/O will report a maximum of 8 percent wio time. NFS client reads/writes go through the VMM, and the time that biods spend in the VMM waiting for an I/O to complete is now reported as I/O wait time.
The kernel maintains statistics for kernel threads, paging, and interrupt activity, which the vmstat command accesses through the use of the knlist subroutine and the /dev/kmem pseudo-device driver. The disk input/output statistics are maintained by device drivers. For disks, the average transfer rate is determined by using the active time and number of transfers information. The percent active time is computed from the amount of time the drive is busy during the report.
The following example of a report generated by the vmstat command contains the column headings and their description:
kthr: kernel thread state changes per second over the
sampling interval.
r | Number of kernel threads placed in run queue. |
b | Number of kernel threads placed in wait queue (awaiting resource, awaiting input/output). |
Memory:
information about the usage of virtual and real memory. Virtual pages
are considered active if they have been accessed. A page is 4096
bytes.
avm | Active virtual pages. |
fre | Size of the free list.
Note: A large portion of real memory is utilized as a cache for file system data. It is not unusual for the size of the free list to remain small. |
Page: information
about page faults and paging activity. These are averaged over the
interval and given in units per second.
Faults: trap and
interrupt rate averages per second over the sampling interval.
in | Device interrupts. |
sy | System calls. |
cs | Kernel thread context switches. |
Cpu: breakdown of
percentage usage of CPU time.
us | User time. |
sy | System time. |
id | CPU idle time. |
wa | CPU idle time during which the system had outstanding disk/NFS I/O request(s). See detailed description above. |
Disk: Provides the number of transfers per second to the specified physical volumes that occurred in the sample interval. The PhysicalVolume parameter can be used to specify one to four names. Transfer statistics are given for each specified drive in the order specified. This count represents requests to the physical device. It does not imply an amount of data that was read or written. Several logical requests can be combined into one physical request.
If the -I flag is specified, an I/O oriented view is presented
with the following column changes.
kthr | The column p will also be displayed besides columns
r and b.
|
page | New columns fi and fo will be displayed instead of
re and cy columns.
|
Note: Both the -f and -s flags can be entered on the command line, but the system will only accept the first flag specified and override the second flag.
vmstat
vmstat 2 5
The first summary contains statistics for the time since boot.
vmstat scdisk13 scdisk14
vmstat -s
vmstat -t
vmstat -I
/unix | Symbolic link to the kernel boot image. |
/usr/bin/vmstat | Contains the vmstat command. |
The iostat command.
The knlist subroutine.
The /dev/kmem special file.
Monitoring and Tuning Memory Use in AIX 5L Version 5.1 Performance Management Guide.