|
|
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''.
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 |