1.QPS
- queries per seconds 每秒钟查询数量
show global status like 'Question%';
- Queries/seconds
2.TPS
- Tranaction per seconds
- TPS=(Com_commit+Com_rollback)/seconds
show global status like 'Com_commit';
show global status like 'Com_roolback';
3.线程连接数
- 使用最大的连接数
show global status like 'Max_used_connections';
- 线程连接数
show global status like 'Threads%';
4.最大连接数
show variables like 'max_connections';
5.Query Cache
- 查询缓存用于缓存select查询结果
- 当下次即受到相同的查询请求时,不再执行实际查询处理而直接获取结果
- 适用于大量查询、很少改变表中数据
修改my.cnf
将query_cache_size设置为具体的大小,具体大小时多少取决于查询的实际情况,但最好设置为1024的倍数,参考值32M
6.Query Cache命中率
show status like 'Qcache%';
Query_cache_hits=(Qcachec_hits/(Qcache_hits+Qcache_insert))*100%
7.锁定状态
show global status like '%lock%';
- Table_locks_waited/Table_locks_immediate值越大代表表锁造成的阻塞越严重
- Innodb_row_lock_waits innodb行锁,太大可能是间隙锁造成的
8.主从延时
- 查看主从延时时间
show slave status