重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

MySQL数据库的性能监控方法-创新互联

本篇内容主要讲解“MySQL数据库的性能监控方法”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“MySQL数据库的性能监控方法”吧!

为广州等地区用户提供了全套网页设计制作服务,及广州网站建设行业解决方案。主营业务为网站设计、成都网站设计、广州网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

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数量

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值一定要实时监控,如果接近架构搭建时的测试峰值,愿上帝与你同在

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

到此,相信大家对“MySQL数据库的性能监控方法”有了更深的了解,不妨来实际操作一番吧!这里是创新互联建站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!


分享题目:MySQL数据库的性能监控方法-创新互联
标题来源:http://cqcxhl.com/article/copcpc.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP