ITPub博客

首页 > 数据库 > Oracle > OS Performance分析

OS Performance分析

原创 Oracle 作者:a960549548 时间:2024-04-07 17:59:09 0 删除 编辑

OS Per

Computer Systems  thr— areas of qua•e/rv contentm  CPU process scheduling  SMP architectures have multiple physical CPUs  More processes can run than CPUs exist  Some sharing scheme must exist  Disk is shared by processes  Disk is notoriously slow  Concurrent access is common  Limited by physics  Memory  Virtual memory ensures processes won't run out  Provides more logical memory than physical  VM also is limited by physics

 

        如果数据库没有等待,SQL没有什么问题,那就要归结操作系统的问题。当你没什么方向,就要看看操作系统了。一般的troubleshooting过程就像洗被单子先勾起一个大框来,扔水里大面积揉搓,然后再具体哪里脏着重的洗。

        首先要看看topas :CPU、IO、Memory 比如CPU较高,那么对你troubleshooting Database更有帮助,比如CPU有Ready Queue(RUN Q),swap很高,内存消耗很大,那么你就会有针对性的看AWR了。因为操作系统是所有软件的运行平台。

调用操作系统的call,申请内存,使用内存,使用IO,Oracle直接用操作系统的API,这就是为什么从操作系统上可以看出数据库的问题。

CPU  Process  Ready  CPU  (nnning process) •  Processes are Scheduled based on:  Time Sharing weighted by Priority  (sleeping)  Priorny is dynamic, processes  that have not run for a long  time get priority boosted

 

Vmstat(对所用的CPU)

vmstat的第一列、Ready queue 排队的地方,如果不工作了,就Suspend等着。

 

ProcessDump里有call stack trace

AIX的

S umstat 2 20  system configuration:  cpu—16 man—412101B  kthr  1  man ory  page  pi po fr  o  o  o  o  o  o  faults  sr cy  cpu  sy Id wa  avtn  0 5546592  0 5546592  0 5546592  0 5546595  0 5546594  0 5546594  0 5546594  0 5546594  fre re  22479  22479  22479  22476  22477  22477  22477  22477  o  o  o  o  o  o  In  1  14  30  12  0 125  sv cs us  232 214  30 194  36 196  340 225  209 207  8643 247  34345 205  47325 434  o  o  10  11  0 99  0 99  0 99  0 98  1 89

 

Resident Connection Pool 11g新功能没有用。

CPU Bound? — vmstat evidence  0 222924  0 223244  0 223892  27204  92g  9624  buff  L 0984 e  L09•ag  32040  320620  '20628  '20628  '20628  3207%  32  103'  0 1030  66  1036  904  1042  61  1040  201  64  96  92  99  It is very easy to confuse VM problems  with CPU, or even I/O problems

 

当r大于cpu数的时候,说明有1个process在等待,在q中没有调用到cpu中工作,这个vmstat是看整体的cpu的,和单个进程是有区别的,我们用topas看单个进程的cpu使用。

B如果高一般是IO阻塞了CPU。

swpd是swap的使用,free是空闲的内存。

 

Sometimes, time gets "lost" in run queue  from sq/ trace raw me even O  PARA  —zoooo  vmstat run queue = O  vmstat run queue 10  , , , 62144B  CPU time consumed  by this event  (rounded in Linux)  Event time, from  process instrumentation  (taken from OS)  Note: in Linux  CPU time is  only accurate  to nearest  10,000 us, while  elapsed time (e=)  is taken from system  microsecond timer  at end of each event

 

C是消耗的cpu时间ms,e是强钟时间。

Mpstat(每块cpu的情况)

mpstat -A

-1 1 , 01 201m 年 01 11  。 时 49 分 4 。 秒  。 时 分 4 。 秒  0 吋 分 40 秒  1205 , 10

 

 

οο•ποτ  00 • 900Τ  οο • 900Τ  ΟΟ • 500 t  οο "οιτ  οο•οοοτ  οο•86  οο•ο  os•o  οο•ο  οο•ο  os•o  οο•ο  οο•ο  οο•ο  οο•ο  οο•ο  oo•o  oo•o  oo•o  oo•o  oo•o  oo•o  oo•o  οο•ο  ος•ο  οο•ο  οο•ο  ος•ο  οο•ο  οο•ο  ΟΟ • Ο  ΟΟ • T  ΟΟ • T  οο•ε6  οο•ο  os•o  οο•ο  οο•ο  οο•ο  οο•ο  os•o  οο•ο  ος•ο  οο•ο  οο•ο  οο•ο  66 •  Το- T  οο•0  οο•ο  οο •  ος •  00 •OOT  ττε  ΤΤξ  τ τε  ΤΤξ  ΚΥ  ST01/6T/L0 ςτ  ΟΤ

 

