mysql 重點性能測試指標

 

#qps 每秒鐘查詢數量 計算方式queries/seconds 查詢總數/秒數
show GLOBAL STATUS LIKE 'question%'sql

#tps 每秒事務數 計算方式 (com_commit +com_rollback)/seconds數據庫

show GLOBAL status LIKE 'com_commit'
show GLOBAL STATUS like 'com_rollback'緩存

#線程鏈接使用最大數
SHOW GLOBAL STATUS like 'max_used_connections'線程

#查詢線程數(有多少線程鏈接數據庫)
show GLOBAL STATUS LIKE 'threads'事務

#設置的最大鏈接數
show VARIABLES like 'max_connections'it

#query cache使用場景,查詢結果緩存到query cache 中,下次不直接執行語句,而是直接返回結果
#適用於大量查詢,不多改變表結構
#開啓方法,修改my.cnf ,將query_cache_size設置爲具體大小,取決於實際狀況,最好設置爲1024的倍數,參考值爲32M
#增長一行 query_cache_type=0/1/2
#若是爲1,將會緩存全部結果,除非你的select語句使用了sql_no_cache禁用了查詢緩存
#若是爲2,只會緩存select語句中的sql_cache指定須要緩存的查詢io

#query cache 命中率
show status like 'qcache%'innodb

#計算公式
query_cache_hits=(qcache_hits/(qcache_hits+qcache_inserts))*%100table


#鎖定狀態
show GLOBAL STATUS like '%lock%'thread

#計算公式
table_locks_waited/table_locks_immediate #值越大形成的表鎖阻塞越重

innodb_row_lock_waits innodb #針對innodb 行鎖,若是值較大,多是間隙鎖形成

#查詢主從延時show slave status

相關文章
相關標籤/搜索