ITPub博客

首页 > Linux操作系统 > Linux操作系统 > MySQL中TPS和QPS的计算方式

MySQL中TPS和QPS的计算方式

原创 Linux操作系统 作者:yantaicuiwei 时间:2012-08-23 17:09:14 0 删除 编辑
TPS - Transactions Per Second(每秒传输的事物处理个数),即服务器每秒处理的事务数,如果是InnoDB会显示,没有InnoDB就不会显示。
TPS = (COM_COMMIT + COM_ROLLBACK)/UPTIME

use information_schema;
select VARIABLE_VALUE into @num_com from GLOBAL_STATUS where VARIABLE_NAME ='COM_COMMIT';
select VARIABLE_VALUE into @num_roll from GLOBAL_STATUS where VARIABLE_NAME ='COM_ROLLBACK';
select VARIABLE_VALUE into @uptime from GLOBAL_STATUS where VARIABLE_NAME ='UPTIME';
select (@num_com+@num_roll)/@uptime;


QPS - Queries Per Second(每秒查询处理量)MyISAM 引擎
QUESTIONS/UPTIME

use information_schema;
select VARIABLE_VALUE into @num_queries from GLOBAL_STATUS where VARIABLE_NAME ='QUESTIONS';
select VARIABLE_VALUE into @uptime from GLOBAL_STATUS where VARIABLE_NAME ='UPTIME';
select @num_queries/@uptime;
 
来源于网络

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21601207/viewspace-741749/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-04-15

  • 博文量
    64
  • 访问量
    237086