τηρςΤαΤ 2 20  5yStgr conffguraT50n: ncpu—32  cpu  12  14  16  22  26  28  ηΙ1η maj mpc  1193  2 1332  115  2412  136  159  5889  886  46  112  174  22  57  161  49  152  113  263  114  ο 3159  1689  19  543  107  185  92  19  141  101  413  52  Ι 64  135  3873  1cs  844  270  46  10  71  71  51  201  81  1933  r q m1g  9 100  2 100  99  1 100  1  99  1  99  1  99  1  95  98  99  98  89  99  ο 100  87  98  1  99  0 100  52  99  sysc  1512  77  41  9 53  429  1  453  1  171  64  1  332  1  486  1  415  1  171  998  1  38  90  205  1  249  35  451  41  0 92  7057  21  1d  SY wT  ο 22 0.82  ο 100 0.18  0 58 0.43  0 45 0.56  ο 98 0.51  0 0.49  99 0.52  ο 100 0.50  98 0.50  0 0.50  4 96 0.50  ο 100 0.50  0 99 0.50  0 0 100 0.50  ο 99 0.50  ο 100 0.50  0 98 0.50  0 100 0.50  2 98 0.50  o 0.50  0 98 0.50  ο 100 0.49  8 0.92  0 0 100 0.08  ο 98 0.50  ο 100 0.50  0 0 100 0.41  ο 58 0.63  ο 100 0.26  8 0.93  ο 100 0.05  ο 79 16.00  1  1  1  1  1  1  1  1  1  1

 

Pstack

能看到Oracle内部的函数调用,判断hang的时候很有用的。一般都是极端的hang的情况哈。

declare

     icount number ;

begin

     loop

       select count (*) into icount from dba_objects where object_name like '%G%' ;

     end loop ;

end ;

然后我们看top,进程是19941,pstack 19441。

 

큼l罾##盞  m격웊들웊를&晷부矍4矍4부賣부부부극극극극극쳒극극豈豈豈혍혍혍씜國존4咠  袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋袋  。딈。§§쳥§§§흃쳥쳥#뤍경뿛뿛쳥쳥쁋형형형형형경§흰

 

Strace –p

没用过~

Errorstack

What if process is "oracle"?  outside, 'Iside, back mats-ide  Find top CPU process — oracle is usually  owner  Get sqlplus session, connect as sysdba:  oradebug setospid <1111Pid  oradebug unlimit  oradebug dump errorstack 10  Go find trace file on udump

 

oradebug setospid 19941

oradebug unlimit

oradebug dump errorstack 10

oradebug tracefile_name

/ u01 / app / oracle / diag / rdbms / prod / prod / trace / prod_ora_19941.trc

 

Errorstack要收集两次

 

Trace file example  Dump r outmes,  Invoked by  Sue*  o .27  0.73'  00000  Note Oracle functions,  not Linux kernel  'C26SO  12 -1 3  "2"280 O 0  11

 

Virtual Memory

 

        分页的handle是存在stack中的,操作系统使用内存是要先分成一个一个页,页由chain管理,页越多使用的stack内存就越高。存东西最终存在实际的物理内存中,虚拟的就到page这一层,如果内存资源不足,这时候page的内存就要page到swap中这就叫page out。如果说现在内存要工作了,并且我知道我要用的那块内存地址,我先到page table中去找,如果找不到就去swap中去找,然后再page in回来。

        Swap out和page out不同,当process工作的时候发现内存不够用并且不是首先要工作的process,这时候,process相关的所有内存都会放到swap中,腾出内存给先工作的process使用,这个动作就是swap out,而page out是从page中out到 swap。

Hugepage会减少swap

Virtual Memory  structural analysis  Fun Discussion :

 

u!deMS  0  0  Jno dens u ! 608  uogsneuxe  IOSUO Luolqold SMOUS

 

 

Iproc/meminfo  total stats  ommitedAS = memory  committed by applications

 

