The vmstat utility is very useful for detecting memory problems. As the UNIX OS performs memory management, UNIX keeps internal
statistics about the rate of page-out and page-in operations from RAM memory. The vmstat utility displays these memory structures and shows the internals of memory activity.
Memory usage: the “r” and “pi” columns
For memory usage, we are primarily interested in only two columns: the run queue “r” and the page-in column “pi.” Whenever we experience a non-zero value for pi, we know that our server is swapping memory.
Memory paging slows down Oracle transactions, and this is often reflected in the run queue r column. If the value of the r column exceeds the number of CPUs on your server, and you do not have CPU bottlenecks (where us plus sy equals 100) then you may be waiting for memory.
The following diagram contains information with respect to the vmstat output.
To receive a vmstat listing for each second, use the command below. As illustrated, a new output line appears each second after the vmstat command.
In the case above, we see that we are not experiencing memory swapping because the pi column is zero.
Values in the r column (OS run queue) indicate tasks waiting for service. This could be due to
memory bottlenecks, but could also be due to CPU or disk I/O waits. Whenever the r (run queue) column exceeds the number of CPUs on your server, you are experiencing a bottleneck because tasks are waiting for service. If high run queue values are seen in conjunction with high page-in operations, you may have a memory problem.
The next lesson shows how to track OS statistics.