SAR is in maintaining the use of the use of UNIX

xiaoxiao2021-03-06  78

sar use in the maintenance of UNIX explain http://www.douzhe.com Author: mzd73 Posted: 2002-11-01 20:57:35

System maintenance in UNIX is used in the process of using the UNIX operating system, we often use a variety of problems, such as system running speeds suddenly slow, the system is easy to crash or the terminal belt often crashed At this time, we often guess that the hard disk space is too small, or the memory is insufficient? I / O appears bottlenecks, or the core parameters of the system have problems? At this time, we should consider the use of the system to give us the SAR command to make a understanding of the system, which is an important tool for system maintenance, mainly to help us master the usage of system resources, especially the use of memory and CPU, is One of the tools that UNIX systems should master. Common format of the SAR command line: SAR [options] [-a] [-o file] t [n] In the command line, the N and T are combined to define the sampling interval and the number of times, T is the sampling interval, it is necessary There is a number of parameters, n is the number of sampling, and the default is 1, and the -o file represents the command result in the binary format in the file, and the file is not a keyword here, which is the file name. Options is a command line option, there are many options for the SAR command, and only common options are listed below: -a: The sum of all reports. -U: CPU utilization -V: process, i node, file, and lock status. -D: Hard disk use report. -R: There is no memory page and hard disk block. -G: The case of serial port I / O. -B: Buffer usage. -A: File read and write conditions. -C: System call condition. -R: The activity of the process. -Y: Terminal equipment activity. -W: System exchange activities. The following will be an example. Example 1: Use the command line SAR -U T n, for example, sample once every 60 seconds, continuously sampled 5 times, observe the use of the CPU, and store the sample results in binary form in the current directory in the current directory, you need to type as follows Command: # sar -u -o zhou 60 5 screen display: SCO_SV ScoSysv 3.2V5.0.5 i80386 10/01/2001 14:43:50% USR% SYS% WIO% IDLE (-U) 14:44:50 0 1 4 94 14:45:50 0 2 4 96 14:47:50 0 2 5 93 14:48:50 0 2 2 96 Average 0 2 4 94 In display included:% usr : The CPU is percentage of time in user mode. % SYS: CPU is in system mode for time percentage. % Wio: CPU Wait for the percentage of input and output completion time. % IDLE: CPU free time percentage. In all the display, we should mainly pay attention to the% WIO and% IDLE, the% WIO value is too high, indicating that the hard disk has I / O bottleneck,% IDLE value, indicating that the CPU is free, if the% IDLE value is high but the system responds slow When it is possible that the CPU is waiting to allocate memory, and the memory capacity should be increased.

The% IDLE value is relatively low if the system's CPU processing capability is relatively low, and the resources most solved in the system are the CPU. If you want to see the contents in the binary zhou, you need to type the following SAR command: # sar -u -f 可, the SAR command can be sampled in real time, and the previous sampling result can be queried. Example 2: Use the command line SAR -V T N, for example, sample once every 30 seconds, continuously sample 5 times, observe the status of the core table, need to type the following command: # SAR -V 30 5 screen display: SCO_SV Scoosysv 3.2V5.0.5 I80386 10/01/2001 10:33:23 PROC-SZ OV Inod-SZ OV File-Sz Ov Lock-SZ (-V) 10:33:53 305/321 0 1337/2764 0 1561/1706 0 40/128 10:34:23 308/321 0 1340/2764 0 1587/1706 0 37/128 10:34:53 305/321 0 1332/2764 0 1565/1706 0 36/128 10:35:23 308/321 0 1338 / 2764 0 1592/1706 0 37/128 10:35:53 308/321 0 1335/2764 0 1591/1706 0 37/128 Display includes: proc-sz: Table of process tables currently in use or allocated in the core The number of items is controlled by the core parameter MAX-PROC. Inod-sz: The number of item INOD tables in the current core is currently in use or allocated by the core parameter MAX-INODE. FILE-SZ: The number of items of the file table that is in use or allocated in the core is controlled by the core parameter Max-File. OV: Overflows the number of occurrences. LOCK-SZ: The number of items that are locked or allocated in the current core is controlled by the core parameter MAX-FLCKRE. The display format is the actual user entry / the number of items that can be used. Increase the corresponding number of items. Example 3: Use the command line SAR-D T N, for example, sample once every 30 seconds, continuously sampled 5 times, report the device usage, you need to type the following command: # SAR -D 30 5 Screen display: SCO_SV Scoosysv 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 Display includes: Device: SAR command The name of block devices being monitored.

% busy: When the device is busy, the percentage of the time to transfer the request. AVQUE: The average of the request quantity is not completed when the queue station is full. R W / S: The amount of data sent from the device or from the device per second. BLKS / S: The number of blocks transmitted per second, 512 bytes per block. Avwait: The queue is sent to the average time to wait for the queue idle. AVSERV: The average time (milliseconds) required to complete the transfer request. In the displayed content, WD-0 is the name of the hard disk, and the value of% busy is relatively small, which means that there is too little effective time for processing transmission requests, and the file system is not high. Generally, the% busy value is high. The value of the AVQUE is low, the file system is relatively high, if the% busy and AVQUE values ​​are relatively high, indicating that the hard disk transfer speed is too slow, need to be adjusted. Example 4: Using the Direct SAR -B T N, for example, sampling every 30 seconds, continuous sampling 5 times, reporting the usage of the buffer, you need to type the following command: # SAR -B 30 5 Screen display: SCO_SV Scoosysv 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 5 25 79 0 0 14:56:29 4 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 0 0 0 0 0 Display includes: BREAD / S: The number of physical blocks read from the hard disk read from the hard disk. LREAD / S: The number of logical blocks read from the system buffer per second. % Rcache: Percentage of logically read in Buffer Cache. BWRIT / S: The number of physical blocks written from the system buffer per second. LWRIT / S: Write an average of the number of system Buffer logic blocks per second. % WCache: Percentage of logically read in Buffer Cache. PREAD / S: Average the number of times of physical reading per second. PWRIT / S: The average number of times of physical writing is requested per second. In the content displayed, the most important is the two columns of% cache and% wcache, which reflects the efficiency of the buffer, the value of% RCache is less than 90 or% of the value of the WCache is less than 65, and the system Buffer should be added appropriately The quantity, the number of buffers is controlled by the core parameter NBUF, so that% rcache reaches around 90,% wcache reaches around 80. However, the Buffer parameter value affects I / O efficiency, increasing the buffer, should not improve the system efficiency in the case of large memory, otherwise the system efficiency is not improved.

转载请注明原文地址:https://www.9cbs.com/read-93407.html

New Post(0)