Contained Within
Find More Documentation
Featured Support Resources
| Download this book in PDF
Monitoring Performance
71
- This chapter describes procedures for monitoring system performance by using the vmstat, iostat, df, and sar commands. This is a list of the step-by-step instructions in this chapter.
-
-
Displaying Virtual Memory Statistics
- You can use the vmstat command to report virtual memory statistics and such information about system events as CPU load, paging, number of context switches, device interrupts, and system calls. The vmstat command can also display statistics on swapping, cache flushing, and interrupts.
- For a detailed description of this command, refer to the vmstat(1M) man page.
· How to Display Virtual Memory Statistics
- Collect virtual memory statistics using the vmstat command with a time interval.
-
- In this command,
-
-n
- Is the interval in seconds between reports.
-
Table 71-1 describes the fields in the vmstat output.
-
Table 71-1 vmstat
| Category | Field Name | Description |
| procs |
| Reports the following states: |
| r | The number of kernel threads in the dispatch queue |
| b | Blocked kernel threads waiting for resources |
-
Table 71-1 vmstat(Continued)
| Category | Field Name | Description |
| w | Swapped out LWPs waiting for processing resources to finish |
| memory |
| Reports on usage of real and virtual memory: |
| swap | Available swap space |
| free | Size of the free list |
| page | Reports on page faults and paging activity, in units per second: |
| re | Pages reclaimed |
| mf | Minor and major faults |
| pi | Kbytes paged in |
| po | Kbytes paged out |
| fr | Kbytes freed |
| de | Anticipated memory needed by recently swapped-in processes |
| sr | Pages scanned by page daemon (not currently in use). If sr does not equal zero, the page daemon has been running. |
| disk | Reports the number of disk operations per second, showing data on up to four disks |
| faults | Reports the trap/interrupt rates (per second): |
| in | Interrupts per second |
| sy | System calls per second |
| cs | CPU context switch rate |
| cpu | Reports on the use of CPU time: |
| us | User time |
| sy | System time |
| id | Idle time |
Example--Displaying Virtual Memory Statistics
- The following example shows the vmstat display of statistics gathered at five-second intervals.
-
$ vmstat 5
procs memory page disk faults cpu
r b w swap free re mf pi po fr de sr f0 s3 -- -- in sy cs us sy id
0 0 8 28312 668 0 9 2 0 1 0 0 0 1 0 0 10 61 82 1 2 97
0 0 3 31940 248 0 10 20 0 26 0 27 0 4 0 0 53 189 191 6 6 88
0 0 3 32080 288 3 19 49 6 26 0 15 0 9 0 0 75 415 277 6 15 79
0 0 3 32080 256 0 26 20 6 21 0 12 1 6 0 0 163 110 138 1 3 96
0 1 3 32060 256 3 45 52 28 61 0 27 5 12 0 0 195 191 223 7 11 82
0 0 3 32056 260 0 1 0 0 0 0 0 0 0 0 0 4 52 84 0 1 99
|
· How to Display System Event Information
- Run vmstat -s to show the total of various system events that have taken place since the system was last booted.
-
$ vmstat -s
0 swap ins
0 swap outs
0 pages swapped in
0 pages swapped out
1329913 total address trans. faults taken
25270 page ins
3787 page outs
38082 pages paged in
13417 pages paged out
3034 total reclaims
3033 reclaims from free list
335879 micro (hat) faults
994034 minor (as) faults
24210 major faults
300634 copy-on-write faults
141744 zero fill page faults
34341 pages examined by the clock daemon
5 revolutions of the clock hand
28134 pages freed by the clock daemon
11174 forks
1259 vforks
9086 execs
11479519 cpu context switches
95234544 device interrupts
1426943 traps
9100502 system calls
1939346 total name lookups (cache hits 88%)
496 toolong
185566 user cpu
977189 system cpu
92045953 idle cpu
130914 wait cpu
|
· How to Display Swapping Statistics
- Run vmstat -S to show swapping statistics.
-
$ vmstat -S
procs memory page disk faults cpu
r b w swap free si so pi po fr de sr f0 s1 s3 -- in sy cs us sy id
0 0 0 6224 5536 0 0 0 0 0 0 0 0 0 0 0 2 9 12 0 1 99
|
- The additional fields are described in Table 71-2.
-
Table 71-2 vmstat -S
| Field | Description |
| si | Average number of LWPs swapped in per second |
| so | Number of whole processes swapped out |
-
Note - The vmstat command truncates the output of both of these fields. Use the sar command to display a more accurate accounting of swap statistics.
· How to Display Cache Flushing Statistics
- Run vmstat -c to show cache flushing statistics for a virtual cache.
-
$ vmstat -c
flush statistics: (totals)
usr ctx rgn seg pag par
14512 20201 0 1811 1857286 815505
|
- It shows the total number of cache flushes since the last boot. The cache types are described in Table 71-3.
-
Table 71-3 vmstat -c
| Cache Name | Cache Type |
| usr | User |
| ctx | Context |
| rgn | Region |
| seg | Segment |
| pag | Page |
| par | Partial-page |
· How to Display Interrupts Per Device
- Run vmstat -i to show interrupts per device.
-
Example--Displaying Interrupts Per Device
- The following example shows output from the vmstat -i command.
-
$ vmstat -i
interrupt total rate
---------------------------------
clock 104638405 100
esp0 2895003 2
fdc0 0 0
---------------------------------
Total 107533408 102
|
Displaying Disk Utilization Information
- Use the iostat command to report statistics about disk input and output, and produces measures of throughput, utilization, queue lengths, transaction rates, and service time. For a detailed description of this command, refer to the iostat(1M) man page.
· How to Display Disk Utilization Information
- You can display disk activity information by using the iostat command with a time interval.
-
$ iostat 5
tty fd0 sd1 sd3 cpu
tin tout Kps tps serv Kps tps serv Kps tps serv us sy wt id
0 0 0 0 0 1 0 79 0 0 58 0 1 0 99
|
- The first line of output shows the statistics since the last boot. Each subsequent line shows the interval statistics. The default is to show statistics for the terminal (tty), disks (fd and sd), and CPU (cpu).
-
Table 71-4 describes the fields in the iostat command output.
-
Table 71-4 iostat -n
| For Each ... | Field Name | Description |
| terminal | tin | Number of characters in the terminal input queue |
| tout | Number of characters in the terminal output queue |
| disk | bps | Blocks per second |
| tps | Transactions per second |
| serv | Average service time, in milliseconds |
| CPU | us | In user mode |
-
Table 71-4 iostat -n(Continued)
| For Each ... | Field Name | Description |
| sy | In system mode |
| wt | Waiting for I/O |
| id | Idle |
Example--Displaying Disk Utilization Information
- The following example shows disk statistics gathered every five seconds.
-
$ iostat 5
tty fd0 sd3 cpu
tin tout bps tps serv bps tps serv us sy wt id
0 1 0 0 0 1 0 5640 0 1 0 98
0 10 0 0 0 0 0 0 0 1 0 99
0 10 0 0 0 0 0 0 0 1 0 99
0 10 0 0 0 27 3 319 0 4 9 88
0 10 0 0 0 2 0 5061 0 0 0 99
0 10 0 0 0 0 0 0 0 0 0 100
0 10 0 0 0 0 0 0 0 0 0 100
0 10 0 0 0 0 0 0 0 0 0 100
0 10 0 0 0 0 0 0 0 0 0 100
|
· How to Display Extended Disk Statistics
- Run iostat -xtc to get extended disk statistics.
-
$ iostat -xtc
extended disk statistics tty cpu
disk r/s w/s Kr/s Kw/s wait actv svc_t %w %b tin tout us sy wt id
sd0 0.2 1.7 1.0 9.7 0.0 0.1 39.8 0 3 0 9 1 6 9 85
sd1 0.5 2.5 10.6 21.0 0.0 0.1 26.6 0 5
sd2 0.0 0.2 0.1 0.0 0.0 0.0 157.7 0 0
|
- This command displays a line of output for each disk. The output fields are described in Table 71-5.
-
Table 71-5 iostat -xtc
| Field | Description |
| r/s | Reads per second |
| w/r | Writes per second |
| Kr/s | Kbytes read per second |
| Kw/s | Kbytes written per second |
| wait | Average number of transactions waiting for service (queue length) |
| actv | Average number of transactions actively being serviced |
| svc_t | Average service time, in milliseconds |
| %w | Percentage of time the queue is not empty |
| %b | Percentage of time the disk is busy |
Displaying Disk Usage Statistics
- Use the df command to show the amount of free disk space on each mounted disk. The usable disk space reported by df reflects only 90% of full capacity, as the reporting statistics leave a 10% head room above the total available space. This head room normally stays empty for better performance.
- The percentage of disk space actually reported by df is used space divided by usable space.
- If the file system is above 90% capacity, transfer files to a disk that is not as full by using cp, or to a tape by using tar or cpio; or remove the files.
- For a detailed description of this command, refer to the df(1M) man page.
· How to Display File System Information
- Use the df -k command to display file system information in Kbytes.
-
$ df -k
filesystem kbytes used avail capacity mounted on
/dev/dsk/c0t3d0s0 17269 11099 4450 71% /
|
-
Table 71-6 describes the df -k command output.
-
Table 71-6 df -k
| Field Name | Description |
| kbytes | Total size of usable space in the file system |
| used | Amount of space used |
| avail | Amount of space available for use |
| capacity | Amount of space used, as a percent of the total capacity |
| mounted on | Mount point |
Example--Displaying File System Information
- The following example shows output from the df -k command.
-
$ df -k
filesystem kbytes used avail capacity mounted on
/dev/dsk/c0t3d0s0 17269 11099 4450 71% /
/dev/dsk/c0t3d0s6 136045 79818 42627 65% /usr
/proc 0 0 0 0 /proc
swap 40424 0 40416 0 /tmp
|
Monitoring System Activities
- For a detailed description of this command, refer to the sar(1) man page.
· How to Check File Access
- Display file access operation statistics with the sar -a command.
-
$ sar -a
SunOS venus 5.4 prefcs3 sun4c 11/11/94
14:28:12 iget/s namei/s dirbk/s
14:29:12 0 2 1
14:30:12 0 4 1
14:31:12 0 3 1
Average 0 3 1
|
- The operating system routines reported are described in Table 71-7.
-
Table 71-7 sar -a
| Field | Description |
| iget/s | The number of requests made for inodes that were not in the directory name lookup cache (dnlc). |
| namei/s | This is the number of file system path searches per second. If namei does not find a directory name in the dnlc, it calls iget to get the inode for either a file or directory. Hence, most igets are the result of dnlc misses. |
| dirbk/s | This is the number of directory block reads issued per second. |
- The larger the values reported, the more time the kernel is spending to access user files. The amount of time reflects how heavily programs and applications are using the file systems. The -a option is helpful for viewing how disk-dependent an application is.
· How to Check Buffer Activity
- 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
SunOS saturn 5.4 prefcs3 sun4c 01/24/95
00:00:03 bread/s lread/s %rcache bwrit/s lwrit/s %wcache pread/s pwrit/s
01:00:02 0 0 100 0 0 57 0 0
|
- The buffer activities displayed by the -b option are described in Table 71-8. The most important entries are the cache hit ratios %rcache and %wcache, which measure the effectiveness of system buffering. If %rcache falls below 90, or if %wcache falls below 65, it may be possible to improve performance by increasing the buffer space.
-
Table 71-8 sar -b
| Field | Description |
| bread/s | Average number of reads per second 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 found in the buffer cache (100% minus the ratio of bread/s to lread/s) |
| bwrit/s | Average number of physical blocks (512 blocks) written from the buffer cache to disk, per second |
| lwrite/s | Average number of logical writes to the buffer cache, per second |
| %wcache | Fraction of logical writes found in the buffer cache(100% minus the ratio of bwrit/s to lwrit/s) |
| pread/s | Average number of physical reads, per second, using character
device interfaces |
| pwrit/s | Average number of physical write requests, per second, using character device interfaces |
Example--Checking Buffer Activity
- The following example of sar -b output shows that the %rcache and %wcache buffers are not causing any slowdowns, because all the data is within acceptable limits.
-
$ sar -b
SunOS venus 5.4 prefcs3 sun4c 11/11/94
14:28:12 bread/s lread/s %rcache bwrit/s lwrit/s %wcache pread/s
pwrit/s
14:29:12 0 14 100 6 17 67 0 0
14:30:12 0 12 99 6 16 65 0 0
14:31:12 0 12 100 6 16 65 0 0
Average 0 12 100 6 16 66 0 0
|
· How to Check System Call Statistics
- Display system call statistics by using the sar -c command.
-
$ sar -c
SunOS saturn 5.4 prefcs3 sun4c 01/24/95
00:00:03 scall/s sread/s swrit/s fork/s exec/s rchar/s wchar/s
01:00:02 9 0 0 0.01 0.01 33 9
|
-
Table 71-9 describes the following system call categories 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 71-9 sar -c
| Field | Description |
| scall/s | All types of system calls per second (generally about 30 per second on a busy four- to six-user system). |
| 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 four-to six-user system); this number will increase if shell scripts are running. |
| exec/d | 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 example shows output from the sar -c command.
-
$ sar -c
Solaris mysys Solaris 2.5 sun4c 08/22/95
14:28:12 scall/s sread/s swrit/s fork/s exec/s rchar/s wchar/s
14:29:12 17 2 2 0.28 0.28 2527 1542
14:30:12 25 2 1 0.50 0.47 1624 295
14:31:12 21 2 2 0.35 0.35 1812 703
Average 21 2 2 0.38 0.37 1987 847
|
· How to Check Disk Activity
- Display disk activity statistics with the sar -d command.
-
$ sar -d
SunOS venus 5.4 prefcs3 sun4c 11/11/94
00:00:02 device %busy avque r+w/s blks/s avwait avserv
01:00:02 fd0 0 0.0 0 0 0.0 0.0
sd1 0 0.0 0 0 19.6 35.4
sd3 0 0.0 0 0 10.8 55.6
|
-
Table 71-10 describes the disk devices activities reported by the -d option. 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 written to the disk in a timely fashion.
-
Table 71-10 sar -d
| Field | Description |
| device | Name of the disk device 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 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 includes seek, rotational latency, and data transfer times) |
Examples--Checking Disk Activity
- These two examples illustrate the sar -d output. The first example is from a computer with a non-SCSI (Small Computer System Interface, pronounced "scuzzy") integral disk; that is, a disk that does not use a SCSI interface. This example illustrates data being transferred from a hard disk (hdsk-0) to the floppy disk (fdsk-0).
-
$ sar -d
Solaris mysys Solaris 2.5 sun4c 8/11/95
13:46:28 device %busy avque r+w/s blks/s avwait avserv
13:46:58 hdsk-0 6 1.6 3 5 13.8 23.7
fdsk-0 93 2.1 2 4 467.8 444.0
13:47:28 hdsk-0 13 1.3 4 8 10.8 32.3
fdsk-0 100 3.1 2 5 857.4 404.1
13:47:58 hdsk-0 17 .7 2 41 .6 48.1
fdsk-0 100 4.4 2 6 1451.9 406.5
Average hdsk-0 12 1.2 3 18 8.4 34.7
fdsk-0 98 3.2 2 5 925.7 418.2
|
- The following example is from a computer with SCSI integral disks; that is, disks that use a SCSI interface. The example illustrates data being transferred from one SCSI hard disk (sd00-0) to another SCSI integral disk (sd00-1).
-
$ sar -d
Solaris mysys Solaris 2.5 sun4c 8/11/95
14:16:24 device %busy avque r+w/s blks/s avwait avserv
14:16:52 sd00-0 2 1.0 1 3 0.0 17.9
sd00-1 6 1.1 3 5 2.0 23.9
14:17:21 sd00-0 2 1.0 1 2 0.0 19.6
sd00-1 6 1.1 3 5 0.2 24.3
14:17:48 sd00-0 3 1.0 1 3 0.3 18.3
sd00-1 7 1.1 3 5 1.3 25.4
14:18:15 sd00-0 3 1.0 1 3 0.0 17.2
sd00-1 5 1.0 2 5 0.0 21.6
Average sd00-0 2 1.0 1 3 0.1 18.2
sd00-1 6 1.0 3 5 0.9 23.0
|
· How to Check Page-Out and Memory
- Use the sar -g option reports page-out and memory freeing activities (in averages).
-
$ sar -g
SunOS saturn 5.4 prefcs3 sun4c 01/24/95
00:00:03 pgout/s ppgout/s pgfree/s pgscan/s %ufs_ipf
01:00:02 0.00 0.00 0.00 0.00 0.00
|
- The output displayed by sar -g is a good indicator of whether more memory may be needed. Use the ps -elf command to show the number of cycles used by the page daemon. A high number of cycles, combined with high values for pgfree/s and pgscan/s indicates a memory shortage.
-
sar -g also shows whether inodes are being recycled too quickly, causing a loss of reusable pages.
- Output from the -g option is described in Table 71-11.
-
Table 71-11 sar -g
| Field | 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 may 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, scanned by the page daemon. If this value is high, the page daemon is spending a lot of time checking for free memory. This implies that more memory may be needed. |
-
Table 71-11 sar -g(Continued)
| Field | Description |
| %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 is 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 may need to be increased. |
Example--Checking Page-Out and Memory
- The following example shows output from the sar -g command.
-
$ sar -g
Solaris mysys Solaris 2.5 sun4c 08/22/95
14:28:12 pgout/s ppgout/s pgfree/s pgscan/s %ufs_ipf
15:29:13 0.00 0.00 0.35 8.18 0.00
16:29:12 1.20 2.20 3.35 3.40 0.00
|
· How to Check Kernel Memory Allocation
- Use the sar -k command to report on the following activities of the Kernel Memory Allocator (KMA).
- The KMA allows a kernel subsystem to allocate and free memory as needed. Rather than statically allocating the maximum amount of memory it is expected to require under peak load, the KMA divides requests for memory into three categories: small (less than 256 bytes), large (512 to 4 Kbytes), and oversized (greater than 4 Kbytes). It keeps two pools of memory to satisfy small and large requests. The oversized requests are satisfied by allocating memory from the system page allocator.
- If you are investigating a system that is being used to write drivers or STREAMS that use KMA resources, then sar -k will likely prove useful. Otherwise, you will probably not need the information it provides. Any driver or module that uses KMA resources, but does not specifically return the resources before it exits, can create a memory leak. A memory leak causes the amount of memory allocated by KMA to increase over time. Thus, if the alloc
- fields of sar -k increase steadily over time, there may be a memory leak. Another indication of a memory leak is failed requests. If this occurs, a memory leak has probably caused KMA to be unable to reserve and allocate memory.
- If it appears that a memory leak has occurred, you should check any drivers or STREAMS that may have requested memory from KMA and not returned it.
-
$ sar -k
SunOS saturn 5.4 prefcs3 sun4c 01/24/95
00:00:03 sml_mem alloc fail lg_mem alloc fail ovsz_alloc fail
01:00:02 1245184 955332 0 3661824 2786336 0 2412544 0
|
- Output from the -k option is described in Table 71-12.
-
Table 71-12 sar -k
| Field | Description |
| sml_mem | The amount of memory, in bytes, that the KMA has available in the small memory request pool (a small request is less than 256 bytes). |
| alloc | The amount of memory, in bytes, that the KMA has allocated
from its small memory request pool to small memory requests. |
| fail | The number of requests for small amounts of memory that failed. |
| lg_mem | The amount of memory, in bytes, that the KMA has available in the large memory request pool (a large request is from 512 bytes to 4 Kbytes). |
| alloc | The amount of memory, in bytes, that the KMA has allocated from its large memory request pool to large memory requests. |
| fail | The number of failed requests for large amounts of memory. |
| ovsz_alloc | The amount of memory allocated for oversized requests (those greater than 4 Kbytes); these requests are satisfied by the page allocator--thus, there is no pool. |
| fail | The number of failed requests for oversized amounts of memory. |
Example--Checking Kernel Memory Allocation
- The following is an example of sar -k output.
-
$ sar -k
Solaris mysys Solaris 2.5 sun4c 08/22/95
14:28:12 sml_mem alloc fail lg_mem alloc fail ovsz_alloc fail
14:29:12 95232 73472 0 311296 198656 0 180224 0
14:30:12 95232 75120 0 311296 198656 0 180224 0
14:31:12 95232 73600 0 311296 197632 0 180224 0
Average 95232 74064 0 311296 198314 0 180224 0
|
· How to Check Interprocess Communication
- Use the sar -m command to report interprocess communication activities.
-
$ sar -m
SunOS solaris 5.4 prefcs3 sun4c 01/24/95
00:00:03 msg/s sema/s
01:00:02 0.00 0.05
|
- These figures will usually be zero (0.00), unless you are running applications that use messages or semaphores.
- The output from the -m option is described in Table 71-13.
-
Table 71-13 sar -m
| Field | Description |
| msg/s | The number of message operations (sends and receives) per second. |
| sema/s | The number of semaphore operations per second. |
Example--Checking Interprocess Communication
- The following example shows output from the sar -m command.
-
$ sar -m
Solaris mysys 2.0 sun4c 08/22/95
14:28:12 msg/s sema/s
14:29:12 0.00 0.00
14:30:12 0.00 0.00
14:31:12 0.00 0.00
Average 0.00 0.00
|
· How to Check Page-In Activity
- Use the sar -p command to report page-in activity which includes protection and translation faults.
-
$ sar -p
SunOS saturn 5.4 prefcs3 sun4c 01/24/95
00:00:03 atch/s pgin/s ppgin/s pflt/s vflt/s slock/s
01:00:02 0.00 0.00 0.00 0.49 1.20 0.00
|
- The reported statistics from the -p option are described in Table 71-14.
-
Table 71-14 sar -p
| Field | Description |
| atch/s | The number of page faults, per second, that are satisfied by reclaiming a page currently in memory (attaches per second). Instances of this include reclaiming an invalid page from the free list and sharing a page of text currently being used by another process (for example, two or more processes accessing the same program text). |
| pgin/s | The number of times, per second, that file systems receive page-in requests. |
| ppgin/s | The number of pages paged in, per second. A single page-in request, such as a soft-lock request (see slock/s), or a large block size, may involve paging-in multiple pages. |
| pflt/s | The number of page faults from protection errors. Instances of protection faults are illegal access to a page and "copy-on-writes." Generally, this number consists primarily of "copy-on-writes." |
| vflt/s | The number of address translation page faults, per second. These are known as validity faults, and occur when a valid process table entry does not exist for a given virtual address. |
| slock/s | The number of faults, per second, caused by software lock requests requiring physical I/O. An example of the occurrence of a soft-lock request is the transfer of data from a disk to memory. The system locks the page that is to receive the data, so that it cannot be claimed and used by another process. |
Example--Checking Page-In Activity
- The following example shows output from sar -p.
-
$ sar -p
Solaris mysys Solaris 2.5 sun4c 08/22/95
14:28:12 atch/s pgin/s ppgin/s pflt/s vflt/s slock/s
14:29:12 1.17 12.87 12.87 5.67 11.28 1.15
14:30:12 1.67 7.08 7.08 9.12 6.33 0.67
14:31:12 1.37 12.48 12.48 6.83 10.78 1.03
Average 1.40 10.81 10.81 7.21 9.46 0.95
|
· How to Check Queue Activity
- Use the sar -q command to report the average queue length while the queue is occupied, and the percentage of time that the queue is occupied.
-
$ sar -q
SunOS saturn 5.4 prefcs3 sun4c 01/24/95
00:00:03 runq-sz %runocc swpq-sz %swpocc
01:00:02 1.1 0
|
-
Note - The number of LWPs swapped out may greater than zero even if the system has an abundance of free memory. This happens when a sleeping LWP is swapped out and has not been awakened (for example, a process or LWP sleeping, waiting for the keyboard or mouse input).
- Output from the -q option is described in Table 71-15.
-
Table 71-15 sar -q
| Field | Description |
| runq-sz | The number of kernel threads in memory waiting for a CPU to run. Typically, this value should be less than 2. Consistently higher values mean that the system may be CPU-bound. |
| %runocc | The percentage of time the dispatch queues are occupied. |
| swpq-sz | The average number of swapped out LWPs. |
| %swpocc | The percentage of time LWPs are swapped out. |
Example--Checking Queue Activity
- The following example shows output from the sar -q command. If %runocc is high (greater than 90 percent) and runq-sz is greater than 2, the CPU is heavily loaded and response is degraded. In this case, additional CPU capacity may be required to obtain acceptable system response.
-
# sar -q
Solaris mysys Solaris 2.5 sun4c 08/22/95
14:28:12 runq-sz %runocc swpq-sz %swpocc
14:29:12 1.2 53 1 100
14:30:12 1.3 38
14:31:12 1.1 37
Average 1.2 43
|
· How to Check Unused Memory
- Use the sar -r command to report the number of memory pages and swap- file disk blocks that are currently unused.
-
$ sar -r
SunOS saturn 5.4 prefcs3 sun4c 01/24/95
00:00:03 freemem freeswap
01:00:02 983 187590
|
- Output from the -r option is described in Table 71-16.
-
Table 71-16 sar -r
| Field | Description |
| freemem | The average number of memory pages available to user processes over the intervals sampled by the command. Page size is machine-dependent. |
| freeswap | The number of 512-byte disk blocks available for page swapping. |
Example--Checking Unused Memory
- The following example shows output from the sar -r command.
-
$ sar -r
Solaris mysys Solaris 2.5 sun4c 08/22/95
14:28:12 freemem freeswap
14:29:12 268 3034
14:30:12 351 3009
14:31:12 297 3033
Average 306 3025
|
· How to Check CPU Utilization
- Display CPU utilization with the sar -u command.
-
$ sar -u
SunOS saturn 5.4 prefcs3 sun4c 01/24/95
00:00:03 %usr %sys %wio %idle
01:00:02 0 1 0 99
|
- (The sar command without any options is equivalent to sar -u.) At any given moment, the processor is either busy or idle. When busy, the processor is in either user or system mode. When idle, the processor is either waiting for I/O completion or "sitting still" with no work to do.
- Output from the -u option is described in Table 71-17.
-
Table 71-17 sar -u
| Field | Description |
| %sys | Lists the percentage of time that the processor is in system mode |
| %user | Lists the percentage of time that the processor is in user mode |
| %wio | Lists the percentage of time the processor is idle and waiting for I/O completion |
| %idle | Lists the percentage of time the processor is idle and is not waiting for I/O |
- A high %wio generally means a disk slowdown has occurred.
Example--Checking CPU Utilization
- The following example shows output from the sar -u command.
-
# sar -u
Solaris mysys Solaris 2.5 sun4c 08/22/95
14:28:12 %usr %sys %wio %idle
14:29:12 22 27 18 32
14:30:12 6 24 13 57
14:31:12 8 28 19 45
Average 12 27 17 45
|
· How to Check System Table Status
- Use the sar -v command to report the status of the process table, inode table, file table, and shared memory record table.
-
$ sar -v
SunOS saturn 5.4 prefcs3 sun4c 01/24/95
00:00:03 proc-sz ov inod-sz ov file-sz ov lock-sz
01:00:02 56/426 0 1311/1311 0 372/372 0 0/0
|
- Output from the -v option is described in Table 71-18.
-
Table 71-18 sar -v
| Field | Description |
| proc-sz | The number of process entries (proc structs) currently being used, or allocated in the kernel. |
| inod-sz | The total number of inodes in memory verses the maximum number of inodes allocated in the kernel. This is not a strict high water mark; it can overflow. |
| file-sz | The size of the open system file table. The sz is given as 0, since space is allocated dynamically for the file table. |
-
Table 71-18 sar -v(Continued)
| Field | Description |
| ov | The number of shared memory record table entries currently being used or allocated in the kernel. The sz is given as 0 because space is allocated dynamically for the shared memory record table. |
| lock-sz | The number of shared memory record table entries currently being used or allocated in the kernel. The sz is given as 0 because space is allocated dynamically for the shared memory record table. |
Example--Checking System Table Status
- The following example shows output from the sar -v command. This example shows that all tables are large enough to have no overflows. These tables are all dynamically allocated based on the amount of physical memory.
-
$ sar -v
Solaris mysys Solaris 2.5 sun4c 08/22/95
14:28:12 proc-sz ov inod-sz ov file-sz ov lock-sz
14:29:12 28/200 0 297/300 0 63/0 0 6/0
14:30:12 30/200 0 297/300 0 65/0 0 6/0
14:31:12 28/200 0 296/300 0 63/0 0 6/0
|
· How to Check Swap Activity
- Use the sar -w command to report swapping and switching activity.
-
$ sar -w
SunOS saturn 5.4 prefcs3 sun4c 01/24/95
00:00:03 swpin/s bswin/s swpot/s bswot/s pswch/s
01:00:02 0.00 0.0 0.00 0.0 12
|
- Target values and observations are described in Table 71-19.
-
Table 71-19 sar -w
| Field | Description |
| swpin/s | The number of LWP transfers into memory per second. |
| bswin/s | The average number of processes swapped out of memory per second. If the number is greater than 1, you may need to increase memory. |
| swpot/s | The average number of processes swapped out of memory per second. If the number is greater than 1, you may need to increase memory. |
| bswot/s | The number of blocks transferred for swap-outs per second. |
| pswch/s | The number of kernel thread switches per second. |
-
Note - All process swap-ins include process initialization.
Example--Checking Swap Activity
- The following example shows output from the sar -w command.
-
$ sar -w
Solaris mysys Solaris 2.5 sun4c 08/22/95
14:28:12 swpin/s pswin/s swpot/s pswot/s pswch/s
14:29:12 0.00 0.0 0.00 0.0 22
14:30:12 0.00 0.0 0.00 0.0 12
14:31:12 0.00 0.0 0.00 0.0 18
Average 0.00 0.0 0.00 0.0 18
|
· How to Check Terminal Activity
- Use the sar -y command to monitor terminal device activities.
-
$ sar -y
SunOS saturn 5.4 prefcs3 sun4c 01/24/95
00:00:03 rawch/s canch/s outch/s rcvin/s xmtin/s mdmin/s
01:00:02 0 0 0 0 0 0
|
- If you have a lot of terminal I/O, you can use this report to determine if there are any bad lines. The activities recorded are defined in Table 71-20.
-
Table 71-20 sar -y
| Field | Description |
| rawch/s | Input characters (raw queue), per second. |
| canch/s | Input characters processed by canon (canonical queue) per second. |
| outch/s | Output characters (output queue) per second. |
| rcvin/s | Receiver hardware interrupts per second. |
| xmtin/s | Transmitter hardware interrupts per second. |
| mdmin/s | Modem interrupts per second. |
- The number of modem interrupts per second (mdmin/s) should be close to zero, and the receive and transmit interrupts per second (xmtin/s and rcvin/s) should be less than or equal to the number of incoming or outgoing characters, respectively. If this is not the case, check for bad lines.
Example--Checking Terminal Activity
- The following example shows output from the sar -y command.
-
$ sar -y
Solaris mysys Solaris 2.5 sun4c 08/22/95
14:28:12 rawch/s canch/s outch/s rcvin/s xmtin/s mdmin/s
14:29:12 0 1 157 1 3 0
14:30:12 0 2 34 2 2 0
14:31:12 0 1 11 1 2 0
Average 0 1 67 1 2 0
|
· How to Check Overall System Performance
- Use the sar -A command to display a view of overall system performance.
- This provides a more global perspective. If data from more than one time segment is shown, the report includes averages.
· How to Set Up Automatic Data Collection
-
-
Become root.
-
Using the editor of your choice, open the /etc/init.d/perf file, which contains the sadc start-up instructions. Verify that the following lines are uncommented:
-
-
MATCH=`who -r|grep -c "[234][ ]*0[ ]*[S1]"`
if [ ${MATCH} -eq 1 ]
then
su sys -c "/usr/lib/sa/sadc /var/adm/sa/sa`date +%d`"
fi
- This version of the sadc command writes a special record that marks the time when the counters are reset to zero (boot time). The sadc output is put into the file sadd (where dd is the current date), which acts as the daily system activity record.
-
-
Using the editor of your choice, open the
/var/spool/cron/crontabs/sys file (the system crontab file). Uncomment the following lines:
-
-
# 0 * * * 0-6 /usr/lib/sa/sa1
# 20,40 8-17 * * 1-5 /usr/lib/sa/sa1
- The first entry writes a record to /var/adm/sa/sadd on the hour, every hour, seven days a week.
- The second entry writes a record to /var/adm/sa/sadd twice each hour during peak working hours: at 20 minutes and 40 minutes past the hour, from 8 a.m. to 5 p.m., Monday through Friday.
- Thus, these two crontab entries cause a record to be written to /var/adm/sa/sadd every 20 minutes from 8 a.m. to 5 p.m., Monday through Friday, and every hour on the hour otherwise. You can change these defaults to meet your needs.
|
|