首页 > 编程知识 正文

数据库性能监控,数据库监听配置

时间:2023-05-05 18:01:19 阅读:56558 作者:2030

1 .数据库监视

QPS:Queries Per Second查询数/秒是一台服务器每秒可处理的查询数,是衡量特定查询服务器在规定时间内可处理的查询数的标准

TPS : Transactions Per Second是每秒钟事务数,是一台数据库服务器在单位时间内处理的事务数。

如何监视数据库连接数

showvariableslike ' max _ connections ';

showglobalstatuslike ' threads _ connected ';

threads _ connected/max _ connections 0.8警报

(1) QPS (每秒查询量) ) ) ) ) )。

QS=questions(orqueries )/seconds

mysqlshowglobalstatuslike ' question % ';

)2) TPS (每秒事务数) ) )。

TPS=(com_commitcom_rollback )/seconds

mysqlshowglobalstatuslike ' com _ commit ';

mysqlshowglobalstatuslike ' com _ roll back ';

)3)密钥缓冲器命中率

MySQL show全局状态like ' key % ';

key _ buffer _ read _ hits=(1- key _ reads/key _ read _ requests ) * 100%

key _ buffer _ write _ hits=(1- key _ writes/key _ write _ requests ) * 100%

(4) Innodb缓冲区命中率

mysqlshowstatuslike ' innodb _ buffer _ pool _ read % ';

innodb _ buffer _ read _ hits=(1- innodb _ buffer _ pool _ reads/innodb _ bufer _ pool _ read _ requ ESTs ) *

)5)查询缓存命中率

mysql show status like 'Qcache% ';

query_cache_hits=(qcahce_hits/) qcache_hitsqcache_inserts ) * 100%;

QPS和TPs的计算方法

QPS=(queries2-queriesl )/(Uptime_since_flush_status2-

Uptime_since_flush_status1)

TPS=(((com _ insert2com _ update2com _ delete2) ) ) ) )。

(com _ insert1com _ update1 com _ delete1) /

(uptime _ since _ flush _ status2- uptime _ since _ flush _ status1)

)6)如何监控数据库的并发请求数

数据库系统的性能随着同时处理的请求数量的增加而下降

showglobalstatuslike ' threads _ running ';

并发处理的数量通常远远少于同时连接到数据库的线程的数量。 数据库被大量阻止

)7)如何监视Innodb数据块

SELECT b.trx_mysql_thread_idAS '已阻止线程',

b.trx_queryAs '被阻止的SQL ',

c .阻止c.trx_mysql_thread_idas '线程',

c.trx_queryas '阻止SQL ',

(UNIX_TimeStamp(-UNIX_TimeStamp ) c.Trx_Started ) ) AS '块时间'

from information _ schema.innodb _ lock _ waitsa

join information _ schema.innodb _ Trx bona.requesting Trx _ id=b.Trx _ id

join information _ schema _ innodb _ Trx ConA.blocking _ Trx _ id=c.Trx _ id

where (UNIX _ timestamp (-UNIX _ timestamp ) c.Trx_Started ) ) 60;

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。