LAMP实用小技巧之MySQL性能监控

运维 系统运维
LAMP有许多实用技巧,我们来看上一个:MySQL性能监控。

 

MySQL 

图-MySQL

LAMP实用小技巧之MySQL性能监控如下:

  一,获取mysql用户下的进程总数

  ps -ef | awk '{print $1}' | grep "mysql" | grep -v "grep" | wc-1

  二,主机性能状态

  # uptime

  [root@ ~]# uptime

  13:05:52 up 53 days, 52 min, 1 user, load average: 0.00, 0.00, 0.00 三,CPU使用率

  # top

  或

  # vmstat

  四,磁盘IO量

  # vmstat 或 # iostat

  五,swap进出量[内存]

  # free

#p#

  六,数据库性能状态

  (1)QPS(每秒Query量)

  QPS = Questions(or Queries) / seconds

  mysql > show /*50000 global */ status like 'Question';

  (2)TPS(每秒事务量)

  TPS = (Com_commit + Com_rollback) / seconds

  mysql > show status like 'Com_commit';

  mysql > show status like 'Com_rollback';

  (3)key Buffer 命中率

  key_buffer_read_hits = (1-key_reads / key_read_requests) * 100%

  key_buffer_write_hits = (1-key_writes / key_write_requests) * 100%

  mysql> show status like 'Key%';

  (4)InnoDB Buffer命中率

  innodb_buffer_read_hits = (1 - innodb_buffer_pool_reads / innodb_buffer_pool_read_requests) * 100%

  mysql> show status like 'innodb_buffer_pool_read%';

  (5)Query Cache命中率

  Query_cache_hits = (Qcahce_hits / (Qcache_hits + Qcache_inserts )) * 100%;

  mysql> show status like 'Qcache%';

  (6)Table Cache状态量

  mysql> show status like 'open%';

  (7)Thread Cache 命中率

  Thread_cache_hits = (1 - Threads_created / connections ) * 100%

  mysql> show status like 'Thread%';

  mysql> show status like 'Connections';

  (8)锁定状态

  mysql> show status like '%lock%';

  (9)复制延时量

  mysql > show slave status

  (10) Tmp Table 状况(临时表状况)

  mysql > show status like 'Create_tmp%';

  (11) Binlog Cache 使用状况

  mysql > show status like 'Binlog_cache%';

  (12) Innodb_log_waits 量

  mysql > show status like 'innodb_log_waits';

  开源监控软件

  一,RRDTool

  二,Nagios

  三,MRTG

  四,Cacti

通过文章的介绍,我们又学会一个LAMP的使用技巧,希望大家能喜欢。

【编辑推荐】

责任编辑:赵鹏 来源: 网络转载
相关推荐

2011-03-23 16:49:17

LAMP技巧linux命令

2011-03-11 15:53:02

LAMP优化

2011-06-28 13:56:43

JAVA

2011-07-05 14:59:17

java

2011-03-11 15:53:00

LAMP优化

2011-03-11 15:52:57

LAMP优化

2011-07-01 11:13:47

MogileFS

2013-02-20 15:59:50

Windows 8

2021-03-15 08:13:19

JavaScript开发代码

2020-12-24 09:18:51

SQL数据库函数

2011-03-11 15:52:59

LAMP优化

2011-03-18 11:13:07

LAMP度量性能

2011-03-21 11:08:15

LAMPMySQL

2011-03-21 15:00:13

LAMPMySQL

2023-10-26 18:03:14

索引Python技巧

2017-10-30 17:25:11

javascript

2016-05-10 10:16:13

JavaScript技巧

2024-03-11 15:08:26

Linux操作系统进程

2011-07-07 16:17:14

2011-07-11 15:26:49

性能优化算法
点赞
收藏

51CTO技术栈公众号