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

您的位置:首頁技術(shù)文章
文章詳情頁

DB2診斷系列之捕獲SQL執(zhí)行情況

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

在DB2應(yīng)用使用過程中,我們經(jīng)常會(huì)碰到應(yīng)用響應(yīng)時(shí)間很慢,甚至沒有響應(yīng),但是應(yīng)用服務(wù)器可能并不是很繁忙,cpu利用率也非常低,引起這種狀況的原因有很多種,比如環(huán)境問題,應(yīng)用資源泄漏,數(shù)據(jù)庫原因等等,本文主要是從一次應(yīng)用性能診斷過程來談?wù)勅绾瓮ㄟ^數(shù)據(jù)庫診斷應(yīng)用性能問題。

問題:

測(cè)試過程中發(fā)現(xiàn)應(yīng)用中某個(gè)跳轉(zhuǎn)頁面執(zhí)行時(shí)間比較長(zhǎng),系統(tǒng)壓力不大,cpu利用很低,該頁面需要從cache中取數(shù)據(jù),第一次的時(shí)候加載cache(從數(shù)據(jù)庫中查詢回?cái)?shù)據(jù)并cache)。

診斷:

頁面邏輯比較簡(jiǎn)單,我們先用loadrunner模擬并發(fā)測(cè)試一下這個(gè)頁面,然后再數(shù)據(jù)庫端捕獲sql執(zhí)行情況。

1、打開db2監(jiān)控開關(guān)

#db2 connect to eos

#db2 update monitor switches using statement on

#db2 reset monitor all

2、幾分鐘之后,我們收集sql統(tǒng)計(jì)快照

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

現(xiàn)在統(tǒng)計(jì)信息已經(jīng)存放在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

......

簡(jiǎn)單說一下vi中的處理

:g!/Total execution time/d

只保留文本中的sql執(zhí)行時(shí)間,我們要按照?qǐng)?zhí)行時(shí)間來排序

通過vim的visual功能選擇執(zhí)行時(shí)間塊(等號(hào)后面的數(shù)字),然后排序

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

排序后的結(jié)果(部分)

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

可以看到最長(zhǎng)時(shí)間的sql total執(zhí)行時(shí)間耗費(fèi)了3797.905123s.

現(xiàn)在我們到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

這條語句總共執(zhí)行了4602次,平均每次的執(zhí)行時(shí)間2S,而且這些數(shù)據(jù)應(yīng)該是被cache起來的 ;)

總結(jié):

上面的方法簡(jiǎn)單總結(jié)了從數(shù)據(jù)庫層面對(duì)應(yīng)用的性能問題診斷,希望對(duì)大家有所幫助,對(duì)于數(shù)據(jù)庫快照診斷問題的思路對(duì)于任意數(shù)據(jù)庫通用

標(biāo)簽: DB2 數(shù)據(jù)庫
主站蜘蛛池模板: 日本无卡码免费一区二区三区 | 久久99精品免费视频 | 亚洲精品久久久久久久久久久网站 | 精品免费久久久久欧美亚一区 | 91精品免费高清在线 | 97国内免费久久久久久久久久 | 久爱免费观看在线网站 | 久久综合给会久久狠狠狠 | 欧美性色生活片天天看99 | 米奇久久 | 久久国产精品久久久久久 | 亚洲成人免费在线观看 | 国产精品久久久久免费视频 | 日韩午夜在线视频 | 在线视免费频观看韩国aaa | 国产乱子精品免费视观看片 | 男人天堂视频网站 | 欧美jlzz18性欧美 | 国产在线高清视频 | 国产成人精品免费视频网页大全 | 亚洲国产综合人成综合网站00 | 一级做a爱片久久蜜桃 | 在线观看免费黄色网址 | 99久久免费精品国产免费高清 | 久久99爱视频 | 欧美在线观看一区二区 | 国产精品麻豆一区二区三区v视界 | 欧美日本一区视频免费 | 99视频在线播放 | 在线播放人成午夜免费视频 | 手机看片免费基地你懂的 | 成人免费毛片一区二区三区 | 精品欧美一区二区三区在线观看 | 99国产精品视频久久久久 | 欧美一级aa天码毛片 | 日本韩国中文字幕 | 亚洲欧美卡通动漫丝袜美腿 | 中文无码日韩欧免费视频 | 日韩99精品 | 精品视频一二三区 | 无限资源中文免费 |