MySQL监控模板说明-Percona MySQL Monitoring Template for Cacti

  • InnoDB Buffer Pool Activity
  • InnoDB Checkpoint Age
  • InnoDB I/O
  • InnoDB Insert Buffer
  • InnoDB Internal Hash Memory Usage
  • InnoDB Log
  • InnoDB Row Lock Time
  • InnoDB Row Operations
  • InnoDB Semaphores Waits
  • InnoDB Tables In Use
  • InnoDB Transactions
  • MyISAM Key Cache
  • MySQL Command Counts
  • MySQL Files and Tables
  • MySQL Network Traffic
  • MySQL Query Cache
  • MySQL Query Response Time (Microseconds)
  • MySQL Replication
  • MySQL Sorts
  • MySQL Temporary Objects
  • MySQL Transaction Handler



InnoDB Adaptive Hash Index

显示了的使用情况.
# Hash table size 17700827, node heap has 35112 buffer(s)
# 3577.42 hash searches/s, 507.49 non-hash searches/s

  1. =innodb_buffer_pool_size/256

InnoDB Buffer Pool Activity

显示,页的创建,写入,需要检查应用Pages Created

  • Pages Written

    InnoDB Buffer Pool

    1. ,每页大小Database Pages
      数据页大小Free Pages
      空闲页大小Modified Pages
      "
      <span "="" style="word-wrap: break-word; font-size: 10pt;">"数据页,则需要检查磁盘.

    InnoDB Checkpoint Age

    1. .如果该值的大小接近,则需要增加,但是要注意,则需要更长的回复时间redolog恢复InnoDB Lock Wait Secs
      显示每秒处于锁等待的.如果有一个非常大的值LOCK WAIT transactions,请看下面的模板File Reads
      显示每秒文件的读次数File Writes
      显示每秒文件的写次数Log Writes
      写日志的次数File Fsyncs
      调用..

    InnoDB I/O Pending

    显示了IO操作,则需要更大的,更快的磁盘Pending Aio Log Ios

  • Pending Buf Pool Flushes
  • Pending Ibuf Aio Reads
  • Pending Log Writes
  • Pending Normal Aio Writes

    InnoDB Insert Buffer

    插入缓冲,而是物理页,不是每一次直接插入索引页.如果在,如果不再.然后再以一定的频率执行插入缓冲和非聚集索引页子节点的合并操作:非聚集索引

    如果3/1,则代表插入缓冲对于非聚集索引页的3Ibuf Cell Count
    分段大小Ibuf Used Cells
    插入缓冲区的大小Ibuf Free Cells
    "
    自由列表<span "="" style="word-wrap: break-word; font-size: 10pt;">"的长度InnoDB内部各种哈希结构),占用的内存大小Adaptive Hash Memory
    自适应哈希索引占用的内存大小Page Hash Memory

  • File System Memory
  • Recovery System Memory
  • InnoDB Lock Structs
    该图形显示了在(不是死锁.可以用来判断是否存在锁争用,没有硬性的规定,大量的事务在等待锁,该值越小越好SHOW ENGINE INNODB STATUS;

    # 23 lock struct(s), heap size 3024, undo log entries 27

    # LOCK WAIT 12 lock struct(s), heap size 3024, undo log entries 5

    # LOCK WAIT 2 lock struct(s), heap size 368

    InnoDB Log

    相关变量InnoDB Log Buffer Size

  • log_bytes_written,表示日志缓存区里还有多少数据没被刷新到日志文件里innodb_log_buffer_size设置的.

    InnoDB Memory Allocation

    Total Mem Alloc
    InnoDB
    申请的总内存量

  • ,单位字节InnoDB Row Lock Time
    该模板读取的,表示(以毫秒为单位InnoDB Row Lock Waits
    读取的,表示.(毫秒# Number of rows inserted 50678311, updated 66425915, deleted 20605903, read 454561562
    大致能表现

    1. Row Deleted
    2. Row Inserted

    InnoDB Semaphores Wait Time

    1. InnoDB线程的等待时间的总耗时).
      分析,InnoDB Semaphores Wait Time.除非服务器运行着高并发的工作负载InnoDB采取让操作系统等待的措施SHOW ENGINE INNODB STATUS.
      相关:
                elseif (strpos($line, 'seconds the semaphore:') > 0) {
                # --Thread 907205 has waited at handler/ha_innodb.cc line 7156 for 1.00 seconds the semaphore:
                increment($results, 'innodb_sem_waits', 1);
                increment($results, 'innodb_sem_wait_time_ms', to_int($row[9]) * 1000);
                }

    其中,表示有多少线程在等待innodb_sem_wait_time_ms表示所有线程等待的时间,在脚本中乘以.

    • 应对这个问题.首先.如果经过了一个预设的循环等待周期30,就会退到更昂贵更复杂的等待阵列里,则导致系统负载突增,但是需要不停地检查一个资源是否被锁定CPU周期,当另外一条线程能处理事情时.
      循环等待的替换方案就是让操作系统做上下文切换),每秒钟几千次的切换会引发大量的系统开销
      根据具体的应用;或者优化应用.

    InnoDB Semaphores Waits

    1. InnoDB线程的数量innodb内部的信号活动状态Mutex spin waits,RW-shared spins,RW-excl spins等各种信号量的数量总和Spin Rounds
      InnoDB
      内部预设的互斥量信号数量Spin Waits
      InnoDB
      内部对锁进行循环等待的数量innodb_sync_spin_loops参数有关Os Wait系统等待
      在高并发的情况,不稳定,不合理的设计情况下.

    InnoDB Tables In Use

    InnoDB Tables In Use
    所有事务用到的表的数量InnoDB Locked Tables
    所有事务锁定的表的数量InnoDB事务的状态数量Active Transactions
    正在执行的事务数量Locked Transactions
    锁住的事务数量Current Transactions
    当前的事务数量not started,ACTIVE,...等各种状态
    ACTIVE # 
    正在执行的事务Read Views(待更新InnoDB事务相关的信息InnoDB Transactions
    InnoDB
    内部的事务总数:
    Trx id counter 89F56195 # 
    当前事务
    Purge done for trx's n:o < 89F5609C undo n:o < 0 # InnoDB
    清除旧版本ID.这个.
    该数值就是由当前事务ID再由十六进制转成十进制的值ss_get_mysql_stats.php脚本)

  • .位于.当一个事务执行了更新并提交后,当清除进程移除一个旧版本数据时.

    MyISAM Indexs

    显示了在

    MyISAM Key Cache

    1. Key_blocks_used变量
    2. Key_blocks_unused
      键缓存里尚未被使用过的缓存块的个数Binlog Cache Use
      保存在二进制日志缓存里的事务的个数Binlog Cache Disk Use
      超过,使用磁盘临时文件的事务的个数Binlog Log Space
      二进制日志的大小Relay Log Space
      中继日志的大小Binlog Cache Disk Use/Binlog Cache Use的值较大binlog_cache_size的大小,也不要期望改善过多1个减少到每分钟一个.没必要耗费大量的内存binlog_cache_size中的事务,显示了1秒内
      1. .(Com_*变量的总数不一定相等Com Select
      2. Com Insert
      3. Com Replace
      4. Com Delete Multi
      5. Com Update Multi
      6. Max Connections
        允许同时保持在打开状态的客户连接的最大个数Max Used Connections
        此前曾同时打开处于打开状态的连接的最大个数Aborted Clients
        因客户端没有正确地关闭而被丢弃的连接的个数Aborted Connects
        试图连接
      7. MySQL服务器的尝试次数Table Cache
      8. .不包括Open Files
        当前处于打开状态的文件的个数open_files_limit接近open_files_limit的值Opened Tables
        MySQL
        服务器已打开的数据表总数).如果这个值很高,是否加大数据表缓存Handler_writer 向数据表里插入一个数据行的请求的个数Handler_update 对数据表里的一个数据行进行修改的请求的个数Handler_delete 从数据表删除一个数据行的请求的个数Handler_read_first 读取索引中第一个索引项的请求的个数Handler_read_key 根据一个索引值而读取一个数据行的请求的个数Handler_read_next 按索引顺序读取下一个数据行的请求的个数Handler_read_prev 按索引逆序读取前一个数据行的请求的个数Handler_read_rnd 根据某个数据行的位置而读取该数据行的请求的个数Handler_read_rnd_next 读取下一个数据行的请求的个数,就说明有很多语句需要通过全表扫描才能完成或有很多查询没有使用适当的索引Bytes Send
        发送字节数Bytes Received
        收到字节数http://dev.mysql.com/doc/refman/5.5/en/general-thread-states.html
        1. State Copying To Tmp Table
          The server is copying to a temporary table in memory
        2. State Freeing Items
          The thread has executed a command. Some freeing of items done during this state involves the query cache. This state is usually followed by cleaning up
        3. State Locked
          The query is locked by another query.
          As of MySQL 5.5.3, this state was removed because it was equivalent to the Table lock state and no longer appears in SHOW PROCESSLIST output.
        4. State Preparing
          This state occurs during query optimization.
        5. State Sengding Data
          The thread is reading and processing rows for a SELECT statement, and sending data to the client. Because operations occurring during this this state tend to perform large amounts of disk access (reads), it is often the longest-running state over the lifetime of a given query.
        6. State Statistics
          The server is calculating statistics to develop a query execution plan. If a thread is in this state for a long time, the server is probably disk-bound performing other work.
        7. State Writing To Net
          The server is writing a packet to the network.
        8. ,空的NULL状态State Other
          其他SHOW SLAVE STATUS命令获取各状态值Slave Running
          从服务器的SQL线程是否在运行Slave Stopped
        9. SQL线程曾经打开的临时文件的个数Slave Retried Transactions
          从服务器中的

        MySQL Select Types

        1. .这种情况是性能杀手sql.
        2. (reference table)上的区间搜索.
          该值表示使用了范围查询联接表的次数Select Range
          利用第一个数据表上的某个区间而完成的多数据表联接操作的次数Select Range Check
          该变量记录了在联接时,它的开销很大,说明一些查询没有找到好索引Select Scan
          通过对第一个数据表进行全表扫描而完成的多数据表联接操作的次数Sort Rows
          对多少行排序Sort Range
          利用一个区间进行的排序操作的次数Sort Merge Passes
          查询导致了文件排序的次数sql或者适当增加

        MySQL Table Locks

        1. (存储引擎级的锁InnoDB行级锁).
          如果这个值比较高或者正在增加.
        2. (执行时间超过)

        MySQL Temporary Objects

        1. SQL查询语句进行处理时在内存里创建的临时数据表的个数,唯一的解决办法是.
        2. SQL查询语句进行处理时在磁盘上创建的临时数据表的个数,可能的原因BLOB或者
          b.tmp_table_size

        MySQL Threads

        1. .断开的,新建立的连接就会重复使用它们而不创建新的线程,MySQL就能很快的响应连接请求.每个在缓存中的线程通常消耗.

        MySQL Transaction Handler

        1. .

        <span color:#333333;"="" style="word-wrap: break-word; font-size: 10pt;">

        参考:
        http://www.percona.com/doc/percona-monitoring-plugins/cacti/mysql-templates.html
        http://www.mysqlperformanceblog.com/2006/07/17/show-innodb-status-walk-through/
        Percona提供的模板为例.其中信息获取命令如下(不包括pt-heartbeat).

        SHOW /*!50002 GLOBAL */ STATUS;

        SHOW VARIABLES;

        SHOW SLAVE STATUS;

        SHOW MASTER LOGS;

        SHOW PROCESSLIST;

        SHOW /*!50000 ENGINE*/ INNODB STATUS;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值