Performance Guide
Chapter 4, Tuning memory resources

Identifying memory-bound systems

Identifying memory-bound systems

A system is memory bound or has a memory bottleneck if memory on the system is insufficient to keep the pages of all runnable or sleeping processes in physical memory. To determine if your system is memory bound run sar -p (or mpsar -p for SMP) and look at the value of rclm/s. If this column is consistently zero, the system does not have memory problems.

If the number of free pages shown by freemem (using sar -r) is consistently near or below the value defined for the GPGSHI kernel parameter, then the page daemon is probably active. Confirm this by examining the TIME usage reported by the ps -el -p 2 command for the page handling daemon, vhand; if this value is increasing, vhand is running. If the value of freemem is consistently low, this indicates that most of memory is regularly in use. If this activity is accompanied by swapping then the system has memory problems.

A more severe indication of insufficient memory is swapping activity. To check swapping activity use the sar -w command. If bswot/s shows values that are consistently non-zero, this indicates that the system has a memory problem and is swapping.

Similarly, if the swap queue shows activity, then there are processes being swapped out to make memory available. If the entries for swpq-sz and %swpocc when running sar -q remain blank then no processes are being swapped and memory is sufficient. If swpq-sz is greater than zero, then the system has experienced swapping, and there are runnable processes on swap.

In some cases, it may do no harm for a few infrequently-used processes to be swapped out, such as the getty processes that are used for the console multiscreens. It does indicate, however, that your system is near to being chronically short of memory if it has to swap whole processes out to free up memory. See ``Paging'' and ``Swapping'' for a description of how the system frees pages of physical memory for use.

Finally, if either vhand or sched are showing a lot of processing time, indicated by the value of TIME when running ps -l, then this would suggest a lot of paging and swapping activity.

The following table is a summary of the commands that can be used to determine if a system is memory bound:

Table 4-1 Identifying a memory-bound system

 ---------------------------------------------------------------------
 Command      Field        Description
 ---------------------------------------------------------------------
 [mp]sar -p   rclm/s       pages added to the free list per second
 [mp]sar -q   %swpocc      percentage of time the swap queue is
                           occupied
              swpq-sz      number of processes on the swap queue
 [mp]sar -r   freemem      available user memory (4KB pages)
              freeswp      available swap space (512-byte blocks)
 [mp]sar -w   bswot/s      average number of pages written to swap per
                           second
 swap -l      blocks       total size of the swap area (512-byte
                           blocks)
              free         available swap space (512-byte blocks)
 ps -l -p 0   TIME         CPU time used by the swapper, sched 
 ps -l -p 2   TIME         CPU time used by the page stealer, vhand