How to Check Queue Activity (sar -q)
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 00:00:00 runq-sz %runocc swpq-sz %swpocc |
Note - The number of LWPs swapped out might be greater than zero even if the system has an abundance of free memory. This situation happens when a sleeping LWP is swapped out and has not been awakened (for example, a process or LWP is sleeping, waiting for keyboard or mouse input).
The following table describes the output from the -q option.
Table 24-15 Output From the sar -q Command
Field Name | Description |
---|---|
runq-sz | The number of kernel threads in memory that are waiting for a CPU to run. Typically, this value should be less than 2. Consistently higher values mean that the system might be CPU-bound. |
%runocc | The percentage of time that 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 abbreviated 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 might be required to obtain acceptable system response.
$ sar -q SunOS venus 5.9 Generic sun4u 06/24/2001 08:45:18 runq-sz %runocc swpq-sz %swpocc 08:45:18 unix restarts 09:00:00 1.0 0 0.0 0 09:20:00 0.0 0 0.0 0 09:40:00 0.0 0 0.0 0 Average 1.0 0 0.0 0 |
How to Check Unused Memory (sar -r)
Use the sar -r command to report the number of memory pages and swap-file disk blocks that are currently unused.
$ sar -r 00:00:00 freemem freeswap 01:00:00 2135 401922 |
The following table describes the output from the -r option.
Table 24-16 Output From the sar -r Command
Field Name | Description |
---|---|
freemem | The average number of memory pages that are available to user processes over the intervals sampled by the command. Page size is machine-dependent. |
freeswap | The number of 512-byte disk blocks that are available for page swapping. |
Example--Checking Unused Memory
The following example shows output from the sar -r command.
$ sar -r SunOS venus 5.9 Generic sun4u 06/24/2001 00:00:00 freemem freeswap 01:00:00 2135 401922 02:00:02 2137 401949 03:00:00 2137 402006 04:00:00 2139 401923 05:00:01 2138 402033 06:00:00 2137 401919 Average 2500 399914 |
How to Check CPU Utilization (sar -u)
Use the sar -u command to display CPU utilization statistics.
$ sar -u 00:00:00 %usr %sys %wio %idle 01:00:00 0 0 0 100 |
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 mode or system mode. When idle, the processor is either waiting for I/O completion or "sitting still" with no work to do.
The following table describes output from the -u option.
Table 24-17 Output From the sar -u Command
Field Name | Description |
---|---|
%usr | Lists the percentage of time that the processor is in user mode |
%sys | Lists the percentage of time that the processor is in system mode |
%wio | Lists the percentage of time that the processor is idle and waiting for I/O completion |
%idle | Lists the percentage of time that the processor is idle and not waiting for I/O |
A high %wio generally means that a disk slowdown has occurred.
Example--Checking CPU Utilization
The following example shows output from the sar -u command.
$ sar -u SunOS venus 5.9 Generic sun4u 06/24/2001 00:00:00 %usr %sys %wio %idle 01:00:00 0 0 0 100 02:00:02 0 0 0 100 03:00:00 0 0 0 100 04:00:00 0 0 0 100 05:00:01 0 0 0 100 06:00:00 0 0 0 100 07:00:00 0 0 0 100 08:00:01 0 0 0 100 08:20:00 0 0 0 100 08:40:00 0 0 0 100 09:00:00 0 0 0 100 09:20:00 0 0 0 100 09:40:00 0 0 0 100 10:00:00 0 0 0 100 10:20:00 0 0 0 100 10:40:01 0 0 0 100 11:00:00 5 2 10 82 Average 0 0 0 100 |
How to Check System Table Status (sar -v)
Use the sar -v command to report the status of the process table, inode table, file table, and shared memory record table.
$ sar -v 00:00:00 proc-sz ov inod-sz ov file-sz ov lock-sz 01:00:00 43/922 0 2984/4236 0 322/322 0 0/0 |
Output from the -v option is described in the following table.
Table 24-18 Output From the sar -v Command
Field Name | Description |
---|---|
proc-sz | The number of process entries (proc structures) that are currently being used, or allocated in the kernel. |
inod-sz | The total number of inodes in memory verses the maximum number of inodes that are allocated in the kernel. This number 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. |
ov | The number of shared memory record table entries that are 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 that are 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. |