MySQL 資料庫 效能監控

2021-08-26 06:18:43 字數 2710 閱讀 2485

show status;

flush status;

檢視當前連線數 show status like 'thread_%';

thread_cached:被快取的執行緒的個數

thread_running:處於啟用狀態的執行緒的個數

thread_connected:當前連線的執行緒的個數

thread_created:總共被建立的執行緒的個數

thread cache hits

thread_connected = show global status like thread_created;

connections = show global status like 'connections';

tch=(1 - (threads_created / connections)) * 100

檢視活動連線內容

show processlist;

如果 tch數小於90%,建立連線耗費了時間,增大thread_cached數量

qpsquestions = show global status like 'questions';

uptime = show global status like 'uptime';

qps=questions/uptime

tpscom_commit = show global status like 'com_commit';

com_rollback = show global status like 'com_rollback';

uptime = show global status like 'uptime';

tps=(com_commit + com_rollback)/uptime

qps 和 tps值一定要實時監控,如果接近架構搭建時的測試峰值,願上帝與你同在

read/writes ratio

qcache_hits = show global status like 'qcache_hits';

com_select = show global status like 'com_select';

com_insert = show global status like 'com_insert';

com_update = show global status like 'com_update';

com_delete = show global status like 'com_delete';

com_replace = show global status like 'com_replace';

r/w=(com_select + qcache_hits) / (com_insert + com_update + com_delete + com_replace) * 100

讀寫比,優化資料庫的重要依據,讀的多就去優化讀,寫的多就去優化寫

slow queries per minute

slow_queries = show global status like 'slow_queries';

uptime = show global status like 'uptime';

sqpm=slow_queries / (uptime/60)

slow queries /questions ratio

slow_queries = show global status like 'slow_queries';

questions = show global status like 'questions';

s/q=slow_queries/questions

新版本上線時要著重關注慢查詢,讓測試去踢開發者的屁股吧

full_join per minute

select_full_join = show global status like 'select_full_join';

uptime = show global status like 'uptime';

fjpm=select_full_join / (uptime/60)

沒有使用索引而造成的full_join,優化索引去吧

innodb buffer read hits

innodb_buffer_pool_reads = show global status like 'innodb_buffer_pool_reads';

innodb_buffer_pool_read_requests = show global status like 'innodb_buffer_pool_read_requests';

ifrh=(1 - innodb_buffer_pool_reads/innodb_buffer_pool_read_requests) * 100

innodb buffer命中率 目標 95%-99%;

table cache

open_tables= show global status like 'open_tables';

opened_tables= show global status like 'opened_tables';

table_cache= show global status like 'table_cache';

table_cache應該大於 open_tables 小於 opened_tables

show global status like 'innodb_row_lock_%';

MySQL 資料庫 效能監控

show status flush status 檢視當前連線數 show status like thread thread cached 被快取的執行緒的個數 thread running 處於啟用狀態的執行緒的個數 thread connected 當前連線的執行緒的個數 thread cre...

zabbix監控mysql資料庫效能實現

被監控主機根據使用者設定的時間間隔定期將資料push到zabbix server.這裡主要介紹agent.agent工作原理 agent 安裝在被監控主機上,定期主動的監控本機的資源和應用,然後將資料進行處理傳送給zabbix server.agent工作方式又分為 passive check 和 ...

zabbix監控mysql資料庫效能實現

被監控主機根據使用者設定的時間間隔定期將資料push到zabbix server.這裡主要介紹agent.agent工作原理 agent 安裝在被監控主機上,定期主動的監控本機的資源和應用,然後將資料進行處理傳送給zabbix server.agent工作方式又分為 passive check 和 ...