MySQL5.5 performance_schema的介绍_第1页
MySQL5.5 performance_schema的介绍_第2页
MySQL5.5 performance_schema的介绍_第3页
MySQL5.5 performance_schema的介绍_第4页
MySQL5.5 performance_schema的介绍_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

MySQL5 5 performance schema 的介绍的介绍 mysql 5 5 版本 新增了一个性能优化的引擎 PERFORMANCE SCHEMA 这个功能默认是关闭的 需要设置参数 performance schema 才可以启动该功能 这个参数是静态参数 只能写在 f 中 不能动态修改 先看看有什么东西吧 mysql use performance schema Database changed mysql show tables Tables in performance schema cond instances events waits current events waits history events waits history long events waits summary by instance events waits summary by thread by event name events waits summary global by event name file instances file summary by event name file summary by instance mutex instances performance timers rwlock instances setup consumers setup instruments setup timers threads 17 rows in set 0 00 sec 这里的数据表分为几类 1 setup table 设置表 配置监控选项 2 current events table 记录当前那些 thread 正在发生什么事情 3 history table 发生的各种事件的历史记录表 4 summary table 对各种事件的统计表 5 杂项表 乱七八糟表 setup 表 mysql SELECT TABLE NAME FROM INFORMATION SCHEMA TABLES WHERE TABLE SCHEMA performance schema AND TABLE NAME LIKE setup TABLE NAME setup consumers setup instruments setup timers setup consumers 描述各种事件 setup instruments 描述这个数据库数据库下的表名以及是否开启监控 setup timers 描述 监控选项已经采样频率的时间间隔 这个要多说一点 目前 performance schema 只支持 wait 时间的监控 代码树上 wait 下的函数都可 以监控到 文档上说了只有 wait 事件的检测 有没有其他的选项呢 看看源代码源代码 static row setup timers all setup timers data COUNT SETUP TIMERS C STRING WITH LEN wait THR LOCK table setup timers m table lock int table setup timers update row values TABLE table const unsigned char unsigned char Field fields Field f longlong value DBUG ASSERT m row for f fields fields if bitmap is set table write set f field index switch f field index case 0 NAME my error ER WRONG PERFSCHEMA USAGE MYF 0 return HA ERR WRONG COMMAND case 1 TIMER NAME value get field enum f if value FIRST TIMER NAME else return HA ERR WRONG COMMAND break default DBUG ASSERT false return 0 代码里写死了 只有 wait 一个值 不排除以后的版本会增加新的关键字 但至少目前就只有一个啦 并且这个表的 name 字段是不允许修改的的 下面的修改的方法里没有做任何处理 涉及到 name 字段 的修改 直接报错 mysql SELECT FROM setup timers NAME TIMER NAME wait CYCLE 只有 timer name 可以 update 这是一个 enum 字段 性能事件表 mysql SELECT TABLE NAME FROM INFORMATION SCHEMA TABLES WHERE TABLE SCHEMA performance schema AND TABLE NAME LIKE current TABLE NAME events waits current 记录当前正在发生的等待事件 这个表是只读的表 不能 update delete 但是可以 truncate 具体字段是什么意思就自己去查 doc 了 这里不说了 性能历史表 mysql SELECT TABLE NAME FROM INFORMATION SCHEMA TABLES WHERE TABLE SCHEMA performance schema AND TABLE NAME LIKE history OR TABLE NAME LIKE history long TABLE NAME events waits history events waits history long 这些表与前面的性能表的结构是一致的 history 表只保留每个线程 thread 的最近的 10 个事件 h istory long 记录最近的 10000 个事件 新事件如表 如果旧表满了 就会丢弃旧的数据 标准的先进先出 FIFO 这俩表也是只读表 只能 tru ncate 事件汇总表 mysql SELECT TABLE NAME FROM INFORMATION SCHEMA TABLES WHERE TABLE SCHEMA performance schema AND TABLE NAME LIKE summary TABLE NAME events waits summary by instance events waits summary by thread by event name events waits summary global by event name file summary by event name file summary by instance 按照相关的标准对进行的事件统计表 events waits summary global by event name 在 mysql5 5 7 以前叫 EVENTS WAITS SUMMARY BY EVENT NAME 表也是只读的 只能 turcate performance schema instance 表 mysql SELECT TABLE NAME FROM INFORMATION SCHEMA TABLES WHERE TABLE SCHEMA performance schema AND TABLE NAME LIKE instances TABLE NAME cond instances file instances mutex instances rwlock instances 记录各种等待事件涉及到的实例 主要是 3 类 cond 容器 mutex 互斥锁 rwlock 读写锁 这表是只读的 乱七八糟表 mysql SELECT FROM performance timers TIMER NAME TIMER FREQUENCY TIMER RESOLUTION TIMER OVERHEAD CYCLE 2389029850 1 72 NANOSECOND NULL NULL NULL MICROSECOND 1000000 1 585 MILLISECOND 1035 1 738 TICK 101 1 630 这个表式只读表 记录了事件采样频率的设定 我们前面说的 setup timer 表的 timer name 只能区这 4 个中一个 mysql SELECT FROM threads THREAD ID PROCESSLIST ID NAME 0 0 thread sql main 1 0 thread innodb io handler thread 16 0 thread sql signal handler 23 7 thread sql one connection 5 0 thread innodb io handler thread 12 0 thread innodb srv lock timeout thread 22 6 thread sql one connection 这个表记录了系统里当前存在的各种线程 下面就是 涉及到 performance schema 的各个系统参数了 mysql SHOW VARIABLES LIKE perf Variable name Value performance schema ON performance schema events waits history long size 10000 performance schema events waits history size 10 performance schema max cond classes 80 performance schema max cond instances 1000 performance schema max file classes 50 performance schema max file handles 32768 performance schema max file instances 10000 performance schema max mutex classes 200 performance schema max mutex instances 1000000 performance schema max rwlock classes 30 performance schema max rwlock instances 1000000 performance schema max table handles 100000 performance schema max table instances 50000 performance schema max thread classes 50 performance schema max thread instances 1000 涉及到系统状态的参数 mysql SHOW STATUS LIKE perf Variable name Value Performance schema cond classes lost 0 Performance schema cond instances lost 0 Performance schema file classes lost 0 Performance schema file handles lost 0 Performance schema file instances lost 0 Performance schema locker lost 0 Performance schema mutex classes lost 0 Performance schema mutex ins

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论