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