vmstat

 

vmstat (no options)

r, b, w Runnable, blocked, swapped
id % CPU idle time. If above 20%, the system is either I/O bound or has a memory shortage. This is because the CPU is waiting for either memory or I/O
us User time. If greater than 70%, the kernel is hardly being used and the system performance is completely dependent on the speed of the CPU and the application. No amount of kernel tuning will help.
sy System time - kernel code.
avm Active Virtual Memory. Number of virtual memory pages owned by processes that have run within the last 20 seconds. If this number is roughly the size of physical memory, minus your kernel, you are near paging.
fre Amount of free memory in Kbytes. for example, a value of 2048 means that 2 Mbytes of memory are not being used.
sr Scan rate. Count of pages examined by the pageout daemon to see if they can be freed. If sr is nozero, there is some pageout activity. It is impossible to distinguish between paging activity due to process memory shortage and simple file access.
de Deficit. The swapper process increases deficit before it swaps a process in, and sometimes when swapping a process out. If de is nozerio, it indicates severe memory shortage and swapping activity.
re Reclaims. Pages reclaimed by system due to bad guess on the part of the pageout daemon. If rate is too high, it shows that the pageout daemon is getting too desperate and is attacking pages that are actually in use. In other words, large values of re indicate a severe memory shortage.
at Attached. Pages that were attached to a process after a page fault. usually occurs on repeated invocations of the same program( e.g. when you run ls twice in a short amount of time). at has little meaning for system optimization.
pi Pages in. Not useful
po Pages out. Not useful
s0...s9 Disk traffic. Number of transfers per second (tps). You should keep disk drives at less than 25% busy. For example, if max number of transfers is 100 per second, tps should be less than 25. vmstat is unable to display disk transfer rates for more than four drives. Also note, vmstat examines transfers per disk drive and not partitiions (logical drives).
r Count of processes that are currently runnable but in the queue. This field is a good indicator of whether the CPU performance is a problem or not. High values of r cause a noticeable slowdown in system performance as the CPU is forced to jump between runnable jobs.
b Count of jobs sleeping at a negative priority. This typically means that a process is waiting for disk or tape. High counts in the b column together with high CPU idle time indicate that the system is heavily I/O bound.
w Number of jobs that have run in the last 20 seconds and that are now swapped out. Because the system only swaps out these jobs as a last resort, if the w is ever nonzero, the system has a severe memory shortage.
cs Context Switch Stats. Should be small (less than a few hundred on a single CPU system). Higher rates typically indicated poorly structured apps. Not much can be done to reduce their rate.

If CPU idle time is low, less than 10%, increase CPU, if it is greater than 20%, look at memory and I/O.

vmstat is incapable of showing the values of lotsfree, desfree, and minfree, which set paging and swapping thresholds.

 

vmstat on AIX

  1. Why does vmstat show no free RAM pages?

    AIX uses RAM as a possibly huge disk buffer. If you read a file in the morning, that file is read into RAM, and left there. If no other programs need that RAM, that file will be left in RAM until the machine is halted. This means that if you need the file again, access will be quick. If you need that RAM, the system will simply use the pages the file were using. The pages were flushed back to disk earlier. This means that you can get a huge speedup in disk access if you have enough RAM. For example, a 200MB database will just ease into RAM if you have a 256MB system.

  2. Since vmstat shows no free RAM pages, am I out of RAM?

    Probably not. Since disk files will be "mapped" into RAM, if vmstat shows lots of RAM pages FREE, then you might have too much RAM (not usual on a RISC System/6000)!

  3. Shouldn't the "avm" and the "fre" fields from vmstat add up to something?

    No. The "avm" field tells you how much "Active Virtual Memory" AIX thinks you are using. This will closely match the amount of paging space you are using. This number has *ABSOLUTELY* nothing to do with the amount of RAM you are using, and does *NOT* include your mapped files (disk files). The amount of RAM can be determined with...

      /usr/sbin/bootinfo -r

  4. Why does the "fre" field from vmstat sometimes show lots of free RAM pages?

    This will happen after an application that used a lot of RAM via "working" storage (not NFS storage, and not disk file or "persistent" storage) exits. When RAM pages that were used by working storage (a program's stack and data area) are no longer needed, there is no need to leave them around. AIX completely frees these RAM pages. The time to access these pages versus a RAM page holding a "sync'd" mapped file is almost identical. Therefore, there is no need to periodically "flush" RAM.

  5. Is the vmstat "fre" field useful?

    The vmstat "fre" field represents the number of free page frames. If the number is consistently small (less than 500 pages), this is normal. If the number is consistently large (greater than 4000 pages), then you have more memory than you need in this machine.


 

vmstat -s

Look up cache stats. The cache hit rate shold be greater than 90% for good performance.

 

iostat

id Idle time. Identical to vmstat
sy System time. Identical to vmstat
us user time. Does not include percentage of CPU cycles used by jobs that have been niced.
ni Nice time. Percentage of CPU cycles that have been niced.
tps Transfers per second. Identical to vmstat
bps KBytes per second. Average value is generally low because a busy system does not read blocks sequentially from a disk drive.
msps Milliseconds per seek. Sun SCSI do not maintain this stat. Typically you see zeros.
tin Count of chars per second intput into the system. Should be small. People are unable to type very fast.
tout Count of chars per second output from the system