色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術文章
文章詳情頁

DB2診斷系列之捕獲SQL執行情況

瀏覽:6日期:2023-11-10 09:07:21

在DB2應用使用過程中,我們經常會碰到應用響應時間很慢,甚至沒有響應,但是應用服務器可能并不是很繁忙,cpu利用率也非常低,引起這種狀況的原因有很多種,比如環境問題,應用資源泄漏,數據庫原因等等,本文主要是從一次應用性能診斷過程來談談如何通過數據庫診斷應用性能問題。

問題:

測試過程中發現應用中某個跳轉頁面執行時間比較長,系統壓力不大,cpu利用很低,該頁面需要從cache中取數據,第一次的時候加載cache(從數據庫中查詢回數據并cache)。

診斷:

頁面邏輯比較簡單,我們先用loadrunner模擬并發測試一下這個頁面,然后再數據庫端捕獲sql執行情況。

1、打開db2監控開關

#db2 connect to eos

#db2 update monitor switches using statement on

#db2 reset monitor all

2、幾分鐘之后,我們收集sql統計快照

#db2 get snapshot for dynamic sql on eos > dysqlstatus.out

現在統計信息已經存放在dysqlstatus.out中,你可以使用任意方便的文本處理工具查看,我一般用windows上的gvim來處理,打開dysqlstatus.out

Number of executions = 1

Number of compilations = 1

Worst preparation time (ms) = 2

Best preparation time (ms) = 2

Internal rows deleted = 0

Internal rows inserted = 0

Rows read = 2

Internal rows updated = 0

Rows written = 0

Statement sorts = 0

Statement sort overflows = 0

Total sort time = 0

Buffer pool data logical reads = Not Collected

Buffer pool data physical reads = Not Collected

Buffer pool temporary data logical reads = Not Collected

Buffer pool temporary data physical reads = Not Collected

Buffer pool index logical reads = Not Collected

Buffer pool index physical reads = Not Collected

Buffer pool temporary index logical reads = Not Collected

Buffer pool temporary index physical reads = Not Collected

Total execution time (sec.ms) = 0.000377

Total user cpu time (sec.ms) = 0.010000

Total system cpu time (sec.ms) = 0.000000

Statement text = select ACTIVITYDEFID,ACTIVITYINSTID from wfworkitem where PROCESSINSTID=104199 and CURRENTSTATE = 4

......

簡單說一下vi中的處理

:g!/Total execution time/d

只保留文本中的sql執行時間,我們要按照執行時間來排序

通過vim的visual功能選擇執行時間塊(等號后面的數字),然后排序

Total execution time (sec.ms) = 0.050590

Total execution time (sec.ms) = 0.000170

Total execution time (sec.ms) = 0.000247

Total execution time (sec.ms) = 0.000292

Total execution time (sec.ms) = 0.000474

Total execution time (sec.ms) = 0.000330

Total execution time (sec.ms) = 0.000348

Total execution time (sec.ms) = 0.000279

Total execution time (sec.ms) = 0.000385

Total execution time (sec.ms) = 0.000296

Total execution time (sec.ms) = 0.000261

Total execution time (sec.ms) = 0.000195

Total execution time (sec.ms) = 0.000226

Total execution time (sec.ms) = 0.000227

Total execution time (sec.ms) = 0.000193

......

:'<,'>!sort

排序后的結果(部分)

Total execution time (sec.ms) = 2.027776

Total execution time (sec.ms) = 2.203624

Total execution time (sec.ms) = 2.504677

Total execution time (sec.ms) = 2.951256

Total execution time (sec.ms) = 3.119875

Total execution time (sec.ms) = 3.303277

Total execution time (sec.ms) = 3.303517

Total execution time (sec.ms) = 4.017133

Total execution time (sec.ms) = 4.043329

Total execution time (sec.ms) = 4.252125

Total execution time (sec.ms) = 4.400952

Total execution time (sec.ms) = 4.606765

Total execution time (sec.ms) = 5.208087

Total execution time (sec.ms) = 5.778598

Total execution time (sec.ms) = 8.117470

Total execution time (sec.ms) = 9797.905136

可以看到最長時間的sql total執行時間耗費了3797.905123s.

現在我們到dysqlstatus.out中去找這條語句

Number of executions = 4602

Number of compilations = 4294967295

Worst preparation time (ms) = 2

Best preparation time (ms) = 2

Internal rows deleted = 0

Internal rows inserted = 0

Rows read = 2963688

Internal rows updated = 0

Rows written = 0

Statement sorts = 0

Statement sort overflows = 0

Total sort time = 0

Buffer pool data logical reads = Not Collected

Buffer pool data physical reads = Not Collected

Buffer pool temporary data logical reads = Not Collected

Buffer pool temporary data physical reads = Not Collected

Buffer pool index logical reads = Not Collected

Buffer pool index physical reads = Not Collected

Buffer pool temporary index logical reads = Not Collected

Buffer pool temporary index physical reads = Not Collected

Total execution time (sec.ms) = 9797.905136

Total user cpu time (sec.ms) = 9.290000

Total system cpu time (sec.ms) = 1.230000

Statement text = select * from XXXX_T_CNFACTIVITYDEF

這條語句總共執行了4602次,平均每次的執行時間2S,而且這些數據應該是被cache起來的 ;)

總結:

上面的方法簡單總結了從數據庫層面對應用的性能問題診斷,希望對大家有所幫助,對于數據庫快照診斷問題的思路對于任意數據庫通用

標簽: DB2 數據庫
主站蜘蛛池模板: 全国男人的天堂网站 | 欧美成人做性视频在线播放 | 毛片免费看网站 | 日韩欧美高清在线 | 久久青草国产手机看片福利盒子 | 天天爱天天做天天爽天天躁 | 国产视频高清在线 | 在线观看国产一区二区三区 | 国产欧美日韩不卡一区二区三区 | 美女张开双腿让男人桶 | 国产99视频精品免视看9 | 久久国产精品免费一区二区三区 | 成人午夜大片免费7777 | 国产一区二区久久 | 久久国产精品久久国产精品 | 日本一区二区三区在线 视频 | 亚洲悠悠色综合中文字幕 | 国产深夜福利视频网站在线观看 | 禁止18周岁进入免费网站观看 | 国产乱理片在线观看夜 | 亚洲国产成人久久笫一页 | 一级啊片 | 欧美人一级淫片a免费播放 欧美人与z0z0xxxx | 欧美亚洲国产精品久久高清 | 成人精品免费视频 | 亚洲精品 欧美 | 高清视频一区 | 永久黄网站色视频免费观看99 | 欧美精品一区二区在线观看 | 国产精品色内内在线播放 | 九九综合视频 | 国产成人18黄网站免费网站 | 欧美一级棒 | 九色国产在线 | 美女视频网站永久免费观看软件 | 欧美成人毛片在线视频 | 久久福利精品 | 香蕉久久夜色精品国产尤物 | 日韩欧美在线观看 | 韩国日本三级在线观看 | 国产性生活视频 |