Parameter description:
-A: total of all reports.
-U: CPU usage
-V: process, I node, file, and lock table status.
-D: hard disk usage report.
-R: Memory pages and hard disk blocks that are not in use.
-G: serial port I/O.
-B: Buffer usage.
-A: file read/write status.
-C: System Call status.
-R: Process activity.
-Y: terminal device activity.
-W: system exchange activity.
The following is an example.
Example 1: Use the command line Sar-U T N
For example, sample once every 60 seconds, sample 5 times in a row, observe the CPU usage, and save the sample result in binary format to AAA in the file in the current directory. Enter the following command:
# Sar-u-o aaa 60 5
Screen Display:
HP-UX c3700 B .11.00 A 9000/785 04/19/06
14:43:50% USR % sys % WIO % idle (-U)
14:44:50 0 1 4 94
14:45:50 0 2 4 93
14:46:50 0 2 2 96
14:47:50 0 2 5 93
14:48:50 0 2 2 96
Average 0 2 4 94
The displayed content includes:
% USR: Percentage of CPU time in user mode.
% SYS: Percentage of CPU time in system mode.
% WIO: Percentage of CPU waiting for input/output completion time.
% Idle: Percentage of idle CPU time.
In all the displays, we should pay attention to % WIO and % idle. The value of % WIO is too high, indicating that the hard disk has an I/O bottleneck. The value of % idle is high, indicating that the CPU is idle, if the % idle value is high but the system response is slow, it may be that the CPU is waiting for memory allocation. In this case, the memory capacity should be increased. % If the idle value is lower than 10, the CPU processing capability of the system is relatively low,
CPU is the most important resource in the system.
To view the content in the binary file AAA, type the following sar command:
# Sar-u-F aaa
It can be seen that the sar command can sample data in real time and query the previous sampling results.
Example 2: Use the command line Sar-V T N
For example, if you sample data every 30 seconds for five consecutive times and observe the status of the core table, enter the following command:
# Sar-V 30 5
Screen Display:
HP-UX c3700 B .11.00 A 9000/785 04/19/06
14:11:45 text-SZ ov proc-SZ ov inod-SZ ov file-SZ ov
14:12:15 N/A 89/2068 0 714/2772 0 506/4706 0
14:12:45 N/A 89/2068 0 651/2772 0 506/4706 0
14:13:15 N/A 89/2068 0 627/2772 0 506/4706 0
14:13:45 N/A 89/2068 0 695/2772 0 506/4706 0
14:14:15 N/A 89/2068 0 702/2772 0 506/4706 0
The displayed content includes:
Proc-SZ: Number of table items in the table currently being used or allocated in the core, controlled by the core parameter MAX-PROC.
Inod-SZ: the number of table items in the I-node table that are currently being used or allocated in the core.
MAX-INODE control.
File-SZ: the number of table items in the file table currently being used or allocated in the core, controlled by the core parameter MAX-FILE.
Ov: the number of overflow times.
Text-SZ :-----------
Lock-SZ: Number of table items that are currently being locked by or allocated records in the core, controlled by the core parameter MAX-FLCKREC.
The display format is actually table items/number of table items that can be used
The displayed content indicates that the core is completely normal. The three tables do not have overflow and the core parameters do not need to be adjusted. If overflow occurs, adjust the corresponding core parameters, increase the number of corresponding table items.
Example 3: Use the command line Sar-d t n
For example, if you want to sample a disk every 30 seconds and sample it for five consecutive times to report the device usage, you need to enter the following command to know which hard disk is busy:
# Sar-d 30 5
Screen Display:
Sco_sv scosysv 3.2v5.0.5 i80386 10/01/2001
11:06:43 device % busy avque R + w/s blks/s avwait avserv (-d)
11:07:13 wd-0 1.47 2.75 4.67 14.73 5.50 3.14
11:07:43 wd-0 0.43 18.77 3.07 8.66 25.11 1.41
11:08:13 wd-0 0.77 2.78 2.77 7.26 4.94 2.77
11:08:43 wd-0 1.10 11.18 4.10 11.26 27.32 2.68
11:09:13 wd-0 1.97 21.78 5.86 34.06 69.66 3.35
Average wd-0 1.15 12.11 4.09 15.19 31.12 2.80
The displayed content includes:
Device: the name of the block device being monitored by the sar command.
% Busy: percentage of requests sent when the device is busy.
Avque: the average number of incomplete requests when the queue is full.
R + w/s: the amount of data transferred to or from the device per second.
Blks/s: the number of transferred blocks per second, each of which is 512 bytes.
Avwait: the average time for sending requests to wait for the queue to be idle when the queue is full.
Avserv: Average time (in milliseconds) required to complete the transfer request ).
In the displayed content, the wd-0 is the name of the hard disk, % busy value is relatively small, indicating that the effective time for processing the transfer request is too small, the file system efficiency is not high, generally speaking, the % busy value is higher, the avque value is lower, and the file system efficiency is higher. If the % busy and avque values are relatively high, the hard disk transmission speed is too slow and needs to be adjusted.
If the value of a disk's % busy column is greater than 50%, the disk may have a bottleneck;
If the value of the avwait column of a disk is greater than that of the avserv column, the disk may have a bottleneck;
Example 4: Use the command line Sar-B T N
For example, if you sample the buffer every 30 seconds for five consecutive times and report the usage of the buffer, enter the following command:
# Sar-B 30 5
Screen Display:
Sco_sv scosysv 3.2v5.0.5 i80386 10/01/2001
14:54:59 bread/s lread/S % rcache bwrit/s lwrit/S % wcache pread/s pwrit/s (-B)
14:55:29 0 147 100 5 21 78 0 0
14:55:59 0 186 100 5 25 79 0 0
4 14:56:29 232 98 8 58 86 0 0
14:56:59 0 125 100 5 23 76 0 0
14:57:29 0 89 100 4 12 66 0 0
Average 1 156 99 5 28 80 0 0
The displayed content includes:
Bread/s: the number of physical blocks read from the hard disk to the System Buffer per second.
Lread/s: the average number of logical blocks read from the System Buffer per second.
% Rcache: Percentage of logical reads in buffer cache.
Bwrit/S: Average number of physical blocks written from the system buffer to the disk per second.
Lwrit/S: Average number of logical blocks written to the System Buffer per second.
% Wcache: Percentage of logical reads in buffer cache.
Pread/S: Average number of physical reads requested per second.
Pwrit/S: Average number of physical writes requested per second.
Among the displayed content, the most important columns are % cache and % wcache. Their values reflect the buffer usage efficiency, % rcache is less than 90 or % wcache is less than 65. The number of system buffers should be increased as appropriate. The number of buffers is controlled by the core parameter nbuf, so that % rcache reaches 90, % wcache reaches about 80. However, the value of the buffer parameter affects the I/O efficiency. To increase the buffer, the system efficiency should not be improved if the memory is large.
If the value of the % rcache column is less than 90%, and the value of the % wcache column is not between 70-80%, we must observe what applications are performing read/write operations in the system, do we need to increase the buffer size.
Example 5: Use the command line Sar-G T N
For example, if you want to sample data every 30 seconds for five consecutive times and report the serial I/O operations, enter the following command:
# Sar-G 30 5
Screen Display:
Sco_sv scosysv 3.2v5.0.5 i80386 11/22/2001
17:07:03 ovsiohw/s ovsiodma/s ovclist/s (-g)
17:07:33 0.00 0.00 0.00
17:08:03 0.00 0.00 0.00
17:08:33 0.00 0.00 0.00
17:09:03 0.00 0.00 0.00
17:09:33 0.00 0.00 0.00
Average 0.00 0.00 0.00
The displayed content includes:
Ovsiohw/S: serial port I/O hardware overflow per second.
Ovsiodma/S: overflow in the cache of the direct input/output channel of the serial port I/O per second.
Ovclist/S: overflow of character queues per second.
In the displayed content, the values in each column are zero, indicating that serial port I/O overflow does not occur in the system during the sampling time.
Example 6: Use the command line Sar-w t n
The SAR-W command can be used to analyze the activity of the swap area in the system.
Report activity for each block device, e.g ., disk or tape drive. one line is printed for each device that had activity during the last interval. if no devices were active, a blank line is printed. each line contains the following data:
Command
# Sar-W 1 5
Screen Display output
HP-UX l2000 B .11.00 A 9000/800 04/20/06
11:40:04 swpin/s bswin/s swpot/s bswot/s pswch/s
11:40:05 0.00 0.0 0.00 0.0 875
11:40:06 0.00 0.0 0.00 0.0 910
11:40:07 0.00 0.0 0.00 0.0 835
11:40:08 0.00 0.0 0.00 0.0 1389
11:40:09 0.00 0.0 0.00 0.0 848
Average 0.00 0.0 0.00 0.0 971
Description
Swpin/S: Number of process swapins per second;
Swpot/S: Number of process swapouts per second;
Bswin/S: Number of 512-byte units transferred for swapins per second;
Bswot/S: Number of 512-byte units transferred for swapouts per second;
Pswch/S: Number of process context switches per second.
Analysis of results:
If the value of swpin/s is greater than zero, the value of swpot must be noted;
Note the value of pswch/S. If the value is large, the process switches frequently.
Brief Introduction to HP-UX system optimization by Hawk. L
I mailto: hawkli@yahoo.com 34
SAR uses many SAR commands for system diagnostic flowcharts. Sometimes it is necessary to use several SAR commands to judge a problem. For example, it is suspected that there is a CPU bottleneck, from the perspective of SAR-U and Sar-Q, it is suspected that I/O has a bottleneck. From the perspective of SAR-B, Sar-u, and SAR-D, the five examples mentioned above are only part of the SAR functions.
Timex
The Timex Commands include the time and Timex commands. In HPUX, the two commands are basically the same, but Timex provides more information on UNIX of other versions.
The Timex command can report the time it takes to execute a command. Its output includes: actual time, user time, and system time.
The Timex command can be used to check the time used by the application.
Example 1: Observe the command used to compress the Core File
# Timex gzip Core
Output
Real 0.08
User 0.06
Sys 0.00
Show output description
Real refers to the amount of time actually spent running the program.
User refers to the amount of time spent in user mode.
Sys refers to the system time, that is, the amount of time that is not required by the program. For example, for the memory required by a program, 0.20 seconds of CPU request Memory Page switching time is spent.