In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
SAR-- one of the performance monitoring tools of Unix system
System environment:
Operating system: AIX 5.3.9
Oracle: Oracle 10gR2
SAR can be used to monitor Unix system performance and help us analyze performance bottlenecks. The sar tool is used as "sar [option] intervar [count]", where interval is the sampling time of statistics and count is the number of samples.
The following explains how to use sar to obtain the following performance analysis data:
Overall CPU usage statistics
Statistics of CPU usage
Memory usage statistics
Overall IPUBO situation
The situation of each Icano equipment
Network statistics
Common options include:
-b: report the usage of Iamp O and the transfer rate. (available only for kernels 2.5 and earlier, so the new kernel may not support this option)-B: report "page" usage-c: report process creation-d: report the usage of each block device (when you use it, you will find that there is a string in DEV similar to dev1-7 format, where 1 represents the main sequence number of the device and n represents the slave number of the device And the unit of rd_sec/s column and wr_sec/s column is 512bytes, which is 512B. That is, 0.5KB)-I: report outages-n: report network conditions-P: set CPU-q: report queue length and load information-r: report memory and switching area usage-R: report memory usage-u: report CPU usage-v: report I node, file and other kernel table information-w: report system context switching-x: statistics can be given for a particular PID You can specify the process ID number directly You can also specify SELF, which detects the sar process itself; if set to ALL, it reports all system process information. -X: report information about child processes of a specific PID.-y: set information about TTY devices.
Case study:
1. System environment
[root@aix211 /] # lspv
Hdisk0 00040f8aaa29d28e rootvg activehdisk1 000e1a6ce663b4af asmvg active
[root@aix211 /] # lsvg-l asmvg
Asmvg:LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINTlv_asm1 jfs 64 64 1 open/syncd N/Alv_asm2 jfs 64 64 1 open/syncd N/Alv_asm3 jfs 64 64 1 open/syncd N/Alv_asm4 jfs 64 64 1 open/syncd N/A
SQL > set linesize 120
SQL > select group_number,name,state from v$asm_diskgroup
GROUP_NUMBER NAME STATE--1 DG1 MOUNTED 2 RCY1 MOUNTED
SQL > select GROUP_NUMBER,DISK_NUMBER,STATE,NAME,PATH from v$asm_disk
GROUP_NUMBER DISK_NUMBER STATE NAME PATH--1 0 NORMAL DG1_0000 / dev/rlv_asm1 1 1 NORMAL DG1_0001 / dev/rlv_asm2 2 0 NORMAL RCY1_0000 / dev/rlv_asm3 2 1 NORMAL RCY1_0001 / dev/rlv_asm4
Establish ASMVG disk group and logical volume on hdisk1 disk, and establish ASM disk on the basis of logical volume
2. Database environment
SQL > set linesize 120
SQL > select file_id,file_name,tablespace_name from dba_data_files
FILE_ID FILE_NAME TABLESPACE_NAME 6 + DG1/prod/datafile/tbs2.265.853498689 TBS2 4 + DG1/prod/datafile/users.261.848857443 USERS 3 + DG1/prod/datafile/sysaux.258.848857287 SYSAUX 2 + DG1/prod/datafile/undotbs1.260.848857407 UNDOTBS1 1 + DG1/prod/datafile/system.257.848857161 SYSTEM 5 + DG1/prod/datafile/example.259.848857363 EXAMPLE
SQL > select file_id,file_name,tablespace_name from dba_temp_files
FILE_ID FILE_NAME TABLESPACE_NAME 2 + DG1/prod/tempfile/temp.262.848858041 TEMP
SQL > col member for A50
SQL > select group#,member from v$logfile order by 1
GROUP# MEMBER- 5 + DG1/prod/onlinelog/group_5.263.848858213 5 + RCY1/prod/onlinelog/group_5.256.848858217 6 + DG1/prod/onlinelog/group_6.264.848858253 6 + RCY1/prod/onlinelog/group_6.257.848858259
SQL > show parameter log
NAME TYPE VALUE-- log_archive_dest_1 string location=/arch/arch_prod
2. Case (perform data insertion)
SQL > select * from tab TNAME TABTYPE CLUSTERID---DEPT TABLEEMP TABLEBONUS TABLESALGRADE TABLEEMP1 TABLEDEPT1 TABLE6 rows selected.SQL > create table T1 (id int) Table created.SQL > begin 2 for i in 1.. 100000 loop 3 execute immediate 'insert into T1 values (' | | I | |)'; 4 end loop; 5 end; 6 / PL/SQL procedure successfully completed.
3. Monitor system performance
1) topas monitors the overall performance of the system
[root@aix211 /] # topas
Topas Monitor for host: aix211 EVENTS/QUEUES FILE/TTYMon Jul 21 15:36:07 2014 Interval: 2 Cswitch 137 Readch 1250 Syscall 5825 Writech 8473CPU User% Kern% Wait% Idle% Reads 9 Rawin 0ALL 50.2 0.2 3.2 46.2 Writes 3 Ttyout 281 Forks 0 Igets 0Network KBPS I-Pack O-Pack KB-In KB-Out Execs 0 Namei 20en0 0.6 4.5 1.0 0.3 0.4 Runqueue 3.5 Dirblk 0lo0 0.1 1.0 1.0 0.0 0.0 Waitqueue 0.0en1 0.0 0.0 0.0 PAGING MEMORYDisk Busy% KBPS TPS KB-Read KB-Writ Faults 11 Real MB 4096hdisk1 24.0 1.1K 13.0 0.0 1.1K Steals 0% Comp 37.7hdisk0 0.0 0.0 0.0 PgspIn 0% Noncomp 24.4hdisk3 0.0 0.0 0.0 PgspOut 0% Client 21.1hdisk2 0.0 0.0 0.0 0.0 PageIn 0cd0 0.0 0.0 0.0 PageOut 0 PAGING SPACE Sios 0 Size MB 4096Name PID CPU% PgSp Owner% Used 0.0oracle 544852 49.9 10.6 oracle NFS (calls/sec)% Free 100.0java 331954 0.1 20.3 root ServerV2 0topas 344118 0.1 1.5 root ClientV2 0 Press:ocssd.bi 364724 0 .027.6 oracle ServerV3 0 "h" for helporacle 418002 0.09.4 oracle ClientV3 0 "Q" to quitoracle 389330 0.013.9 oraclepnsd 311512 0.00.5 root gil 49176 0.00.1 root oracle 196688 0.010.5 oraclenfsd 151682 0.0 0.3 root oracle 327908 0.0 7.5 oraclejava 295068 0.0 36.6 root rpc.lock 237718 0.0 0.2 rootoracle 377064 0.0 7.4 oracleoracle 503854 0.0 12.4 oraclexntpd 192620 0.0 0.4 rootoracle 446498 0.0 12.3 oracleoracle 356372 0.0 8.0 oracleoracle 409802 0.0 7.3 oracleoracle 380952 0.0 8.0 oracle
As you can see, oracle users consume most of the resources
2) View the resource usage of cpu separately (2 cpu)
[root@aix211 /] # sar-P 0 22
AIX aix211 3 5 00040F8A4C00 07/21/14System configuration: lcpu=2 mode=Capped 15:37:09 cpu% usr% sys% wio% idle15:37:11 00 1 9 9015 lcpu=2 mode=Capped 37 00 1 21 78Average 01 1 15 84
[root@aix211 /] # sar-P 1 22
AIX aix211 3 5 00040F8A4C00 07/21/14System configuration: lcpu=2 mode=Capped 15:37:20 cpu% usr% sys% wio% idle15:37:22 1 99 10 015 lcpu=2 mode=Capped 37 lcpu=2 mode=Capped 24 1 99 10 0Average 1 100 000 the main statistical items are as follows:% user: user mode CPU usage Time ratio% system: kernel state CPU usage time% iowait: CPU wait for Imax O occupancy rate% idle: CPU idle time ratio
3) View disk Ibank O
[root@aix211 /] # sar-d 2 2
AIX aix211 3 5 00040F8A4C00 07/21/14System configuration: lcpu=2 drives=5 mode=Capped 15:37:49 device% busy avque r+w/s Kbs/s avwait avserv15:37:51 hdisk0 0 0.0 00 0.0 hdisk2 0 0.0 00 0.0 hdisk3 0 0.0 0 0 0.0 0.0 hdisk1 7 0.0 4 47 12.2 17.0 cd0 0 0.0 0 0 0.0 0.015:37:53 hdisk0 0 0.0 0 0 0.0 0. 0 hdisk2 0 0.0 0 0 0.0 0.0 hdisk3 0 0.0 0 0 0.0 0.0 hdisk1 24 1.1 13 1033 169.4 18.3 cd0 0 0.0 0 0 0.0 0.0Average hdisk0 0 0.0 0 0 0.0 0.0 hdisk2 0 0.0 0 0 0.0 0.0 hdisk3 0 0.0 0 0 0.0 0.0 hdisk1 15 0 . 6 8 540 90.8 17.7 cd0 0 0.0 0 0 0.0 0.0
[root@aix211 /] # sar-b 2 2
AIX aix211 3 5 00040F8A4C00 07/21/14System configuration: lcpu=2 mode=Capped 15:18:49 bread/s lread/s% rcache bwrit/s lwrit/s% wcache pread/s pwrit/s15:18:51 000000 0 1315 purl 18l000000 0 0Average 0 The columns above 0000006 mean: tps: the number of requests for data from the disk device per second Including read and write requests, which are the sum of rtps and wtps. For the sake of efficiency, instead of processing requests immediately after each IO is issued, requests are merge, where tps refers to the number of requests merged. Rtps: number of read requests per second to disk devices wtps: number of write requests per second to disk devices bread: number of bytes read from disk per second bwrtn: number of bytes written to disk per second
[root@aix211 /] # iostat 2 2
System configuration: lcpu=2 drives=5 paths=1 vdisks=0tty: tin tout avg-cpu:% user% sys% idle% iowait 0.0 29.049.7 1.0 35.8 13.5Disks:% tm_act Kbps tps Kb_read Kb_wrtnhdisk0 0.0 0.000 0hdisk2 0.0 0.0 0.0 0 0hdisk3 0.0 0.0 0.0 0 0hdisk1 29.0 1214.0 15.0 0 2428cd0 0.0 0.0 0.0 0 0tty: Tin tout avg-cpu:% user% sys% idle% iowait 0.0 260.5 49.7 0.849.5 0.0Disks:% tm_act Kbps tps Kb_read Kb_wrtnhdisk0 0.0 0.0 0hdisk2 0.0 0.0 0.0 0 0hdisk3 0.0 0.0 0.0 0 0hdisk1 0.0 0.0 0.0 0 0cd0 0.0 0.0 0.0 0 0
[root@aix211 /] # iostat-D
System configuration: lcpu=2 drives=5 paths=1 vdisks=0hdisk0 xfer:% tm_act bps tps bread bwrtn 1.0 34.1K 2.6 7.4K 26.7K read: rps avgserv minserv maxserv timeouts fails 1.1 4.1 0.1 195.6 0 0 write: wps avgserv minserv maxserv timeouts fails 1.5 8.8 0.4 83.4 0 0 queue: avgtime mintime maxtime avgwqsz avgsqsz sqfull 18.9 0.0 679.0 0.0 0.0 0.9hdisk2 xfer:% tm_act bps tps bread bwrtn 0.0 0.0 0.0 read: rps avgserv minserv maxserv timeouts fails 0.0 0.0 0.0 0 0 write: wps avgserv minserv maxserv timeouts fails 0.0 0.0 0.0 0 0 queue: avgtime mintime maxtime avgwqsz avgsqsz sqfull 0.0 0.0 0.0 0.0 0.0 0.0hdisk3 xfer:% tm_act bps tps bread bwrtn 0.0 0.0 0.0 read: rps avgserv minserv maxserv timeouts fails 0.0 0.0 0.0 0 0 write: wps avgserv minserv maxserv timeouts fails 0.0 0.0 0.0 0 0 queue: avgtime mintime maxtime avgwqsz avgsqsz sqfull 0.0 0.0 0.0 0.0 0.0 0.0hdisk1 xfer:% tm_act bps tps bread bwrtn 9.1 1.1M 49.6 1.0M 66.5K read: rps avgserv minserv maxserv timeouts fails 46.10 . 6 0.2 39.9 0 0 write: wps avgserv minserv maxserv timeouts fails 3.4 18.1 3.8 85.5 0 0 queue: avgtime mintime maxtime avgwqsz avgsqsz sqfull 12.1 0. 0 5.8S 0.3 0.0 49.6cd0 xfer:% tm_act bps tps bread bwrtn 0.0 0.0 0.0-- -
4) View memory usage
[root@aix211 /] # sar-r 2 2
AIX aix211 3 5 00040F8A4C00 07/21/14System configuration: lcpu=2 mem=4096MB mode=Capped 15:38:12 slots cycle/s fault/s odio/s15:38:14 1046571 0.00 44.00 0.0015 slots cycle/s fault/s odio/s15:38:14 38 AIX aix211 16 1046571 0.001 3.00 0.00Average 1046571 0 28 0 the output memory unit is "kb"
@ as can be seen in the above cases, the resources of iUnip O are all on hdisk1, and hdisk1 is the storage disk (ASM disk group) of datafile and redolog, so when doing DML operation, a large number of iUnip O.
Note:
How does SAR control the interval and frequency of information output?
There are two parameters that are very infrequently used, namely "interval" and "number of outputs".
The interval represents the time interval, in seconds, between two outputs of information. If this value is set to 0, it means that the output information is the average of the information from boot to now. If it is not 0Percentsar, the calculation is the average of the information from the current start.
The number of times output represents the number of times the system information is output, and the default is 1 time. If this value is set to 0, it will be output forever.
For example: sar 605 means output every 60 seconds, a total of 5 times.
How to save the useful information output from sar into a file?
Sar specifically provides an option-o filename, you just need to use it!
Such as sar 5 6-o sys_info
However, unfortunately, when you use cat to read sys_info, it is all garbled, hehe, don't worry, sar has prepared the-f filename option for you, as long as you use-f to set the information to be read to store the file, you can read the message clearly.
Such as sar-f sys_info.
If you think this format is a little difficult to deal with, try adding the-h option and you will get a different experience.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.