您好,登錄后才能下訂單哦!
本篇內容主要講解“MySQL數(shù)據(jù)庫的性能監(jiān)控方法”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“MySQL數(shù)據(jù)庫的性能監(jiān)控方法”吧!
SHOW STATUS;
FLUSH STATUS;
查看當前連接數(shù) SHOW STATUS LIKE 'Thread_%';
Thread_cached:被緩存的線程的個數(shù)
Thread_running:處于激活狀態(tài)的線程的個數(shù)
Thread_connected:當前連接的線程的個數(shù)
Thread_created:總共被創(chuàng)建的線程的個數(shù)
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數(shù)小于90%,創(chuàng)建連接耗費了時間,增大Thread_cached數(shù)量
QPS
Questions = SHOW GLOBAL STATUS LIKE 'Questions';
Uptime = SHOW GLOBAL STATUS LIKE 'Uptime';
QPS=Questions/Uptime
TPS
Com_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值一定要實時監(jiān)控,如果接近架構搭建時的測試峰值,愿上帝與你同在
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
讀寫比,優(yōu)化的重要依據(jù),讀的多就去優(yōu)化讀,寫的多就去優(yōu)化寫
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
新版本上線時要著重關注慢查詢,讓測試去踢開發(fā)者的屁股吧
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,優(yōu)化索引去吧
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
到此,相信大家對“MySQL數(shù)據(jù)庫的性能監(jiān)控方法”有了更深的了解,不妨來實際操作一番吧!這里是億速云網(wǎng)站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續(xù)學習!
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經查實,將立刻刪除涉嫌侵權內容。