Tuning memory resources

Increasing memory by reducing the buffer cache size

WARNING: Reducing the size of the buffer cache to increase the amount of available memory may degrade the system's disk I/O performance.

If sar -b (or mpsar -b for SMP) shows that the %rcache and %wcache hit rates are consistently high, memory may be regained for use by user processes by reducing the size of the buffer cache. (See ``How the buffer cache works'' for a description of its operation.)

It is not possible to recommend minimum values for the read and write hit rates. It depends on the amount of extra disk I/O that will be generated and the performance characteristics of the system's disks. Reducing the buffer cache hit rates also means that more processes have to wait for I/O to complete. This increases the total time that processes take to execute and it also increases the amount of context switching on the system.

You may, for example, decide that you can tolerate reducing current hit rate values of %rcache from 95% to 90% and %wcache from 65% to 60% provided that your system's disks can cope with the increased demand and also that any deterioration in the performance of applications is not noticeable.

The current number of buffers in use is controlled by the value of the kernel parameter NBUF. If this is set to 0, the system determines the number automatically at system startup. The number of buffers is displayed in the startup messages and recorded in the file /usr/adm/messages.

Adjusting the value of NBUF should be done as an iterative process in conjunction with running sar -b to look at the buffer cache hit rates. If the number of writes (bwrit) is low compared with the number of reads (bread), less significance should be attached to the %wcache hit rate. You can monitor any resulting increase in disk activity using the -d option to sar (or mpsar) as described in ``Viewing disk and other block I/O activity''.

NOTE: If you change the value of NBUF, you should also modify the value of the NHBUF parameter to an appropriate value. See ``Increasing disk I/O throughput by increasing the buffer cache size'' for more information.

The following table summarizes the commands that you can use to view buffer cache activity:

Viewing buffer cache activity

Command Field Description
[mp]sar -b bread number of 1KB blocks read per second from block devices
  lread number of 1KB blocks read per second from system buffers
  %rcache percent of disk blocks found in the buffer cache when reading
  bwrit number of 1KB blocks written per second to block devices from the buffer cache
  lwrit number of 1KB blocks written per second to system buffers
  %wcache percent of disk blocks found in the buffer cache when writing

Next topic: Investigating memory usage by system tables
Previous topic: Reducing disk activity caused by swapping and paging

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003