How to Check Buffer Activity (sar -b)
Display buffer activity statistics with the sar -b command.
The buffer is used to cache metadata, which includes inodes, cylinder group blocks, and indirect blocks.
$ sar -b 00:00:00 bread/s lread/s %rcache bwrit/s lwrit/s %wcache pread/s pwrit/s 01:00:00 0 0 100 0 0 55 0 0 |
The following table describes the buffer activities that are displayed by the -b option.
Table 24-8 Output From the sar -b Command
Field Name | Description |
---|---|
bread/s | Average number of reads per second that are submitted to the buffer cache from the disk |
lread/s | Average number of logical reads per second from the buffer cache |
%rcache | Fraction of logical reads that are found in the buffer cache (100% minus the ratio of bread/s to lread/s) |
bwrit/s | Average number of physical blocks (512 blocks) that are written from the buffer cache to disk, per second |
lwrit/s | Average number of logical writes to the buffer cache, per second |
%wcache | Fraction of logical writes that are found in the buffer cache (100% minus the ratio of bwrit/s to lwrit/s) |
pread/s | Average number of physical reads, per second that use character device interfaces |
pwrit/s | Average number of physical write requests, per second that use character device interfaces |
The most important entries are the cache hit ratios %rcache and %wcache, which measure the effectiveness of system buffering. If %rcache falls below 90 percent, or if %wcache falls below 65 percent, it might be possible to improve performance by increasing the buffer space.
Example--Checking Buffer Activity
The following abbreviated example of sar -b output shows that the %rcache and %wcache buffers are not causing any slowdowns. All the data is within acceptable limits.
$ sar -b SunOS venus 5.9 Generic sun4u 06/24/2001 00:00:00 bread/s lread/s %rcache bwrit/s lwrit/s %wcache pread/s pwrit/s 01:00:00 0 0 100 0 0 55 0 0 02:00:02 0 0 100 0 0 55 0 0 03:00:00 0 0 100 0 0 72 0 0 04:00:00 0 0 100 0 0 56 0 0 05:00:01 0 0 100 0 0 55 0 0 06:00:00 0 0 100 0 0 55 0 0 Average 0 0 94 0 0 64 0 0 |
How to Check System Call Statistics (sar -c)
Display system call statistics by using the sar -c command.
$ sar -c 00:00:00 scall/s sread/s swrit/s fork/s exec/s rchar/s wchar/s 01:00:00 38 2 2 0.00 0.00 149 120 |
The following table describes the system call categories that are reported by the -c option. Typically, reads and writes account for about half of the total system calls, although the percentage varies greatly with the activities that are being performed by the system.
Table 24-9 Output From the sar -c Command
Field Name | Description |
---|---|
scall/s | All types of system calls per second (generally about 30 per second on a system with 4 to 6 users). |
sread/s | read system calls per second. |
swrit/s | write system calls per second. |
fork/s | fork system calls per second (about 0.5 per second on a system with 4 to 6 users). This number will increase if shell scripts are running. |
exec/s | exec system calls per second. If exec/s divided by fork/s is greater than three, look for inefficient PATH variables. |
rchar/s | Characters (bytes) transferred by read system calls per second. |
wchar/s | Characters (bytes) transferred by write system calls per second. |
Example--Checking System Call Statistics
The following abbreviated example shows output from the sar -c command.
$ sar -c SunOS venus 5.9 Generic sun4u 06/24/2001 00:00:00 scall/s sread/s swrit/s fork/s exec/s rchar/s wchar/s 01:00:00 38 2 2 0.00 0.00 149 120 02:00:02 38 2 2 0.00 0.00 149 120 03:00:00 42 2 2 0.05 0.05 218 147 04:00:00 39 2 2 0.01 0.00 155 123 05:00:01 38 2 2 0.00 0.00 150 120 06:00:00 38 2 2 0.01 0.00 149 120 Average 50 4 3 0.02 0.02 532 238 |
How to Check Disk Activity (sar -d)
Display disk activity statistics with the sar -d command.
$ sar -d 00:00:00 device %busy avque r+w/s blks/s avwait avserv 01:00:00 fd0 0 0.0 0 0 0.0 0.0 |
The following table describes the disk device activities that are reported by the -d option.
Table 24-10 Output From the sar -d Command
Field Name | Description |
---|---|
device | Name of the disk device that is being monitored |
%busy | Percentage of time the device spent servicing a transfer request |
avque | The sum of the average wait time plus the average service time |
r+w/s | Number of read and write transfers to the device, per second |
blks/s | Number of 512-byte blocks that are transferred to the device, per second |
avwait | Average time, in milliseconds, that transfer requests wait idly in the queue (measured only when the queue is occupied) |
avserv | Average time, in milliseconds, for a transfer request to be completed by the device (for disks, this value includes seek, rotational latency, and data transfer times) |
Note that queue lengths and wait times are measured when there is something in the queue. If %busy is small, large queues and service times probably represent the periodic efforts by the system to ensure that altered blocks are promptly written to the disk.
Examples--Checking Disk Activity
This abbreviated example illustrates the sar -d output.
$ sar -d SunOS venus 5.9 Generic sun4u 06/24/2001 00:00:00 device %busy avque r+w/s blks/s avwait avserv 01:00:00 fd0 0 0.0 0 0 0.0 0.0 nfs1 0 0.0 0 0 0.0 0.0 sd0 0 0.0 0 0 0.0 39.6 sd0,a 0 0.0 0 0 0.0 39.6 sd0,b 0 0.0 0 0 0.0 0.0 sd0,c 0 0.0 0 0 0.0 0.0 sd0,f 0 0.0 0 0 0.0 0.0 sd0,g 0 0.0 0 0 0.0 0.0 sd0,h 0 0.0 0 0 0.0 0.0 sd6 0 0.0 0 0 0.0 0.0 |
How to Check Page-Out and Memory (sar -g)
Use the sar -g command to display page-out and memory freeing activities (in averages).
$ sar -g 00:00:00 pgout/s ppgout/s pgfree/s pgscan/s %ufs_ipf 01:00:00 0.00 0.00 0.00 0.00 0.00 |
The output displayed by the sar -g command is a good indicator of whether more memory may be needed. Use the ps -elf command to show the number of cycles that are used by the page daemon. A high number of cycles, combined with high values for pgfree/s and pgscan/s, indicates a memory shortage.
The sar -g command also shows whether inodes are being recycled too quickly and causing a loss of reusable pages.
The following table describes the output from the -g option.
Table 24-11 Output From the sar -g Command
Field Name | Description |
---|---|
pgout/s | The number of page-out requests per second. |
ppgout/s | The actual number of pages that are paged-out, per second. A single page-out request might involve paging-out multiple pages. |
pgfree/s | The number of pages, per second, that are placed on the free list. |
pgscan/s | The number of pages, per second, that are scanned by the page daemon. If this value is high, the page daemon is spending a lot of time checking for free memory. This situation implies that more memory might be needed. |
%ufs_ipf | The percentage of ufs inodes taken off the free list by iget that had reusable pages associated with them. These pages are flushed and cannot be reclaimed by processes. Thus, this field represents the percentage of igets with page flushes. A high value indicates that the free list of inodes is page-bound, and the number of ufs inodes might need to be increased. |