AWR報告分析之一:高 DB CPU 消耗的效能根源-eygle
準備寫一個系列,跟進一些AWR報告,做一些簡單分析,從中表達一些思路和想法,這些AWR報告可能來自公眾釋出,在這裡予以引用。
以下這份AWR報告的TOP 5 Event可以看出,其CPU消耗超高,佔 42.59% 的事件比例,而Log File Sync單次等待達到12毫秒,這表明IO可能存在遲緩:
Event | Waits | Time(s) | Avg wait (ms) | % DB time | Wait Class |
---|---|---|---|---|---|
DB CPU | 22,574 | 42.59 | |||
log file sync | 25,313 | 310 | 12 | 0.58 | Commit |
db file sequential read | 10,645 | 24 | 2 | 0.05 | User I/O |
direct path read | 9,191 | 22 | 2 | 0.04 | User I/O |
enq: TX - row lock contention | 11 | 5 | 455 | 0.01 | Application |
這個報告來自60分鐘的資料庫取樣:
Snap Id | Snap Time | Sessions | Cursors/Session | |
---|---|---|---|---|
Begin Snap: | 6603 | 19-Nov-12 08:00:15 | 261 | 2.2 |
End Snap: | 6604 | 19-Nov-12 09:00:20 | 260 | 3.0 |
Elapsed: | 60.09 (mins) | |||
DB Time: | 883.34 (mins) |
關注一下負載概要資訊,資料庫每秒僅僅摺合4.8個事務,而此前的LOG File Sync等待較高,這說明IO資源可能被其他操作佔用,事務之外,就是查詢,也就是說,可能有大量低效查詢消耗盡了IO資源:
Per Second | Per Transaction | Per Exec | Per Call | |
---|---|---|---|---|
DB Time(s): | 14.7 | 3.0 | 0.07 | 0.02 |
DB CPU(s): | 6.3 | 1.3 | 0.03 | 0.01 |
Redo size: | 55,291.8 | 11,421.6 | ||
Logical reads: | 662,383.2 | 136,828.5 | ||
Block changes: | 189.9 | 39.2 | ||
Physical reads: | 7.0 | 1.5 | ||
Physical writes: | 19.9 | 4.1 | ||
User calls: | 883.5 | 182.5 | ||
Parses: | 21.1 | 4.4 | ||
Hard parses: | 3.4 | 0.7 | ||
W/A MB processed: | 1,170.6 | 241.8 | ||
Logons: | 1.2 | 0.3 | ||
Executes: | 214.9 | 44.4 | ||
Rollbacks: | 0.0 | 0.0 | ||
Transactions: | 4.8 |
透過SQL的SQL邏輯讀部分,可以發現導致異常的SQL查詢,前兩個SQL供佔72.27的邏輯讀,顯然是這兩條SQL消耗了IO資源:
Buffer Gets | Executions | Gets per Exec | %Total | Elapsed Time (s) | %CPU | %IO | SQL Id | SQL Module | SQL Text |
---|---|---|---|---|---|---|---|---|---|
1,171,388,996 | 90,764 | 12,905.88 | 49.05 | 30,514.20 | 44.7 | 0 | JDBC Thin Client | select * from ( select row_.*,... | |
554,429,813 | 42,299 | 13,107.40 | 23.22 | 9,923.23 | 40.9 | 0 | JDBC Thin Client | select * from ( select row_.*,... | |
503,809,511 | 127,506 | 3,951.26 | 21.10 | 7,669.52 | 37.3 | 0 | JDBC Thin Client | select * from (select JOBID, S... | |
30,497,069 | 2,331 | 13,083.26 | 1.28 | 409.63 | 42.2 | 0 | JDBC Thin Client | select * from ( select trunc(P... | |
24,457,802 | 1,607 | 15,219.54 | 1.02 | 208.90 | 45.4 | 0 | JDBC Thin Client | select this_.PID as PID10_0_, ... | |
10,935,241 | 3,791 | 2,884.53 | 0.46 | 462.83 | 40.4 | 0 | JDBC Thin Client | select * from (select JOBID, S... | |
8,294,720 | 799 | 10,381.38 | 0.35 | 73.10 | 40.1 | 0 | JDBC Thin Client | select * from ( select row_.*,... | |
8,090,724 | 581 | 13,925.51 | 0.34 | 209.79 | 43.3 | 0 | JDBC Thin Client | select * from ( select trunc(P... | |
4,568,220 | 123 | 37,140.00 | 0.19 | 19.83 | 37.9 | 0 | JDBC Thin Client | select * from ( select rownum ... | |
4,151,731 | 316 | 13,138.39 | 0.17 | 28.95 | 37.8 | 0 | JDBC Thin Client | select * from (select JOBID, S... |
在"Segments by Logical Reads"部分可以看到,邏輯讀集中在一個物件上,第一位的表分割槽佔用89.86%的邏輯讀:
Owner | Tablespace Name | Object Name | Subobject Name | Obj. Type | Logical Reads | %Total |
---|---|---|---|---|---|---|
NCSS | NCSSJOBSITE00 | STU_SEARCHJOB | SITE00 | TABLE PARTITION | 2,145,895,024 | 89.86 |
STPSUSER | STPS2 | TEACHER_INFO | TABLE | 35,438,144 | 1.48 | |
NCSS | NCSS_INDEX | STU_SEARCHJOB_PK | INDEX | 18,438,384 | 0.77 | |
NCSS | NCSSJOBSITE0000 | STU_SEARCHJOB | SITE2101 | TABLE PARTITION | 17,049,488 | 0.71 |
NCSS | NCSS | STU_BASICINFO | TABLE | 5,766,448 | 0.24 |
接下來如果考察SQL,觀察其執行計劃,就應該能夠發現,可能是索引缺失導致了全表或全分割槽的掃描。
AWR報告參考連結:
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29119536/viewspace-1246347/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- AWR報告分析之二:ges inquiry response 過高-eygleUI
- AWR報告分析之三:cursor: pin S 的原理與案例分析-eygle
- awr中DB CPU過低的原因分析
- oracle效能awr報告Oracle
- 關於類似於awr的效能分析報告
- ORACLE AWR效能報告和ASH效能報告的解讀Oracle
- AWR解析報告分析
- 關於CPU使用率高的awr分析
- AWR報告分析之二:ges inquiry response 過高UI
- 手工生成AWR分析報告
- oracle AWR報告提取分析Oracle
- MySQL 5.7定位消耗CPU高的SQLMySql
- 【深度長文】循序漸進解讀Oracle AWR效能分析報告Oracle
- ORACLE AWR報告詳細分析Oracle
- 轉帖eygle:利用AWR報告解決paging space被撐爆的例子
- Oracle的AWR報告分析(簡潔版)Oracle
- 獲得消耗cpu較高的topsqlSQL
- Oracle AWR與ASH效能報告深入解析Oracle
- Oracle AWR報告分析之–SQL ordered byOracleSQL
- Oracle 10g AWR 報告分析Oracle 10g
- 對於AWR報告的幾個片段分析。
- itpub awr案例分析之一
- 透過top命令抓取cpu高消耗的sqlSQL
- 通過top命令抓取cpu高消耗的sqlSQL
- 硬解析帶來高CPU消耗的診斷
- Oracle的AWR報告分析(經典串聯版)Oracle
- 【效能調優】Oracle AWR報告指標全解析Oracle指標
- Oracle_AWR報告分析指南(經典版)Oracle
- AWR 報告修改moving window 出錯分析
- AWR報告分析之三:cursor: pin S 的原理與案例分析
- 宜信資料庫實踐|解讀Oracle AWR效能分析報告,更快定位效能瓶頸資料庫Oracle
- 理論實踐:循序漸進理解AWR細緻入微分析效能報告
- 效能分析之CPU分析-從CPU呼叫高到具體程式碼行(JAVA)Java
- Oracle AWR報告及統計資料之DB Time說明Oracle
- AWR報告的收集和分析執行計劃的方式
- CPU效能分析
- Oracle生成awr報告Oracle
- mysql-awr報告MySql