[root@test12c  CormItL imit :  Committed AS :  cat / proc/meminfo I grep Cormnit  5222744 kB  1090764 kB

 

Sar

sar - system accounting resource  —B menory p./rv, rpt for on  '00:01  10.61  H .05  09  : 00  : 01  09; 10.  24  09  0.21  .12  28968.99  0.00  0.00  0.00  0.00  0.00  0-00  0.00  0.00  0-00  O .00  0.00  sar takes a series of  snapshots, in this case  at 10 minute intervals  Note surge in faults

 

(root@test12c sar  6.12  0.04  0.00  89.20  2.16  3.20  0.02  0.00  2.19  3.15  0.02  o. 00  94  12:40:01  2.S4  0.03  0.00  92.80  3.19  s.es  0.05  0.00  3.47  5.40  0.00  91.05  4.42  s.gs  0.07  0.00  90.09  3.03  s.es  o.os  0.00  91.07  2.86  s.es  0.05  0.00  91.23  2.79  6.12  0.04  o. 00  90.99  2.76  s.31  0.01  0.00  91.80  0.01  0.00  94.39  3.51  4.34  0.02  0.00  92.13  2.47  0.03  0.00  92.27  1.24  0.04  0.00  98.09  0.64  1.31  0.01  0.00  98.03  0.46  0.01  o. 00  92.54  0.00  0.01  0.00  98.14  2.32  0.02  0.00  95.73  03:20:01  0.61  o. 00  1.46  0.01  0.00  9'.93  O .66  0.00  0.01  0.00  91.72  0.60  1.27  0.01  o. 00  92.13  7.02  0.00  91.23  96.80  0.00  3.18  0.01  0.00  0.00  93.12  0.00  6.88  0.00  0.00  0.00  91.99  0.00  o. 00  0.00  04:30:01  92.78  o. 01  7.21  0.00  0.00  0.00  91.69  0.01  8.30  0.00  0.00  0.00  0.02  4.12  0.03  o. 00  77.19  L inux  2.6.18-194.e1S (test12c) 07/19/2015  • nLce  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.11  0.00  0.00  0.01  o. 00  0.00  0.09  ser  * nice  ' systen  *systen  0.09  Iovait  0.09  * idie

 

Pmap <ospid>

19941  19941 :  oracleprod (DESCRIPTION-LOCAL-YES)  0000000000400000 267508K  /uOI/app/oracIe/product/12. O. I/db I/bln/oracle  /uOI/app/oracIe/product/12. O. I/db I 'bin/ oracle  0000000010b3dOOC  000000001 'dbe000  0000000023844000  0000000060000000  0000000060001000  0000000060400000  0000000060800000  0000000060cooooo  0000000061000000  0000000061400000  0000000061800000  0000000061cooooo  0000000062000000  0000000062400000  2S64K  196K  264K  4K  4092K  4096K  4096K  4096K  4096K  4096K  4096K  4096K  4096K  4096K  rw—s—  tv—s—  rw—s—  rw—s—  rw—s—  rw—s—  anon  [ anon  'dev/ s hm/ or a_prod  'dev/ s hm' or a_prod  'de v/ 3 hm/ or a. rod  'dev/ s hm/ or a_prod  'dev/ s hrM or a_prod  'de v/ z hm/ o: a. rod  'de v/ ' hm/ or a. rod  'dev/ s hm/ or a_prod  'dev/ s hm/ or a_prod  'de v/ s hm/ or a. rod  72089604  72089604  72122373  72122373  72122373  72122373  72122373  72122373  72122373  72122373  72122373

 

00002b315t57bOOO  / L 1b64/ L1bpThread—2.5.30  00002b315t5B7000  5 . 30  00002b315t5B9000  5 . 30  00002b315t5BbOOO  5 . 30  00002b315t5ctooo  00002b315t92tooo  00002b315t9ctooo  00002b315tdctOOO  00002b316054tooo  00002b31605ctooo  00002b3160dOtOOO  00002b3160dctOOO  00002b3161dbtOOO  00002b3161dctOOO  00002b3162d3tOOO  00007tttd3bB9000  tttttttttt600000  ToTa  272K r—s-  3240K  256K  4096K  7620K  512K  7424K  762K  16320K  64K  15202K  576K  2192K  1254392K  / L1b64/L1bc-2.  / L1b64/L1bc-2.  /L1b64/L1bc-2.  anon  anon  anon  anon  anon  anon  anon  anon  anon  anon  anon  [ stack ]  anon ]

 

.so什么的是调用的SO库文件。

 




euqu08  leguei0d  1 euumod  101  sswunvajdo  łndłno łnduł  leuue10d

最后total是这个进程消耗的总内存大小。

 

内部的call调用HBA卡等等

Iostat

Wrne recwests / second  0.00  o .00  easur•ng  —x, twvgy  Avg reqaest size stable  A queue size is skewed  o. 22  o .00  o .00  0.00  _ 00  s.2S  0.00  0.00 •s.ss  0-00  0-00  sync' issued to flush Linux  m buffer, force writes  Requests are merged  when possible, to  minimize physical writes  netm actual read or write  await includes queue time

 

try:  oi sks:  hdisk4  hdisk2  hdisk11  hdisk14  hdisk12  hdisk18  hdiskg  hdisk3  hdisk16  hdisk22  hdisk21  hdis klO  hdisk7  hdisk23  hdisk17  hdisk15  hdiskB  hdisk6  hdisk13  hdisk24  hdisk5  hdisk19  hdisk20  hdis kl  hdiskO  cdO  $ iostat 2 20  23.4  1.0  31. g  15.9  system configuration: lcpu=32 drives=26 paths—48 vdisks=O  avg-cpu: X user X sys X idle X Iowait  tin  0.0  X tm_act  tout  30.4  Kbps  42.3  tps  12.9 0.4  Kb_read  1  86.6  0.1  Kb_wrtn  1

 


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70013625/viewspace-3011707/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 杀外部连接会话
请登录后发表评论 登录
全部评论
Oracle ACE,MySQL 8.0 OCP,PMP,拥有OceanBase OBCP,TiDB PCTP,GoldenDB GDCP等多项认证,ITPUB认证专家,微信公众号:DBA之友。

注册时间:2022-02-08

  • 博文量
    132
  • 访问量
    171519