动态网站制作指南
[  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
电脑书籍下载:程序设计书籍 | 数据库教程书籍 | 平面与多媒体书籍 | 网络通讯书籍 | 系统管理书籍 | 网络安全书籍 | 认证考试书籍
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > 数据库学院 > DB2教程
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程
数据库:数据库教程,数据库技巧,Oracle教程,MySQL教程,Access教程,DB2教程,数据库安全,数据库文摘
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ DB2教程 ]的信息

本月文章推荐
.三种级别的DB2数据库字符集的设置.
.使用DB2look 重新创建优化器访问.
.全面了解DB2数据库中的各数据类型.
.IBM DB2通用数据库和信息管理(1.
.使用DB2look重新创建优化器访问计.
.DB2数据库设计和最高性能原则(1.
.利用VS2005构建针对DB2的应用程序.
.提高DB2 Web程序性能5条规则(1).
.DB2 9 数据库恢复简介.
.DB2信息集成提速异构信息管理.
.选择 IBM DB2数据库的五大理由.
.DB2建立nickname导致CRASH解决方.
.使用DB2look重新创建优化器访问计.
.DB2中创建一个汉字拼音首字母的S.
.如何操作Excel读取数据导入DB2数.
.定制DB2通用数据库命令行处理器.
.在Linux平台下进行DB2数据库的迁.
.简化 DB2 for i5/OS 索引建议.
.使用DB2look 重新创建优化器访问.
.使用DB2数据库临时表的注意事项.

DB2诊断系列之捕获SQL执行情况

文章类别:DB2教程 | 发表日期:2007-11-27 |


  在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 9 数据库服务器管理之DB2实例 人气:1455
下一篇:浅谈DB2数据库故障处理及最佳实践 人气:1173
点击此处浏览全部DB2的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-5-16 乘风多用户PHP统计系统 v3.4
2008-5-16 轩溪下载系统 v3.78 build 0515
2008-5-16 普沙B2B 浙江省商贸网 v2.0
2008-5-16 asp抓蜘蛛的小程序 v1.0
2008-5-16 齐齐乐网私服发布站 仿haosf新版
2008-5-16 IssTech信息反馈系统 v1.0
2008-5-16 自由领域大头贴(js接口版) 修正版
2008-5-16 医院网站系统
2008-5-16 智拓-分类信息管理系统 v5.0
2008-5-7 Windows XP SP3 官方英文版
2008-5-7 Windows XP SP3 官方香港中文版
2008-5-7 Windows XP SP3 官方繁体中文版
2008-5-7 Windows XP SP3 官方简体中文版
2008-4-30 Multiple Unzip Wizard 1.02
2008-4-30 Multiple Unrar Wizard 1.0.0
2008-4-30 WinZip Install/Try/Uninstall a
2008-4-30 ZIP压缩文件修复器WzipFix 2.0
2008-4-30 Pentazip 6.01 Build 189 For Wi
  发表评论
姓 名: 验证码: [ 全部贴吧 ] [ 浏览评论 ]
内 容:
[ 汉字翻译拼音 ] [ 广告代码 ] [ 符号对照表 ] [ 进制转换 ] [ 经典小工具 ] [ 个税计算 ] [ 汉字简繁转换 ] [ 普通单位换算 ] [ 公制单位换算 ]
[ 生辰老黄历 ] [ 国内电话区号 ] [ 国家代码与域名缩写 ] [ 文字加密解密 ] [ 健康查询 ] [ 万年历 ] [ 手机号码查询 ] [ ip搜索 ] [ Google PR查询 ]
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号
ホームページ制作 不動産検索システム 求人情報